Merge branch 'develop' into 10.0_intracommreport
This commit is contained in:
commit
d6d3fff9dc
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -254,6 +254,7 @@ before_script:
|
||||
fi
|
||||
- sudo a2enmod rewrite actions fastcgi alias
|
||||
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- echo "extension = libzip.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
||||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||
@ -285,7 +286,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
||||
54
ChangeLog
54
ChangeLog
@ -21,9 +21,10 @@ Following changes may create regressions for some external modules, but were nec
|
||||
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
||||
For Users:
|
||||
|
||||
NEW: Module BOM is now stable (Module MO - Manufacturing Order is still in development).
|
||||
NEW: Module BOM is now stable.
|
||||
NEW: Module MO (Manufacturing Order) is available with experimental status.
|
||||
NEW: Can set the Address/Contact by default on third parties.
|
||||
NEW: Add a dictionary for list of Social networks
|
||||
NEW: Add a dictionary to edit list of Social networks.
|
||||
NEW: A nicer dashboard for open elements on Home page.
|
||||
NEW: Add task widget and add task progress bar
|
||||
NEW: Support of deployment of metapackages
|
||||
@ -32,6 +33,7 @@ NEW: Add button "Save and Stay" in website editor of pages.
|
||||
NEW: Accountancy - Can add specific widget in this accountancy area.
|
||||
NEW: Accountancy - Add export model LDCompta V9 & higher
|
||||
NEW: Accountancy - Add permission on export, delete operations in ledger
|
||||
NEW: Can defined alternative profiles (email and signatures) for users.
|
||||
NEW: add ability to edit price without tax before adding a line of a predefined product.
|
||||
NEW: Add a tab to setup "Opening hours" of company (information only).
|
||||
NEW: Add attendee to ical export + cleanup.
|
||||
@ -152,6 +154,7 @@ NEW: #4301
|
||||
|
||||
For Developers or integrators:
|
||||
|
||||
NEW: Compatible with PHP 7.4
|
||||
NEW: Code for extrafields uses the new array $extrafields->attributes
|
||||
NEW: Can set a filter on object linked in modulebuilder.
|
||||
NEW: Can defined a position of numbering submodules for thirdparties
|
||||
@ -226,6 +229,53 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
|
||||
|
||||
|
||||
***** ChangeLog for 10.0.6 compared to 10.0.5 *****
|
||||
FIX Regression of 10.0.5 to create/edit proposals and orders.
|
||||
FIX: #12760 #12763 #12755 #12765 #12751
|
||||
FIX: add product qty in shipment already sent (fix for option STOCK_CALCULATE_ON_SHIPMENT_NEW)
|
||||
FIX: an issue that shows all entities stock
|
||||
FIX: class Facture undefined in displaying margin information
|
||||
FIX: error 500 when getting margin info for objects other than invoices
|
||||
FIX: Loan card - Wrong language key used
|
||||
FIX: Missing language key for MAIN_MAXTABS_IN_CARD
|
||||
FIX: product with empty stock were not visible
|
||||
FIX: remove backward compatibility projectid and uses object id instead
|
||||
FIX: Some issues on salary payment
|
||||
FIX: Some problems on conciliation with others modules
|
||||
FIX: typo on language key
|
||||
FIX: url new for task time spent in project element tab
|
||||
FIX: uses GETPOSTISSET instead of GETPOST for projectfield
|
||||
FIX: var transkey not defined in input hidden
|
||||
FIX: wrong var name and avoid warning
|
||||
|
||||
***** ChangeLog for 10.0.5 compared to 10.0.4 *****
|
||||
FIX: 10.0: add URL param "restore_last_search_values=1" to all backlinks pointing to lists
|
||||
FIX: 10.0: do not display single-letter values (indicating duration unit without value) in product list
|
||||
FIX: #12473
|
||||
FIX: #12481 : fix ticket creation from thirdparty, mission $socid var
|
||||
FIX: #12482
|
||||
FIX: #12644
|
||||
FIX: #12665 Mass invoice validation with stock management
|
||||
FIX: #12688
|
||||
FIX: #12745
|
||||
FIX: add and modify category translate form with posted values on errors
|
||||
FIX: add URL param "restore_last_search_values=1" to all backlinks that point to a list
|
||||
FIX: CommandeFournisseurLigne update function must not be able to return other value than 1 if success
|
||||
FIX: contact card state address selected after filling address
|
||||
FIX: dol_string_nohtmltag when there is html with windows EOL "<br>\r\n"
|
||||
FIX: filter language is an array
|
||||
FIX: first col at wrong position in Export 2007 (new)
|
||||
FIX: getrights() request
|
||||
FIX: Invoice Situation integration into Margin
|
||||
FIX: missing nl2br conversion
|
||||
FIX: not fee in payout list
|
||||
FIX: product_fourn_price_id was assigned too late for logPrice() function
|
||||
FIX: Reduce number of request for list of products
|
||||
FIX: set due date in object in create invoice
|
||||
FIX: units traductions for selectUnits() function
|
||||
FIX: when we need to bill several orders, order lines unit is not on bill lines
|
||||
NEW: 9.0: allow users to use the mysqldump '--quick' option
|
||||
|
||||
***** ChangeLog for 10.0.4 compared to 10.0.3 *****
|
||||
FIX: The pdf templates were using the large logo making PDF too large (and edition of proposal, order, invoice VERY slow)
|
||||
FIX: #12258
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||

|
||||

|
||||
|
||||
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
|
||||
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
|
||||
|
||||

|
||||

|
||||
|
||||
## LICENCE
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||

|
||||
|
||||
|7|8|9|10|develop|
|
||||
|----------|----------|----------|----------|----------|
|
||||
||||||
|
||||

|
||||
|
||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||
|
||||
@ -14,7 +11,7 @@ You can freely use, study, modify or distribute it according to its Free Softwar
|
||||
|
||||
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
|
||||
|
||||

|
||||

|
||||
|
||||
## LICENSE
|
||||
|
||||
|
||||
@ -231,3 +231,8 @@ $dolibarr_main_prod='0';
|
||||
# Default value: 0 (use database value if exist)
|
||||
# Examples:
|
||||
# $dolibarr_mailing_limit_sendbycli='0';
|
||||
|
||||
# dolibarr_distrib
|
||||
# A key to identify the distribution used for first installation
|
||||
$dolibarr_distrib = 'deb';
|
||||
|
||||
|
||||
@ -1 +1,2 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-stellar.zip
|
||||
@ -3,10 +3,11 @@ FROM php:7.2-apache
|
||||
ENV HOST_USER_ID 33
|
||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++\
|
||||
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
||||
&& docker-php-ext-install gd \
|
||||
&& docker-php-ext-install zip \
|
||||
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
|
||||
&& docker-php-ext-install ldap \
|
||||
&& docker-php-ext-install mysqli \
|
||||
|
||||
@ -110,7 +110,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\m
|
||||
; Mysql data files (does not overwrite if exists)
|
||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
|
||||
; Dolibarr
|
||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
|
||||
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
|
||||
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
|
||||
|
||||
@ -146,7 +146,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
|
||||
231
dev/initdata/dbf/import-dbf.php
Normal file
231
dev/initdata/dbf/import-dbf.php
Normal file
@ -0,0 +1,231 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-dbf.php
|
||||
* \brief Script example to create a table from a large DBF file (openoffice)
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = dirname($_SERVER["PHP_SELF"]);
|
||||
require $path . "./../htdocs/master.inc.php";
|
||||
require $path . "/includes/dbase.class.php";
|
||||
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
|
||||
$filepath = $argv[1];
|
||||
$filepatherr = $filepath . '.err';
|
||||
$startchar = empty($argv[2]) ? 0 : (int) $argv[2];
|
||||
$deleteTable = empty($argv[3]) ? 1 : 0;
|
||||
$startlinenb = empty($argv[3]) ? 1 : (int) $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4];
|
||||
|
||||
if (empty($filepath)) {
|
||||
print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n";
|
||||
print "Example: php $script_file myfilepath.dbf 0 2 1002\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
if (!file_exists($filepath)) {
|
||||
print "Error: File " . $filepath . " not found.\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
||||
// Ask confirmation
|
||||
if (!$confirmed) {
|
||||
print "Hit Enter to continue or CTRL+C to stop...\n";
|
||||
$input = trim(fgets(STDIN));
|
||||
}
|
||||
|
||||
// Open input and output files
|
||||
$fhandle = dbase_open($filepath, 0);
|
||||
if (!$fhandle) {
|
||||
print 'Error: Failed to open file ' . $filepath . "\n";
|
||||
exit(1);
|
||||
}
|
||||
$fhandleerr = fopen($filepatherr, 'w');
|
||||
if (!$fhandleerr) {
|
||||
print 'Error: Failed to open file ' . $filepatherr . "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$langs->setDefaultLang($defaultlang);
|
||||
|
||||
$record_numbers = dbase_numrecords($fhandle);
|
||||
$table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.'));
|
||||
print 'Info: ' . $record_numbers . " lines in file \n";
|
||||
$header = dbase_get_header_info($fhandle);
|
||||
if ($deleteTable) {
|
||||
$db->query("DROP TABLE IF EXISTS `$table_name`");
|
||||
}
|
||||
$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT ";
|
||||
$fieldArray = array("`id`");
|
||||
foreach ($header as $value) {
|
||||
$fieldName = substr(str_replace('_', '', $value['name']), $startchar);
|
||||
$fieldArray[] = "`$fieldName`";
|
||||
$sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL ";
|
||||
}
|
||||
$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB";
|
||||
$resql = $db->query($sqlCreate);
|
||||
if ($resql !== false) {
|
||||
print "Table $table_name created\n";
|
||||
} else {
|
||||
var_dump($db->errno());
|
||||
print "Impossible : " . $sqlCreate . "\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$nboflines++;
|
||||
|
||||
$fields = implode(',', $fieldArray);
|
||||
//var_dump($fieldArray);die();
|
||||
$maxLength = 0;
|
||||
for ($i = 1; $i <= $record_numbers; $i++) {
|
||||
if ($startlinenb && $i < $startlinenb)
|
||||
continue;
|
||||
if ($endlinenb && $i > $endlinenb)
|
||||
continue;
|
||||
$row = dbase_get_record_with_names($fhandle, $i);
|
||||
if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1'))
|
||||
continue;
|
||||
$sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,";
|
||||
array_shift($row); // remove delete column
|
||||
foreach ($row as $value) {
|
||||
$sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', ";
|
||||
}
|
||||
replaceable_echo(implode("\t", $row));
|
||||
$sqlInsert = rtrim($sqlInsert, ', ');
|
||||
$sqlInsert .= ")";
|
||||
$resql = $db->query($sqlInsert);
|
||||
if ($resql === false) {
|
||||
print "Impossible : " . $sqlInsert . "\n";
|
||||
var_dump($row, $db->errno());
|
||||
die();
|
||||
}
|
||||
// $fields = (object) $row;
|
||||
// var_dump($fields);
|
||||
continue;
|
||||
}
|
||||
die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
|
||||
print "Rollback any changes.\n";
|
||||
$db->rollback();
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
fclose($fhandle);
|
||||
fclose($fhandleerr);
|
||||
|
||||
exit($error);
|
||||
|
||||
|
||||
/**
|
||||
* replaceable_echo
|
||||
*
|
||||
* @param string $message Message
|
||||
* @param int $force_clear_lines Force clear messages
|
||||
* @return void
|
||||
*/
|
||||
function replaceable_echo($message, $force_clear_lines = null)
|
||||
{
|
||||
static $last_lines = 0;
|
||||
|
||||
if (!is_null($force_clear_lines)) {
|
||||
$last_lines = $force_clear_lines;
|
||||
}
|
||||
|
||||
$toss = array();
|
||||
$status = 0;
|
||||
$term_width = exec('tput cols', $toss, $status);
|
||||
if ($status) {
|
||||
$term_width = 64; // Arbitrary fall-back term width.
|
||||
}
|
||||
|
||||
$line_count = 0;
|
||||
foreach (explode("\n", $message) as $line) {
|
||||
$line_count += count(str_split($line, $term_width));
|
||||
}
|
||||
|
||||
// Erasure MAGIC: Clear as many lines as the last output had.
|
||||
for ($i = 0; $i < $last_lines; $i++) {
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Erase to the end of the line
|
||||
echo "\033[K";
|
||||
// Move cursor Up a line
|
||||
echo "\033[1A";
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Erase to the end of the line
|
||||
echo "\033[K";
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Can be consolodated into
|
||||
// echo "\r\033[K\033[1A\r\033[K\r";
|
||||
}
|
||||
|
||||
$last_lines = $line_count;
|
||||
|
||||
echo $message . "\n";
|
||||
}
|
||||
241
dev/initdata/dbf/importdb-products.php
Normal file
241
dev/initdata/dbf/importdb-products.php
Normal file
@ -0,0 +1,241 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-product.php
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = preg_replace('/importdb-products.php/i', '', $_SERVER["PHP_SELF"]);
|
||||
require $path . "../../htdocs/master.inc.php";
|
||||
require $path . "includes/dbase.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
//$delimiter = ',';
|
||||
//$enclosure = '"';
|
||||
//$linelength = 10000;
|
||||
//$escape = '/';
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
$tvas = [
|
||||
'1' => "20.00",
|
||||
'2' => "5.50",
|
||||
'3' => "0.00",
|
||||
'4' => "20.60",
|
||||
'5' => "19.60",
|
||||
];
|
||||
$tvasD = [
|
||||
'1' => "20",
|
||||
'2' => "5.5",
|
||||
'3' => "0",
|
||||
'4' => "20",
|
||||
'5' => "20",
|
||||
];
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
$table = $argv[1];
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Error: Which table ?\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `$table` WHERE 1";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
while ($fields = $db->fetch_array($resql)) {
|
||||
$errorrecord = 0;
|
||||
if ($fields === false)
|
||||
continue;
|
||||
$nboflines++;
|
||||
|
||||
$produit = new Product($db);
|
||||
$produit->type = 0;
|
||||
$produit->status = 1;
|
||||
$produit->ref = trim($fields['REF']);
|
||||
if ($produit->ref == '')
|
||||
continue;
|
||||
print "Process line nb " . $j . ", ref " . $produit->ref;
|
||||
$produit->label = trim($fields['LIBELLE']);
|
||||
if ($produit->label == '')
|
||||
$produit->label = $produit->ref;
|
||||
if (empty($produit->label))
|
||||
continue;
|
||||
//$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : ''));
|
||||
// $produit->volume = price2num($fields[8]);
|
||||
// $produit->volume_unit = 0;
|
||||
$produit->weight = price2num($fields['MASSE']);
|
||||
$produit->weight_units = 0; // -3 = g
|
||||
//$produit->customcode = $fields[10];
|
||||
$produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT);
|
||||
$produit->barcode_type = '2';
|
||||
$produit->import_key = $fields['CODE'];
|
||||
|
||||
$produit->status = 1;
|
||||
$produit->status_buy = 1;
|
||||
|
||||
$produit->finished = 1;
|
||||
|
||||
// $produit->multiprices[0] = price2num($fields['TARIF0']);
|
||||
// $produit->multiprices[1] = price2num($fields['TARIF1']);
|
||||
// $produit->multiprices[2] = price2num($fields['TARIF2']);
|
||||
// $produit->multiprices[3] = price2num($fields['TARIF3']);
|
||||
// $produit->multiprices[4] = price2num($fields['TARIF4']);
|
||||
// $produit->multiprices[5] = price2num($fields['TARIF5']);
|
||||
// $produit->multiprices[6] = price2num($fields['TARIF6']);
|
||||
// $produit->multiprices[7] = price2num($fields['TARIF7']);
|
||||
// $produit->multiprices[8] = price2num($fields['TARIF8']);
|
||||
// $produit->multiprices[9] = price2num($fields['TARIF9']);
|
||||
// $produit->price_min = null;
|
||||
// $produit->price_min_ttc = null;
|
||||
// $produit->price = price2num($fields[11]);
|
||||
// $produit->price_ttc = price2num($fields[12]);
|
||||
// $produit->price_base_type = 'TTC';
|
||||
// $produit->tva_tx = price2num($fields[13]);
|
||||
$produit->tva_tx = (int) ($tvas[$fields['CODTVA']]);
|
||||
$produit->tva_npr = 0;
|
||||
// $produit->cost_price = price2num($fields[16]);
|
||||
//compta
|
||||
|
||||
$produit->accountancy_code_buy = trim($fields['COMACH']);
|
||||
$produit->accountancy_code_sell = trim($fields['COMVEN']);
|
||||
// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']);
|
||||
// $produit->accountancy_code_sell_export=trim($fields['COMVEN']);
|
||||
// Extrafields
|
||||
// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
|
||||
|
||||
$produit->seuil_stock_alerte = $fields['STALERTE'];
|
||||
$ret = $produit->create($user, 0);
|
||||
if ($ret < 0) {
|
||||
print " - Error in create result code = " . $ret . " - " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - Creation OK with ref " . $produit->ref . " - id = " . $ret;
|
||||
}
|
||||
|
||||
dol_syslog("Add prices");
|
||||
|
||||
// If we use price level, insert price for each level
|
||||
if (!$errorrecord && 1) {
|
||||
//$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
|
||||
$ret1 = false;
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
if ($fields['TARIF' . ($i)] == 0)
|
||||
continue;
|
||||
$ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0;
|
||||
}
|
||||
if ($ret1) {
|
||||
print " - Error in updatePrice result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - updatePrice OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// dol_syslog("Add multilangs");
|
||||
// Add alternative languages
|
||||
// if (!$errorrecord && 1) {
|
||||
// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private);
|
||||
// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private);
|
||||
//
|
||||
// $ret = $produit->setMultiLangs($user);
|
||||
// if ($ret < 0) {
|
||||
// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString();
|
||||
// $errorrecord++;
|
||||
// } else {
|
||||
// print " - setMultiLangs OK";
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
dol_syslog("Add stocks");
|
||||
// stocks
|
||||
if (!$errorrecord && $fields['STOCK'] != 0) {
|
||||
$rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé');
|
||||
if ($rets < 0) {
|
||||
print " - Error in correct_stock result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - correct_stock OK";
|
||||
}
|
||||
}
|
||||
|
||||
//update date créa
|
||||
if (!$errorrecord) {
|
||||
$date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2);
|
||||
$retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id");
|
||||
if ($retd < 1) {
|
||||
print " - Error in update date créa result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - update date créa OK";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord) {
|
||||
print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n");
|
||||
var_dump($db);
|
||||
die();
|
||||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
$db->close();
|
||||
|
||||
exit($error);
|
||||
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
@ -0,0 +1,355 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-product.php
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = preg_replace('/importdb-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
|
||||
require $path . "../../htdocs/master.inc.php";
|
||||
require $path . "includes/dbase.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
//$delimiter = ',';
|
||||
//$enclosure = '"';
|
||||
//$linelength = 10000;
|
||||
//$escape = '/';
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
$civilPrivate = array("MLLE",
|
||||
"MM",
|
||||
"MM/MADAME",
|
||||
"MME",
|
||||
"MME.",
|
||||
"MME²",
|
||||
"MMONSIEUR",
|
||||
"MMR",
|
||||
"MOBNSIEUR",
|
||||
"MOMSIEUR",
|
||||
"MON SIEUR",
|
||||
"MONDIAL",
|
||||
"MONIEUR",
|
||||
"MONJSIEUR",
|
||||
"MONNSIEUR",
|
||||
"MONRIEUR",
|
||||
"MONS",
|
||||
"MONSIEÕR",
|
||||
"MONSIER",
|
||||
"MONSIERU",
|
||||
"MONSIEU",
|
||||
"monsieue",
|
||||
"MONSIEUR",
|
||||
"Monsieur \"",
|
||||
"MONSIEUR \"",
|
||||
"MONSIEUR E",
|
||||
"MONSIEUR DENIS",
|
||||
"MONSIEUR ET MME",
|
||||
"MONSIEUR!",
|
||||
"MONSIEUR.",
|
||||
"MONSIEUR.MADAME",
|
||||
"MONSIEUR3",
|
||||
"MONSIEURN",
|
||||
"MONSIEURT",
|
||||
"MONSIEUR£",
|
||||
"MONSIEYR",
|
||||
"Monsigur",
|
||||
"MONSIIEUR",
|
||||
"MONSIUER",
|
||||
"MONSIZEUR",
|
||||
"MOPNSIEUR",
|
||||
"MOSIEUR",
|
||||
"MR",
|
||||
"Mr Mme",
|
||||
"Mr - MME",
|
||||
"MR BLANC",
|
||||
"MR ET MME",
|
||||
"mr mm",
|
||||
"MR OU MME",
|
||||
"Mr.",
|
||||
"MR/MME",
|
||||
"MRME",
|
||||
"MRR",
|
||||
"Mrs",
|
||||
"Mademoiselle",
|
||||
"MADAOME",
|
||||
"madamme",
|
||||
"MADAME",
|
||||
"M0NSIEUR",
|
||||
"M.et Madame",
|
||||
"M. ET MR",
|
||||
"M.",
|
||||
"M%",
|
||||
"M MME",
|
||||
"M ET MME",
|
||||
"M",
|
||||
"M CROCE",
|
||||
"M DIEVART",
|
||||
);
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
$table = $argv[1];
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Error: Quelle table ?\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC";
|
||||
$resql = $db->query($sql);
|
||||
//$db->begin();
|
||||
if ($resql)
|
||||
while ($fields = $db->fetch_array($resql)) {
|
||||
$i++;
|
||||
$errorrecord = 0;
|
||||
|
||||
if ($startlinenb && $i < $startlinenb)
|
||||
continue;
|
||||
if ($endlinenb && $i > $endlinenb)
|
||||
continue;
|
||||
|
||||
$nboflines++;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->import_key = $fields['CODE'];
|
||||
$object->state = 1;
|
||||
$object->client = 3;
|
||||
$object->fournisseur = 0;
|
||||
|
||||
$object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM'];
|
||||
//$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
|
||||
|
||||
$date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101');
|
||||
$object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT);
|
||||
|
||||
|
||||
$object->address = trim($fields['FADR1']);
|
||||
if ($fields['FADR2'])
|
||||
$object->address .= "\n" . trim($fields['FADR2']);
|
||||
if ($fields['FADR3'])
|
||||
$object->address .= "\n" . trim($fields['FADR3']);
|
||||
|
||||
$object->zip = trim($fields['FPOSTE']);
|
||||
$object->town = trim($fields['FVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$object->country_id = 1;
|
||||
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
|
||||
$object->phone = substr($object->phone, 0, 20);
|
||||
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
|
||||
$object->fax = substr($object->fax, 0, 20);
|
||||
$object->email = trim($fields['FMAIL']);
|
||||
// $object->idprof2 = trim($fields[29]);
|
||||
$object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']);
|
||||
$object->tva_intra = substr($object->tva_intra, 0, 20);
|
||||
$object->default_lang = 'fr_FR';
|
||||
|
||||
$object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1);
|
||||
$object->multicurrency_code = 'EUR';
|
||||
|
||||
if ($fields['REMISE'] != '0.00') {
|
||||
$object->remise_percent = abs($fields['REMISE']);
|
||||
}
|
||||
|
||||
// $object->code_client = $fields[9];
|
||||
// $object->code_fournisseur = $fields[10];
|
||||
|
||||
|
||||
if ($fields['FCIVIL']) {
|
||||
$labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL';
|
||||
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code');
|
||||
}
|
||||
|
||||
// Set price level
|
||||
$object->price_level = $fields['TARIF'] + 1;
|
||||
// if ($labeltype == 'Revendeur')
|
||||
// $object->price_level = 2;
|
||||
|
||||
print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name;
|
||||
|
||||
|
||||
// Extrafields
|
||||
$object->array_options['options_banque'] = $fields['BANQUE'];
|
||||
$object->array_options['options_banque2'] = $fields['BANQUE2'];
|
||||
$object->array_options['options_banquevalid'] = $fields['VALID'];
|
||||
|
||||
if (!$errorrecord) {
|
||||
$ret = $object->create($user);
|
||||
if ($ret < 0) {
|
||||
print " - Error in create result code = " . $ret . " - " . $object->errorsToString();
|
||||
$errorrecord++;
|
||||
var_dump($object->code_client, $db);
|
||||
die();
|
||||
} else {
|
||||
print " - Creation OK with name " . $object->name . " - id = " . $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errorrecord) {
|
||||
dol_syslog("Set price level");
|
||||
$object->set_price_level($object->price_level, $user);
|
||||
}
|
||||
if (!$errorrecord && @$object->remise_percent) {
|
||||
dol_syslog("Set remise client");
|
||||
$object->set_remise_client($object->remise_percent, 'Importé', $user);
|
||||
}
|
||||
|
||||
dol_syslog("Add contact");
|
||||
// Insert an invoice contact if there is an invoice email != standard email
|
||||
if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) {
|
||||
$madame = array("MADAME",
|
||||
"MADEMOISELLE",
|
||||
"MELLE",
|
||||
"MLLE",
|
||||
"MM",
|
||||
"Mme",
|
||||
"MNE",
|
||||
);
|
||||
$monsieur = array("M",
|
||||
"M ET MME",
|
||||
"M MME",
|
||||
"M.",
|
||||
"M. MME",
|
||||
"M. OU Mme",
|
||||
"M.ou Madame",
|
||||
"MONSEUR",
|
||||
"MONSIER",
|
||||
"MONSIEU",
|
||||
"MONSIEUR",
|
||||
"monsieur:mme",
|
||||
"MONSIEUR¨",
|
||||
"MONSIEZUR",
|
||||
"MONSIUER",
|
||||
"MONSKIEUR",
|
||||
"MR",
|
||||
);
|
||||
$ret1 = $ret2 = 0;
|
||||
|
||||
$contact = new Contact($db);
|
||||
if (in_array($fields['LCIVIL'], $madame)) {
|
||||
// une dame
|
||||
$contact->civility_id = 'MME';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} elseif (in_array($fields['LCIVIL'], $monsieur)) {
|
||||
// un monsieur
|
||||
$contact->civility_id = 'MR';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) {
|
||||
// un monsieur
|
||||
$contact->civility_id = 'DR';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} else {
|
||||
// un a rattraper
|
||||
$contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM'];
|
||||
}
|
||||
$contact->address = trim($fields['LADR1']);
|
||||
if ($fields['LADR2'])
|
||||
$contact->address .= "\n" . trim($fields['LADR2']);
|
||||
if ($fields['LADR3'])
|
||||
$contact->address .= "\n" . trim($fields['LADR3']);
|
||||
|
||||
$contact->zip = trim($fields['LPOSTE']);
|
||||
$contact->town = trim($fields['LVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$contact->country_id = 1;
|
||||
$contact->email = $fields['LMAIL'];
|
||||
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
|
||||
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
|
||||
$contact->socid = $object->id;
|
||||
|
||||
$ret1 = $contact->create($user);
|
||||
if ($ret1 > 0) {
|
||||
//$ret2=$contact->add_contact($object->id, 'BILLING');
|
||||
}
|
||||
if ($ret1 < 0 || $ret2 < 0) {
|
||||
print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - create contact OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//update date créa
|
||||
if (!$errorrecord) {
|
||||
$datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
|
||||
$retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id");
|
||||
if ($retd < 1) {
|
||||
print " - Error in update date créa result " . $object->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - update date créa OK";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord) {
|
||||
print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n");
|
||||
var_dump($db, $object, $contact);
|
||||
// $db->rollback();
|
||||
die();
|
||||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
|
||||
$db->commit();
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
$db->close();
|
||||
|
||||
exit($error);
|
||||
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
@ -0,0 +1,402 @@
|
||||
<?php
|
||||
/**
|
||||
* \file dev/initdata/dbf/includes/dbase.class.php
|
||||
* \ingroup dev
|
||||
* \brief Class to manage DBF databases
|
||||
*/
|
||||
|
||||
// source : https://github.com/donfbecker/php-dbase
|
||||
|
||||
define('DBASE_RDONLY', 0);
|
||||
define('DBASE_WRONLY', 1);
|
||||
define('DBASE_RDWR', 2);
|
||||
define('DBASE_TYPE_DBASE', 0);
|
||||
define('DBASE_TYPE_FOXPRO', 1);
|
||||
|
||||
/**
|
||||
* Class for DBase
|
||||
*/
|
||||
class DBase
|
||||
{
|
||||
private $fd;
|
||||
private $headerLength = 0;
|
||||
private $fields = array();
|
||||
private $fieldCount = 0;
|
||||
private $recordLength = 0;
|
||||
private $recordCount = 0;
|
||||
|
||||
//resource dbase_open ( string $filename , int $mode )
|
||||
public static function open($filename, $mode)
|
||||
{
|
||||
if (!file_exists($filename))
|
||||
return false;
|
||||
$modes = array('r', 'w', 'r+');
|
||||
$mode = $modes[$mode];
|
||||
$fd = fopen($filename, $mode);
|
||||
if (!$fd)
|
||||
return false;
|
||||
return new DBase($fd);
|
||||
}
|
||||
|
||||
//resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] )
|
||||
public static function create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||
{
|
||||
if (file_exists($filename))
|
||||
return false;
|
||||
$fd = fopen($filename, 'c+');
|
||||
if (!$fd)
|
||||
return false;
|
||||
// Byte 0 (1 byte): Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3
|
||||
// indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the
|
||||
// presence of a SQL table, bit 7 indicates the presence of any memo file
|
||||
// (either dBASE m PLUS or dBASE for DOS)
|
||||
self::putChar8($fd, 5);
|
||||
// Byte 1-3 (3 bytes): Date of last update; formatted as YYMMDD
|
||||
self::putChar8($fd, date('Y') - 1900);
|
||||
self::putChar8($fd, date('m'));
|
||||
self::putChar8($fd, date('d'));
|
||||
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||
self::putInt32($fd, 0);
|
||||
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||
self::putInt16($fd, 32 + (32 * count($fields)) + 1);
|
||||
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||
// Make sure the include the byte for deleted flag
|
||||
$len = 1;
|
||||
foreach ($fields as &$field)
|
||||
$len += self::length($field);
|
||||
self::putInt16($fd, $len);
|
||||
// Byte 12-13 (2 bytes): Reserved, 0 filled.
|
||||
self::putInt16($fd, 0);
|
||||
// Byte 14 (1 byte): Flag indicating incomplete transaction
|
||||
// The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 15 (1 byte): Encryption flag. If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 16-27 (12 bytes): Reserved for dBASE for DOS in a multi-user environment
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt32($fd, 0);
|
||||
// Byte 28 (1 byte): Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 29 (1 byte): Language driver ID
|
||||
// (no clue what this is)
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 30-31 (2 bytes): Reserved, 0 filled.
|
||||
self::putInt16($fd, 0);
|
||||
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||
foreach ($fields as &$field) {
|
||||
self::putString($fd, $field[0], 11); // Byte 0 - 10 (11 bytes): Field name in ASCII (zero-filled)
|
||||
self::putString($fd, $field[1], 1); // Byte 11 (1 byte): Field type in ASCII (C, D, F, L, M, or N)
|
||||
self::putInt32($fd, 0); // Byte 12 - 15 (4 bytes): Reserved
|
||||
self::putChar8($fd, self::length($field)); // Byte 16 (1 byte): Field length in binary. The maximum length of a field is 254 (0xFE).
|
||||
self::putChar8($fd, $field[3]); // Byte 17 (1 byte): Field decimal count in binary
|
||||
self::putInt16($fd, 0); // Byte 18 - 19 (2 bytes): Work area ID
|
||||
self::putChar8($fd, 0); // Byte 20 (1 byte): Example (??)
|
||||
self::putInt32($fd, 0); // Byte 21 - 30 (10 bytes): Reserved
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt16($fd, 0);
|
||||
self::putChar8($fd, 0); // Byte 31 (1 byte): Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
|
||||
}
|
||||
// Byte n + 1 (1 byte): 0x0D as the field descriptor array terminator
|
||||
self::putChar8($fd, 0x0D);
|
||||
return new DBase($fd);
|
||||
}
|
||||
|
||||
// Create DBase instance
|
||||
private function __construct($fd)
|
||||
{
|
||||
$this->fd = $fd;
|
||||
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||
fseek($this->fd, 4, SEEK_SET);
|
||||
$this->recordCount = self::getInt32($fd);
|
||||
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||
fseek($this->fd, 8, SEEK_SET);
|
||||
$this->headerLength = self::getInt16($fd);
|
||||
// Number of fields is (headerLength - 33) / 32)
|
||||
$this->fieldCount = ($this->headerLength - 33) / 32;
|
||||
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||
fseek($this->fd, 10, SEEK_SET);
|
||||
$this->recordLength = self::getInt16($fd);
|
||||
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||
fseek($fd, 32, SEEK_SET);
|
||||
for ($i = 0; $i < $this->fieldCount; $i++) {
|
||||
$data = fread($this->fd, 32);
|
||||
$field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data));
|
||||
$this->fields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
//bool dbase_close ( resource $dbase_identifier )
|
||||
public function close()
|
||||
{
|
||||
fclose($this->fd);
|
||||
}
|
||||
|
||||
//array dbase_get_header_info ( resource $dbase_identifier )
|
||||
public function get_header_info()
|
||||
{
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
//int dbase_numfields ( resource $dbase_identifier )
|
||||
public function numfields()
|
||||
{
|
||||
return $this->fieldCount;
|
||||
}
|
||||
|
||||
//int dbase_numrecords ( resource $dbase_identifier )
|
||||
public function numrecords()
|
||||
{
|
||||
return $this->recordCount;
|
||||
}
|
||||
|
||||
//bool dbase_add_record ( resource $dbase_identifier , array $record )
|
||||
public function add_record($record)
|
||||
{
|
||||
if (count($record) != $this->fieldCount)
|
||||
return false;
|
||||
// Seek to end of file, minus the end of file marker
|
||||
fseek($this->fd, 0, SEEK_END);
|
||||
// Put the deleted flag
|
||||
self::putChar8($this->fd, 0x20);
|
||||
// Put the record
|
||||
if (!$this->putRecord($record))
|
||||
return false;
|
||||
// Update the record count
|
||||
fseek($this->fd, 4);
|
||||
self::putInt32($this->fd, ++$this->recordCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number )
|
||||
public function replace_record($record, $record_number)
|
||||
{
|
||||
if (count($record) != $this->fieldCount)
|
||||
return false;
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
// Skip to the record location, plus the 1 byte for the deleted flag
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1);
|
||||
return $this->putRecord($record);
|
||||
}
|
||||
|
||||
//bool dbase_delete_record ( resource $dbase_identifier , int $record_number )
|
||||
public function delete_record($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||
self::putChar8($this->fd, 0x2A);
|
||||
return true;
|
||||
}
|
||||
|
||||
//array dbase_get_record ( resource $dbase_identifier , int $record_number )
|
||||
public function get_record($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||
$record = array(
|
||||
'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0
|
||||
);
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$value = trim(fread($this->fd, $field['length']));
|
||||
if ($field['type'] == 'L') {
|
||||
$value = strtolower($value);
|
||||
if ($value == 't' || $value == 'y')
|
||||
$value = true;
|
||||
elseif ($value == 'f' || $value == 'n')
|
||||
$value = false;
|
||||
else
|
||||
$value = null;
|
||||
}
|
||||
$record[$i] = $value;
|
||||
}
|
||||
return $record;
|
||||
}
|
||||
|
||||
//array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number )
|
||||
public function get_record_with_names($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
$record = $this->get_record($record_number);
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$record[$field['name']] = $record[$i];
|
||||
unset($record[$i]);
|
||||
}
|
||||
return $record;
|
||||
}
|
||||
|
||||
//bool dbase_pack ( resource $dbase_identifier )
|
||||
public function pack()
|
||||
{
|
||||
$in_offset = $out_offset = $this->headerLength;
|
||||
$new_count = 0;
|
||||
$rec_count = $this->recordCount;
|
||||
while ($rec_count > 0) {
|
||||
fseek($this->fd, $in_offset, SEEK_SET);
|
||||
$record = fread($this->fd, $this->recordLength);
|
||||
$deleted = substr($record, 0, 1);
|
||||
if ($deleted != '*') {
|
||||
fseek($this->fd, $out_offset, SEEK_SET);
|
||||
fwrite($this->fd, $record);
|
||||
$out_offset += $this->recordLength;
|
||||
$new_count++;
|
||||
}
|
||||
$in_offset += $this->recordLength;
|
||||
$rec_count--;
|
||||
}
|
||||
ftruncate($this->fd, $out_offset);
|
||||
// Update the record count
|
||||
fseek($this->fd, 4);
|
||||
self::putInt32($this->fd, $new_count);
|
||||
}
|
||||
|
||||
/*
|
||||
* A few utilitiy functions
|
||||
*/
|
||||
|
||||
private static function length($field)
|
||||
{
|
||||
switch ($field[1]) {
|
||||
case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
|
||||
return 8;
|
||||
case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro)
|
||||
return 18;
|
||||
case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
|
||||
case 'N': // Number: -.0123456789 (right justified, padded with whitespaces)
|
||||
case 'F': // Float: -.0123456789 (right justified, padded with whitespaces)
|
||||
case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length)
|
||||
return $field[2];
|
||||
case 'L': // Boolean: YyNnTtFf? (? when not initialized)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions for reading and writing bytes
|
||||
*/
|
||||
|
||||
private static function getChar8($fd)
|
||||
{
|
||||
return ord(fread($fd, 1));
|
||||
}
|
||||
|
||||
private static function putChar8($fd, $value)
|
||||
{
|
||||
return fwrite($fd, chr($value));
|
||||
}
|
||||
|
||||
private static function getInt16($fd, $n = 1)
|
||||
{
|
||||
$data = fread($fd, 2 * $n);
|
||||
$i = unpack("S$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt16($fd, $value)
|
||||
{
|
||||
return fwrite($fd, pack('S', $value));
|
||||
}
|
||||
|
||||
private static function getInt32($fd, $n = 1)
|
||||
{
|
||||
$data = fread($fd, 4 * $n);
|
||||
$i = unpack("L$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt32($fd, $value)
|
||||
{
|
||||
return fwrite($fd, pack('L', $value));
|
||||
}
|
||||
|
||||
private static function putString($fd, $value, $length = 254)
|
||||
{
|
||||
$ret = fwrite($fd, pack('A' . $length, $value));
|
||||
}
|
||||
|
||||
private function putRecord($record)
|
||||
{
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$value = $record[$i];
|
||||
// Number types are right aligned with spaces
|
||||
if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) {
|
||||
$value = str_repeat(' ', $field['length'] - strlen($value)) . $value;
|
||||
}
|
||||
self::putString($this->fd, $value, $field['length']);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('dbase_open')) {
|
||||
|
||||
function dbase_open($filename, $mode)
|
||||
{
|
||||
return DBase::open($filename, $mode);
|
||||
}
|
||||
|
||||
function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||
{
|
||||
return DBase::create($filename, $fields, $type);
|
||||
}
|
||||
|
||||
function dbase_close($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->close();
|
||||
}
|
||||
|
||||
function dbase_get_header_info($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->get_header_info();
|
||||
}
|
||||
|
||||
function dbase_numfields($dbase_identifier)
|
||||
{
|
||||
$dbase_identifier->numfields();
|
||||
}
|
||||
|
||||
function dbase_numrecords($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->numrecords();
|
||||
}
|
||||
|
||||
function dbase_add_record($dbase_identifier, $record)
|
||||
{
|
||||
return $dbase_identifier->add_record($record);
|
||||
}
|
||||
|
||||
function dbase_delete_record($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->delete_record($record_number);
|
||||
}
|
||||
|
||||
function dbase_replace_record($dbase_identifier, $record, $record_number)
|
||||
{
|
||||
return $dbase_identifier->replace_record($record, $record_number);
|
||||
}
|
||||
|
||||
function dbase_get_record($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->get_record($record_number);
|
||||
}
|
||||
|
||||
function dbase_get_record_with_names($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->get_record_with_names($record_number);
|
||||
}
|
||||
|
||||
function dbase_pack($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->pack();
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,10 @@ $sqls=array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)",
|
||||
),
|
||||
'supplier_payment'=>array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn where fk_facturefourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn where rowid NOT IN (SELECT fk_paiementfourn FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn)",
|
||||
),
|
||||
'bank'=>array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
|
||||
@ -103,6 +107,7 @@ $sqls=array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'",
|
||||
),
|
||||
'supplier_invoice'=>array(
|
||||
'@supplier_payment',
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'",
|
||||
),
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -6,6 +6,7 @@
|
||||
<exclude-pattern type="relative">build/html</exclude-pattern>
|
||||
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
||||
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
|
||||
<exclude-pattern type="relative">dev/initdata/dbf/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">documents</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
|
||||
|
||||
@ -16,7 +16,9 @@ then
|
||||
echo "This pull remote transifex files to local dir."
|
||||
echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
|
||||
echo " Using -f will overwrite local file (does not work with 'all')."
|
||||
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f] [-s]"
|
||||
echo " Using -s will force fetching of source file (avoid it, use en_US as language instead)."
|
||||
echo " Using en_US as language parameter will update source language from transifex (en_US is excluded from 'all')."
|
||||
echo "Usage: ./dev/translation/txpull.sh (all|en_US|xx_XX) [-r dolibarr.file] [-f] [-s]"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -27,6 +27,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries"));
|
||||
@ -41,6 +42,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'acc
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_labelshort = GETPOST('search_labelshort', 'alpha');
|
||||
$search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
||||
@ -64,6 +66,7 @@ if (!$sortorder) $sortorder = "ASC";
|
||||
$arrayfields = array(
|
||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||
@ -95,7 +98,8 @@ if (empty($reshook))
|
||||
{
|
||||
$search_account = "";
|
||||
$search_label = "";
|
||||
$search_accountparent = "";
|
||||
$search_labelshort = "";
|
||||
$search_accountparent = "";
|
||||
$search_pcgtype = "";
|
||||
$search_pcgsubtype = "";
|
||||
$search_array_options = array();
|
||||
@ -180,6 +184,7 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListAccounts"));
|
||||
|
||||
@ -190,7 +195,7 @@ if ($action == 'delete') {
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, ";
|
||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
|
||||
@ -198,9 +203,43 @@ if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_accou
|
||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
|
||||
$sql .= " WHERE asy.rowid = ".$pcgver;
|
||||
//print $sql;
|
||||
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
||||
if (strlen(trim($search_account))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
}
|
||||
$search_account_tmp = $search_account;
|
||||
$weremovedsomezero = 0;
|
||||
if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
|
||||
for($i = 0; $i < $lengthpaddingaccount; $i++) {
|
||||
if (preg_match('/0$/', $search_account_tmp)) {
|
||||
$weremovedsomezero++;
|
||||
$search_account_tmp = preg_replace('/0$/', '', $search_account_tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($search_account); exit;
|
||||
if ($search_account_tmp) {
|
||||
if ($weremovedsomezero) {
|
||||
$search_account_tmp_clean = $search_account_tmp;
|
||||
$search_account_clean = $search_account;
|
||||
$startchar = '%';
|
||||
if (strpos($search_account_tmp, '^') === 0)
|
||||
{
|
||||
$startchar = '';
|
||||
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
|
||||
$search_account_clean = preg_replace('/^\^/', '', $search_account);
|
||||
}
|
||||
$sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'";
|
||||
$sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')";
|
||||
}
|
||||
else $sql .= natural_search("aa.account_number", $search_account_tmp);
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
||||
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
|
||||
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
|
||||
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
|
||||
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
||||
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -232,7 +271,8 @@ if ($resql)
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort);
|
||||
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
@ -316,8 +356,13 @@ if ($resql)
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
|
||||
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="' . $search_labelshort . '"></td>';
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
@ -329,8 +374,9 @@ if ($resql)
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
|
||||
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
@ -339,6 +385,7 @@ if ($resql)
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
$totalarray = array();
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
@ -368,6 +415,15 @@ if ($resql)
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account label to show (label short)
|
||||
if (! empty($arrayfields['aa.labelshort']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->labelshort;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account parent
|
||||
if (!empty($arrayfields['aa.account_parent']['checked']))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -97,6 +97,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
$object->account_parent = $account_parent;
|
||||
$object->account_category = GETPOST('account_category', 'alpha');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||
$object->active = 1;
|
||||
|
||||
$res = $object->create($user);
|
||||
@ -162,6 +163,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
$object->account_parent = $account_parent;
|
||||
$object->account_category = GETPOST('account_category', 'alpha');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
@ -236,6 +238,10 @@ if ($action == 'create') {
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
||||
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Label short
|
||||
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
|
||||
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"></td></tr>';
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||
print '<td>';
|
||||
@ -254,7 +260,7 @@ if ($action == 'create') {
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of acounts subtype
|
||||
// Chart of accounts subtype
|
||||
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
|
||||
@ -301,6 +307,10 @@ elseif ($id > 0 || $ref) {
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
||||
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
|
||||
|
||||
// Label short
|
||||
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
|
||||
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"</td></tr>';
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||
print '<td>';
|
||||
@ -354,6 +364,10 @@ elseif ($id > 0 || $ref) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="2">'.$object->label.'</td></tr>';
|
||||
|
||||
// Label to show
|
||||
print '<tr><td class="titlefield">' . $langs->trans("LabelToShow") . '</td>';
|
||||
print '<td colspan="2">' . $object->labelshort . '</td></tr>';
|
||||
|
||||
// Account parent
|
||||
$accp = new AccountingAccount($db);
|
||||
if (!empty($object->account_parent)) {
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Manage the different format accountancy export
|
||||
@ -704,9 +706,9 @@ class AccountancyExport
|
||||
print $end_line;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date_creation = dol_print_date($line->date_creation, '%d%m%Y');
|
||||
$date_doc = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_doc = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_valid = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
print $line->code_journal.$separator;
|
||||
@ -742,10 +744,10 @@ class AccountancyExport
|
||||
print $line->label_operation.$separator;
|
||||
|
||||
// FEC:Debit
|
||||
print price2num($line->debit).$separator;
|
||||
print price2fec($line->debit).$separator;
|
||||
|
||||
// FEC:Credit
|
||||
print price2num($line->credit).$separator;
|
||||
print price2fec($line->credit).$separator;
|
||||
|
||||
// FEC:EcritureLet
|
||||
print $line->lettering_code.$separator;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@ -120,7 +120,12 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @var string Label short of account
|
||||
*/
|
||||
public $labelshort;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_author;
|
||||
@ -162,7 +167,7 @@ class AccountingAccount extends CommonObject
|
||||
global $conf;
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql .= ", ca.label as category_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
|
||||
@ -196,6 +201,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->account_number = $obj->account_number;
|
||||
$this->account_parent = $obj->account_parent;
|
||||
$this->label = $obj->label;
|
||||
$this->labelshort = $obj->labelshort;
|
||||
$this->account_category = $obj->fk_accounting_category;
|
||||
$this->account_category_label = $obj->category_label;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
@ -239,6 +245,8 @@ class AccountingAccount extends CommonObject
|
||||
$this->account_number = trim($this->account_number);
|
||||
if (isset($this->label))
|
||||
$this->label = trim($this->label);
|
||||
if (isset($this->labelshort))
|
||||
$this->labelshort = trim($this->labelshort);
|
||||
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
{
|
||||
@ -261,6 +269,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", account_number";
|
||||
$sql .= ", account_parent";
|
||||
$sql .= ", label";
|
||||
$sql .= ", labelshort";
|
||||
$sql .= ", fk_accounting_category";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", active";
|
||||
@ -273,6 +282,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
|
||||
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
|
||||
$sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'");
|
||||
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||
$sql .= ", " . $user->id;
|
||||
$sql .= ", " . (int) $this->active;
|
||||
@ -344,6 +354,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
|
||||
$sql .= " , account_parent = " . (int) $this->account_parent;
|
||||
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
|
||||
$sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''");
|
||||
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = " . (int) $this->active;
|
||||
@ -461,10 +472,11 @@ class AccountingAccount extends CommonObject
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
{
|
||||
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
@ -482,11 +494,18 @@ class AccountingAccount extends CommonObject
|
||||
$picto = 'billr';
|
||||
$label='';
|
||||
|
||||
if (empty($this->labelshort) || $withcompletelabel == 1)
|
||||
{
|
||||
$labeltoshow = $this->label;
|
||||
} else {
|
||||
$labeltoshow = $this->labelshort;
|
||||
}
|
||||
|
||||
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
|
||||
if (! empty($this->account_number))
|
||||
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
|
||||
if (! empty($this->label))
|
||||
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
|
||||
if (! empty($labeltoshow))
|
||||
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $labeltoshow;
|
||||
if ($moretitle) $label.=' - '.$moretitle;
|
||||
|
||||
$linkclose='';
|
||||
@ -513,7 +532,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
$label_link = length_accountg($this->account_number);
|
||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||
if ($withlabel) $label_link .= ' - ' . $labeltoshow;
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
||||
|
||||
@ -357,25 +357,25 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($this->doc_date)."'";
|
||||
$sql .= ", ".(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||
$sql .= ",'".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= ",'".$this->db->escape($this->doc_ref)."'";
|
||||
$sql .= ",".$this->fk_doc;
|
||||
$sql .= ",".$this->fk_docdet;
|
||||
$sql .= ",'".$this->db->escape($this->thirdparty_code)."'";
|
||||
$sql .= ",'".$this->db->escape($this->subledger_account)."'";
|
||||
$sql .= ",'".$this->db->escape($this->subledger_label)."'";
|
||||
$sql .= ",'".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= ",'".$this->db->escape($this->label_compte)."'";
|
||||
$sql .= ",'".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= ",".$this->debit;
|
||||
$sql .= ",".$this->credit;
|
||||
$sql .= ",".$this->montant;
|
||||
$sql .= ",'".$this->db->escape($this->sens)."'";
|
||||
$sql .= ",'".$this->db->escape($this->fk_user_author)."'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",'".$this->db->escape($this->code_journal)."'";
|
||||
$sql .= ",'".$this->db->escape($this->journal_label)."'";
|
||||
$sql .= ",".$this->db->escape($this->piece_num);
|
||||
$sql .= ", '".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
|
||||
$sql .= ", ".$this->fk_doc;
|
||||
$sql .= ", ".$this->fk_docdet;
|
||||
$sql .= ", ".(!empty($this->thirdparty_code)?("'".$this->db->escape($this->thirdparty_code)."'"):"NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_account)?("'".$this->db->escape($this->subledger_account)."'"):"NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= ", ".$this->debit;
|
||||
$sql .= ", ".$this->credit;
|
||||
$sql .= ", ".$this->montant;
|
||||
$sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", '".$this->db->escape($this->code_journal)."'";
|
||||
$sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL");
|
||||
$sql .= ", ".$this->db->escape($this->piece_num);
|
||||
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
|
||||
$sql .= ")";
|
||||
|
||||
|
||||
@ -1155,9 +1155,9 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accounttoshow;
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
||||
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger
|
||||
{
|
||||
$accounttoshowsubledger = length_accounta($k);
|
||||
@ -1171,7 +1171,12 @@ if (empty($action) || $action == 'view') {
|
||||
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
if (! empty($tabcompany[$key]['code_compta']))
|
||||
{
|
||||
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
|
||||
if (in_array($tabtype[$key], array('payment_various'))) {
|
||||
// For such case, if subledger is not defined, we won't use subledger accounts.
|
||||
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
|
||||
} else {
|
||||
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -142,14 +142,14 @@ $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
@ -174,8 +174,8 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" class="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
print '</td><td class="right">';
|
||||
$listofval = array();
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);
|
||||
|
||||
@ -1747,7 +1747,7 @@ else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, 'member', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -531,7 +531,7 @@ if ($rowid > 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, 'member', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -691,14 +691,14 @@ if ($rowid > 0)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ $subscription = GETPOST("subscription", "int");
|
||||
$duration_value = GETPOST('duration_value', 'int');
|
||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||
$vote = GETPOST("vote", "int");
|
||||
$comment = GETPOST("comment", 'alphanohtml');
|
||||
$comment = GETPOST("comment", 'none');
|
||||
$mail_valid = GETPOST("mail_valid", 'none');
|
||||
|
||||
// Security check
|
||||
@ -342,11 +342,12 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Morphy
|
||||
$morphys = array();
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
|
||||
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
@ -354,16 +355,18 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote", 0, 1);
|
||||
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
|
||||
print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -806,10 +809,12 @@ if ($rowid > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
@ -235,7 +235,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc/");
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -257,7 +257,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info'))
|
||||
print $module->info($langs);
|
||||
|
||||
@ -350,7 +350,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
||||
$realpath = $reldir."core/modules/bom".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -382,7 +383,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
@ -425,7 +425,9 @@ 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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
@ -403,7 +403,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
|
||||
$realpath = $reldir."core/modules/commande".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -472,19 +473,21 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -181,6 +181,13 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FACEBOOK_URL", GETPOST("facebookurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TWITTER_URL", GETPOST("twitterurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LINKEDIN_URL", GETPOST("linkedinurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_INSTAGRAM_URL", GETPOST("instagramurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_YOUTUBE_URL", GETPOST("youtubeurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GITHUB_URL", GETPOST("githuburl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
@ -407,32 +414,26 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
|
||||
// Addresse
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')) . '</textarea></td></tr>'."\n";
|
||||
|
||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')) . '"></td></tr>'."\n";
|
||||
|
||||
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')) . '"></td></tr>'."\n";
|
||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n";
|
||||
|
||||
// Country
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
||||
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
|
||||
print $form->select_country($mysoc->country_id, 'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
$state_id = 0;
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
||||
@ -443,22 +444,22 @@ if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
||||
$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
// Currency
|
||||
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
|
||||
print $form->selectCurrency($conf->currency, "currency");
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
// Phone
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
// Fax
|
||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
// Email
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
@ -516,6 +517,45 @@ print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Social networks
|
||||
print '<br>';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Facebook
|
||||
print '<tr class="oddeven"><td><label for="facebookurl">'.$langs->trans("SocialNetworksFacebookURL").'</label></td><td>';
|
||||
print '<input name="facebookurl" id="facebookurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FACEBOOK_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Twitter
|
||||
print '<tr class="oddeven"><td><label for="twitterurl">'.$langs->trans("SocialNetworksTwitterURL").'</label></td><td>';
|
||||
print '<input name="twitterurl" id="twitterurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TWITTER_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// LinkedIn
|
||||
print '<tr class="oddeven"><td><label for="linkedinurl">'.$langs->trans("SocialNetworksLinkedinURL").'</label></td><td>';
|
||||
print '<input name="linkedinurl" id="linkedinurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_LINKEDIN_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Instagram
|
||||
print '<tr class="oddeven"><td><label for="instagramurl">'.$langs->trans("SocialNetworksInstagramURL").'</label></td><td>';
|
||||
print '<input name="instagramurl" id="instagramurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Youtube
|
||||
print '<tr class="oddeven"><td><label for="youtubeurl">'.$langs->trans("SocialNetworksYoutubeURL").'</label></td><td>';
|
||||
print '<input name="youtubeurl" id="youtubeurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Github
|
||||
print '<tr class="oddeven"><td><label for="githuburl">'.$langs->trans("SocialNetworksGithubURL").'</label></td><td>';
|
||||
print '<input name="githuburl" id="githuburl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GITHUB_URL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
// IDs of the company (country-specific)
|
||||
@ -525,24 +565,20 @@ print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyId
|
||||
$langs->load("companies");
|
||||
|
||||
// Managing Director(s)
|
||||
|
||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
||||
|
||||
// GDPR contact
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
||||
print '</td><td>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
||||
|
||||
// Capital
|
||||
|
||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
print '<input name="capital" id="capital" class="minwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
|
||||
|
||||
// Juridical Status
|
||||
|
||||
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
||||
if ($mysoc->country_code) {
|
||||
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
|
||||
@ -551,7 +587,7 @@ if ($mysoc->country_code) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfID1
|
||||
// ProfId1
|
||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
||||
@ -641,14 +677,12 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TVA Intra
|
||||
|
||||
// Intra-community VAT number
|
||||
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Object of the company
|
||||
|
||||
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -339,7 +339,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/contract".$valdir);
|
||||
$realpath = $reldir."core/modules/contract".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -407,18 +408,20 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$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("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -1308,7 +1308,6 @@ if ($id)
|
||||
// Determines the name of the field in relation to the possible names
|
||||
// in data dictionaries
|
||||
$showfield = 1; // By defaut
|
||||
$align = "left";
|
||||
$cssprefix = '';
|
||||
$sortable = 1;
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
@ -1320,23 +1319,23 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow = $langs->trans("Rate");
|
||||
else $valuetoshow = $langs->trans("Amount");
|
||||
$align = 'center';
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'organization') { $valuetoshow = $langs->trans("Organization"); }
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'position') { $align = 'right'; }
|
||||
if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; }
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); }
|
||||
if ($fieldlist[$field] == 'libelle_facture') { $valuetoshow = $langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field] == 'country') { $valuetoshow = $langs->trans("Country"); }
|
||||
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $align = "center"; }
|
||||
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $cssprefix = "center "; }
|
||||
if ($fieldlist[$field] == 'nbjour') { $valuetoshow = $langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $align = "center"; }
|
||||
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center "; }
|
||||
if ($fieldlist[$field] == 'decalage') { $valuetoshow = $langs->trans("Offset"); }
|
||||
if ($fieldlist[$field] == 'width' || $fieldlist[$field] == 'nx') { $valuetoshow = $langs->trans("Width"); }
|
||||
if ($fieldlist[$field] == 'height' || $fieldlist[$field] == 'ny') { $valuetoshow = $langs->trans("Height"); }
|
||||
@ -1378,7 +1377,7 @@ if ($id)
|
||||
// Show field title
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
@ -1434,8 +1433,8 @@ if ($id)
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
//var_dump($fieldlist);
|
||||
$class = '';
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
|
||||
if ($fieldlist[$field] == 'entity') {
|
||||
@ -1467,13 +1466,13 @@ if ($id)
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type_cdr') {
|
||||
if (empty($valuetoshow)) $valuetoshow = $langs->trans('None');
|
||||
elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
|
||||
elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
} elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
|
||||
$valuetoshow = price($valuetoshow);
|
||||
}
|
||||
@ -1587,20 +1586,20 @@ if ($id)
|
||||
$valuetoshow = $localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'localtax2_type') {
|
||||
if ($obj->localtax2 != 0)
|
||||
$valuetoshow = $localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'taux') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
} elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
@ -1632,14 +1631,14 @@ if ($id)
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
$class = 'tddict';
|
||||
$class .= ($class ? ' ' : '').'tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
|
||||
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
|
||||
if ($fieldlist[$field] == 'position') $class .= ' right';
|
||||
if ($fieldlist[$field] == 'localtax1_type') $class .= ' nowrap';
|
||||
if ($fieldlist[$field] == 'localtax2_type') $class .= ' nowrap';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1918,9 +1917,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
|
||||
$align = "left";
|
||||
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $align = "center"; // Fields aligned on right
|
||||
print '<td class="'.$align.'">';
|
||||
$class = "left";
|
||||
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $class = "center"; // Fields aligned on right
|
||||
print '<td class="'.$class.'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -595,13 +595,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
|
||||
print '<td>';
|
||||
print '<!-- type of action: '.$ruleaction['type'].' -->';
|
||||
print $langs->trans($arrayoftypes[$ruleaction['type']]);
|
||||
if (in_array($ruleaction['type'], array('recordevent')))
|
||||
{
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
|
||||
}
|
||||
elseif (in_array($ruleaction['type'], array('loadthirdparty', 'loadandcreatethirdparty'))) {
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp'));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="wordbreak">';
|
||||
if ($action == 'editoperation' && $ruleaction['id'] == $operationid)
|
||||
{
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
|
||||
|
||||
@ -486,7 +486,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/facture".$valdir);
|
||||
$realpath = $reldir."core/modules/facture".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -555,19 +556,21 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$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("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -409,7 +409,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
|
||||
$realpath = $reldir."core/modules/fichinter/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -480,6 +481,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -355,7 +355,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
||||
$realpath = $reldir."core/modules/holiday".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -429,7 +430,9 @@ 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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -377,6 +377,7 @@ print '</table>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LoginPage").'</td><td></td>';
|
||||
print '<td width="20"> </td>';
|
||||
@ -427,7 +428,7 @@ print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
|
||||
@ -467,24 +467,6 @@ if ($action == 'edit')
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
/*
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);*/
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
|
||||
@ -655,7 +637,8 @@ else
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql.= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -38,14 +38,14 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
@ -69,13 +69,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
// Protection if external user
|
||||
// Security check
|
||||
$socid = 0;
|
||||
if ($user->socid > 0)
|
||||
if ($user->socid > 0) // Protection if external user
|
||||
{
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'mymodule', $id, '');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||
@ -97,7 +98,7 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']);
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
@ -161,8 +162,6 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass = 'EmailSenderProfile';
|
||||
$objectlabel = 'EmailSenderProfile';
|
||||
$permissiontoread = $user->admin;
|
||||
$permissiontodelete = $user->admin;
|
||||
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -185,8 +184,6 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$limit = (GETPOSTISSET('limit') ? $limit : 0);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
@ -196,7 +193,7 @@ $help_url = '';
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $title);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
@ -234,6 +231,10 @@ foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') $search[$key] = '';
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
@ -254,6 +255,7 @@ foreach($object->fields as $key => $val)
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -375,9 +377,12 @@ if ($action != 'create') {
|
||||
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : -1), 'private', 1, null, 0, ($user->admin ? '' : $user->id));
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $form->selectyesno('active', GETPOST('active', 'int'), 1);
|
||||
print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], GETPOST('active', 'int'), 0);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@ -443,7 +448,10 @@ foreach ($object->fields as $key => $val)
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
}
|
||||
elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -509,11 +517,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
||||
}
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
@ -532,21 +536,20 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
else print $object->showOutputField($val, $key, $object->$key, '');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
{
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
@ -562,8 +565,8 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
@ -180,11 +180,11 @@ if ($action == 'install')
|
||||
$modulename = preg_replace('/module_/', '', $original_file);
|
||||
$modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
|
||||
// Search dir $modulename
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule
|
||||
//var_dump($modulenamedir);
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
|
||||
|
||||
if (!dol_is_dir($modulenamedir))
|
||||
{
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (!dol_is_dir($modulenamedir))
|
||||
{
|
||||
@ -207,6 +207,7 @@ if ($action == 'install')
|
||||
$modulenamearrays = explode("\n", $metafile);
|
||||
}
|
||||
$modulenamearrays[$modulename] = $modulename;
|
||||
//var_dump($modulenamearrays);exit;
|
||||
|
||||
foreach ($modulenamearrays as $modulenameval) {
|
||||
if (strpos($modulenameval, '#') === 0) continue; // Discard comments
|
||||
@ -216,15 +217,14 @@ if ($action == 'install')
|
||||
// Now we install the module
|
||||
if (!$error)
|
||||
{
|
||||
//var_dump($dirins);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
|
||||
dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
|
||||
$result = dolCopyDir($conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
$result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -825,10 +825,13 @@ if ($mode == 'common')
|
||||
$warningmessage = '';
|
||||
if (!empty($arrayofwarnings[$modName]))
|
||||
{
|
||||
print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
print '<!-- This module is a core module and it may have a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage)
|
||||
{
|
||||
$warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
|
||||
if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry)))
|
||||
{
|
||||
$warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext))
|
||||
|
||||
@ -351,7 +351,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
|
||||
$realpath = $reldir."core/modules/mrp".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -383,7 +384,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
@ -421,14 +421,16 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -271,7 +271,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||
$dir = dol_buildpath($reldir."core/modules/propale");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -399,7 +399,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/propale".$valdir);
|
||||
$realpath = $reldir."core/modules/propale".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -474,7 +475,9 @@ 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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -221,7 +221,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception/");
|
||||
$dir = dol_buildpath($reldir."core/modules/reception");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -353,7 +353,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception".$valdir);
|
||||
$realpath = $reldir."core/modules/reception".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -427,7 +428,9 @@ 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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -461,6 +461,7 @@ print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
@ -471,7 +472,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Example with a yes / no select
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -481,10 +482,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -494,7 +495,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
@ -507,8 +508,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
*/
|
||||
|
||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||
|
||||
@ -90,7 +90,7 @@ if ($action == 'specimen') // For invoices
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -230,7 +230,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -360,7 +360,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
|
||||
$realpath = $reldir."core/modules/supplier_invoice/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -385,7 +386,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -434,6 +435,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -86,7 +86,7 @@ elseif ($action == 'specimen') // For orders
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -388,7 +388,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
|
||||
$realpath = $reldir."core/modules/supplier_order/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -411,7 +412,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -456,6 +457,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -332,7 +332,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
|
||||
$realpath = $reldir."core/modules/supplier_payment/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -356,7 +357,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -405,6 +406,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td class="center">';
|
||||
|
||||
@ -239,7 +239,7 @@ print '</tr>'."\n";
|
||||
clearstatcache();
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -366,7 +366,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal".$valdir);
|
||||
$realpath = $reldir."core/modules/supplier_proposal".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -440,7 +441,9 @@ 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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -75,7 +75,7 @@ print '<br>';
|
||||
$file_list = array('missing' => array(), 'updated' => array());
|
||||
|
||||
// Local file to compare to
|
||||
$xmlshortfile = GETPOST('xmlshortfile', 'alpha') ?GETPOST('xmlshortfile', 'alpha') : '/install/filelist-'.DOL_VERSION.(empty($conf->global->MAIN_FILECHECK_LOCAL_SUFFIX) ? '' : $conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml';
|
||||
$xmlshortfile = GETPOST('xmlshortfile', 'alpha') ?GETPOST('xmlshortfile', 'alpha') : '/install/filelist-'.DOL_VERSION.(empty($conf->global->MAIN_FILECHECK_LOCAL_SUFFIX) ? '' : $conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml'.(empty($conf->global->MAIN_FILECHECK_LOCAL_EXT) ? '' : $conf->global->MAIN_FILECHECK_LOCAL_EXT);
|
||||
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
|
||||
// Remote file to compare to
|
||||
$xmlremote = GETPOST('xmlremote');
|
||||
@ -127,6 +127,18 @@ if (GETPOST('target') == 'local')
|
||||
{
|
||||
if (dol_is_file($xmlfile))
|
||||
{
|
||||
// If file is a zip file (.../filelist-x.y.z.xml.zip), we uncompress it before
|
||||
if (preg_match('/\.zip$/i', $xmlfile)) {
|
||||
dol_mkdir($conf->admin->dir_temp);
|
||||
$xmlfilenew = preg_replace('/\.zip$/i', '', $xmlfile);
|
||||
$result = dol_uncompress($xmlfile, $conf->admin->dir_temp);
|
||||
if (empty($result['error'])) {
|
||||
$xmlfile = $conf->admin->dir_temp.'/'.basename($xmlfilenew);
|
||||
} else {
|
||||
print $langs->trans('FailedToUncompressFile').': '.$xmlfile;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
$xml = simplexml_load_file($xmlfile);
|
||||
}
|
||||
else
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
$langs->load("errors");
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
@ -66,21 +68,123 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
$ErrorPicturePath = "../../theme/eldy/img/error.png";
|
||||
$WarningPicturePath = "../../theme/eldy/img/warning.png";
|
||||
$OkayPicturePath = "../../theme/eldy/img/tick.png";
|
||||
|
||||
// Get PHP version
|
||||
$phpversion=version_php();
|
||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
|
||||
|
||||
$arrayphpminversionerror = array(5,5,0);
|
||||
$arrayphpminversionwarning = array(5,5,0);
|
||||
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0)
|
||||
{
|
||||
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
|
||||
}
|
||||
elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.versiontostring(versionphparray());
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>GET and POST support</td><td>';
|
||||
|
||||
if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]) && ! isset($_GET["mainmenu"]))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
|
||||
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Sessions support</td><td>';
|
||||
|
||||
if (! function_exists("session_id"))
|
||||
{
|
||||
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>GD support</td><td>';
|
||||
|
||||
if (! function_exists("imagecreate"))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportGD");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportGD");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Curl support</td><td>';
|
||||
|
||||
if (! function_exists("curl_init"))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportCurl");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportCurl");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>UTF-8 support</td><td>';
|
||||
|
||||
if (! function_exists("utf8_encode"))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Intl support</td><td>';
|
||||
|
||||
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
|
||||
{
|
||||
if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region"))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportIntl");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportIntl");
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr><td>Zip support</td><td>';
|
||||
|
||||
if (!class_exists('ZipArchive'))
|
||||
{
|
||||
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "Zip");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "Zip");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Get php_info array
|
||||
$phparray=phpinfo_array();
|
||||
foreach($phparray as $key => $value)
|
||||
|
||||
@ -209,7 +209,7 @@ print "</tr>\n";
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket/");
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket");
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
|
||||
$file = $reg[1];
|
||||
$classname = substr($file, 4);
|
||||
|
||||
include_once $dir.$file.'.php';
|
||||
include_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
||||
@ -29,18 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="date";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "date";
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
@ -52,38 +52,38 @@ if ($action == 'delete')
|
||||
{
|
||||
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$label=$db::LABEL;
|
||||
$type=$db->type;
|
||||
$label = $db::LABEL;
|
||||
$type = $db->type;
|
||||
//var_dump($db);
|
||||
|
||||
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
$help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
llxHeader('', '', $help_url);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
function hideoptions () {
|
||||
jQuery("#mysql_options").hide();
|
||||
@ -141,9 +141,9 @@ print '<br>';
|
||||
|
||||
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard"));
|
||||
|
||||
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').' nohover">';
|
||||
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
@ -186,11 +186,11 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump=$db->getPathOfDump();
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
@ -203,7 +203,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
@ -242,7 +242,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="drop"'.((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="drop"'.(((!isset($_GET["drop"]) && !isset($_POST["drop"])) || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
@ -293,7 +293,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
|
||||
print '</div>';
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((!isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"])) || GETPOST('nobin_drop')) ? ' checked' : ''.' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
@ -338,11 +338,11 @@ if (in_array($type, array('pgsql'))) {
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump=$db->getPathOfDump();
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
@ -391,33 +391,28 @@ print '<legend>'.$langs->trans("Destination").'</legend> -->';
|
||||
print '<br>';
|
||||
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||
print '<br>';
|
||||
$prefix='dump';
|
||||
$ext='.sql';
|
||||
$prefix = 'dump';
|
||||
$ext = '.sql';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$prefix='mysqldump';
|
||||
$ext='sql';
|
||||
$prefix = 'mysqldump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
//if ($label == 'PostgreSQL') {
|
||||
// $prefix='pg_dump';
|
||||
// $ext='dump';
|
||||
//}
|
||||
if (in_array($type, array('pgsql'))) {
|
||||
$prefix='pg_dump';
|
||||
$ext='sql';
|
||||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Define compressions array
|
||||
$compression=array();
|
||||
$compression = array();
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['gz'] = array(
|
||||
'function' => 'gzopen',
|
||||
'id' => 'radio_compression_gzip',
|
||||
@ -434,13 +429,18 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("Default")
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['gz'] = array(
|
||||
'function' => 'gzopen',
|
||||
@ -455,11 +455,14 @@ print "\n";
|
||||
|
||||
print $langs->trans("Compression").': ';
|
||||
|
||||
$i = 0;
|
||||
foreach($compression as $key => $val)
|
||||
{
|
||||
if (! $val['function'] || function_exists($val['function'])) {
|
||||
// Enabled export format
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
}
|
||||
else
|
||||
@ -467,9 +470,10 @@ foreach($compression as $key => $val)
|
||||
// Disabled export format
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -484,7 +488,7 @@ print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">'
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||
{
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
@ -496,11 +500,11 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
if (! empty($_SESSION["commandbackuptorun"]))
|
||||
if (!empty($_SESSION["commandbackuptorun"]))
|
||||
{
|
||||
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
|
||||
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
|
||||
@ -509,9 +513,9 @@ if (! empty($_SESSION["commandbackuptorun"]))
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
|
||||
print "</div> <!-- end div center button -->\n";
|
||||
@ -525,8 +529,8 @@ print "</div> <!-- end div fichehalfleft -->\n";
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
@ -534,12 +538,15 @@ print '</div>';
|
||||
print '</form>';
|
||||
print '</fieldset>';
|
||||
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print "<!-- Dump of a server -->\n";
|
||||
|
||||
print '<form method="post" action="export_files.php" name="dump">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="export_type" value="server" />';
|
||||
print '<input type="hidden" name="page_y" value="" />';
|
||||
|
||||
print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
|
||||
|
||||
@ -548,39 +555,44 @@ print $langs->trans("BackupDescX").'<br><br>';
|
||||
|
||||
print '<div id="backupfilesleft" class="fichehalfleft">';
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupZipWizard"));
|
||||
|
||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
$prefix='documents';
|
||||
$ext='zip';
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Show compression choices
|
||||
// Example: With gz choice, you can compress in 5mn, a file of 2GB directory (after compression) with 10 Mb memory.
|
||||
print '<div class="formelementrow">';
|
||||
print "\n";
|
||||
|
||||
print $langs->trans("Compression").': ';
|
||||
$filecompression = $compression;
|
||||
array_shift($filecompression);
|
||||
unset($filecompression['none']);
|
||||
$filecompression['zip']= array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip"));
|
||||
|
||||
$i = 0;
|
||||
foreach($filecompression as $key => $val)
|
||||
{
|
||||
if (! $val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
}
|
||||
else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -598,7 +610,7 @@ print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px;
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/tools/export.php
|
||||
* \brief Page to export a database into a dump file
|
||||
* \file htdocs/admin/tools/export_files.php
|
||||
* \brief Page to export documents into a compressed file
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -33,10 +33,11 @@ $langs->load("admin");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$what=GETPOST('what', 'alpha');
|
||||
$export_type=GETPOST('export_type', 'alpha');
|
||||
$file=GETPOST('zipfilename_template', 'alpha');
|
||||
$file=trim(GETPOST('zipfilename_template', 'alpha'));
|
||||
$compression = GETPOST('compression');
|
||||
|
||||
$file = dol_sanitizeFileName($file);
|
||||
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
@ -73,7 +74,7 @@ if ($action == 'delete')
|
||||
*/
|
||||
|
||||
// Increase limit of time. Works only if we are not in safe mode
|
||||
$ExecTimeLimit=600;
|
||||
$ExecTimeLimit=1800; // 30mn
|
||||
if (!empty($ExecTimeLimit))
|
||||
{
|
||||
$err=error_reporting();
|
||||
@ -88,7 +89,7 @@ if (!empty($MemoryLimit))
|
||||
@ini_set('memory_limit', $MemoryLimit);
|
||||
}
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
@ -112,10 +113,18 @@ $utils = new Utils($db);
|
||||
|
||||
if ($compression == 'zip')
|
||||
{
|
||||
$file .= '.zip';
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
|
||||
if ($ret < 0)
|
||||
{
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
|
||||
if ($ret == -2) {
|
||||
$langs->load("errors");
|
||||
$errormsg = $langs->trans("ErrNoZipEngine");
|
||||
}
|
||||
else {
|
||||
$langs->load("errors");
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (in_array($compression, array('gz', 'bz')))
|
||||
@ -124,7 +133,6 @@ elseif (in_array($compression, array('gz', 'bz')))
|
||||
|
||||
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
||||
|
||||
$file = substr($file, 0, strrpos($file, '.'));
|
||||
$file .= '.tar';
|
||||
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
||||
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
|
||||
|
||||
@ -205,9 +205,9 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_code) $param.='&search_code='.urlencode($search_code);
|
||||
if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
|
||||
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||
@ -332,13 +332,14 @@ if ($result)
|
||||
// Description
|
||||
print '<td>';
|
||||
$text=$langs->trans($obj->description);
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg))
|
||||
{
|
||||
$val=explode(',', $reg[1]);
|
||||
$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
|
||||
if (! empty($reg[2])) $text.=$reg[2];
|
||||
}
|
||||
print $text;
|
||||
print dol_escape_htmltag($text);
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
@ -359,8 +360,8 @@ if ($result)
|
||||
|
||||
// More informations
|
||||
print '<td class="right">';
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent?$obj->user_agent:$langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session?$obj->prefix_session:$langs->trans("Unknown"));
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -297,10 +297,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -34,7 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "members", "users"));
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -244,10 +243,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -202,6 +202,7 @@ print '<br>';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -264,7 +264,7 @@ $form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("BarCodePrintsheet"));
|
||||
|
||||
print load_fiche_titre($langs->trans("BarCodePrintsheet"));
|
||||
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'<br>';
|
||||
|
||||
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file bom/admin/setup.php
|
||||
* \ingroup bom
|
||||
* \brief Bom setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once '../lib/bom.lib.php';
|
||||
//require_once "../class/myclass.class.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "mrp"));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$arrayofparameters = array(
|
||||
'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "BomSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom');
|
||||
|
||||
// Configuration header
|
||||
$head = bomAdminPrepareHead();
|
||||
dol_fiche_head($head, 'settings', '', -1, "bom");
|
||||
|
||||
// Setup page goes here
|
||||
echo $langs->trans("BomSetupPage").'<br><br>';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($arrayofparameters))
|
||||
{
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
print '</td><td>'.$conf->global->$key.'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Page end
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -97,11 +97,13 @@ if (empty($reshook))
|
||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||
|
||||
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||
//var_dump($backurlforlist);exit;
|
||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
|
||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||
}
|
||||
}
|
||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
// Actions cancel, add, update, delete or clone
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
@ -169,7 +171,9 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
}
|
||||
}
|
||||
@ -207,7 +211,9 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['idprod']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
}
|
||||
}
|
||||
@ -506,7 +512,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = 'description';
|
||||
$keyforbreak = 'efficiency';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
@ -622,7 +628,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
|
||||
$langs->load("errors");
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -644,7 +651,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +71,7 @@ if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default sea
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
// Security check
|
||||
if (empty($conf->bom->enabled)) accessforbidden('Module not enabled');
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) // Protection if external user
|
||||
{
|
||||
@ -106,8 +107,14 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
@ -298,8 +305,8 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/, $/', '', $sql);
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
@ -308,6 +315,10 @@ foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') $search[$key] = '';
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
@ -332,7 +343,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -350,13 +361,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
@ -369,7 +380,7 @@ else
|
||||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
@ -418,7 +429,7 @@ $arrayofmassactions = array(
|
||||
'enable'=>$langs->trans("Enable"),
|
||||
'disable'=>$langs->trans("Disable"),
|
||||
);
|
||||
if ($user->rights->bom->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -488,7 +499,10 @@ foreach ($object->fields as $key => $val)
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
}
|
||||
elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -548,17 +562,13 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
||||
}
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
@ -577,21 +587,20 @@ while ($i < min($num, $limit))
|
||||
{
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
else print $object->showOutputField($val, $key, $object->$key, '');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
{
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
@ -599,13 +608,13 @@ while ($i < min($num, $limit))
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -648,8 +657,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
|
||||
$urlsource .= str_replace('&', '&', $param);
|
||||
|
||||
$filedir = $diroutputmassaction;
|
||||
$genallowed = $user->rights->bom->read;
|
||||
$delallowed = $user->rights->bom->create;
|
||||
$genallowed = $permissiontoread;
|
||||
$delallowed = $permissiontoadd;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_bom', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
}
|
||||
|
||||
@ -63,10 +63,11 @@ class BOM extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
@ -745,6 +746,9 @@ class BOM extends CommonObject
|
||||
$label = '<u>'.$langs->trans("BillOfMaterials").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->status)) {
|
||||
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
|
||||
|
||||
|
||||
@ -48,9 +48,9 @@ $langs->loadLangs(array("main","bills"));
|
||||
|
||||
</script>
|
||||
|
||||
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo $_GET['facid']; ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
|
||||
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo GETPOST('facid', 'int'); ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
|
||||
<br>
|
||||
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
|
||||
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>'); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -48,6 +48,11 @@ class Categories extends DolibarrApi
|
||||
3 => 'member',
|
||||
4 => 'contact',
|
||||
5 => 'account',
|
||||
//6 => 'project',
|
||||
//7 => 'user',
|
||||
//8 => 'bank_line',
|
||||
//9 => 'warehouse',
|
||||
//10 => 'actioncomm',
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@ -54,6 +54,7 @@ class Categorie extends CommonObject
|
||||
const TYPE_ACCOUNT = 'bank_account';
|
||||
const TYPE_BANK_LINE = 'bank_line';
|
||||
const TYPE_WAREHOUSE = 'warehouse';
|
||||
const TYPE_ACTIONCOMM = 'actioncomm';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
@ -77,6 +78,7 @@ class Categorie extends CommonObject
|
||||
'user' => 7,
|
||||
'bank_line' => 8,
|
||||
'warehouse' => 9,
|
||||
'actioncomm' => 10,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -93,6 +95,7 @@ class Categorie extends CommonObject
|
||||
7 => 'user',
|
||||
8 => 'bank_line',
|
||||
9 => 'warehouse',
|
||||
10 => 'actioncomm',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -111,6 +114,7 @@ class Categorie extends CommonObject
|
||||
'bank_account' => 'account',
|
||||
'project' => 'project',
|
||||
'warehouse'=> 'warehouse',
|
||||
'actioncomm' => 'actioncomm',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -129,6 +133,7 @@ class Categorie extends CommonObject
|
||||
'bank_account'=> 'account',
|
||||
'project' => 'project',
|
||||
'warehouse'=> 'warehouse',
|
||||
'actioncomm' => 'actioncomm',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -147,6 +152,7 @@ class Categorie extends CommonObject
|
||||
'bank_account' => 'Account',
|
||||
'project' => 'Project',
|
||||
'warehouse'=> 'Entrepot',
|
||||
'actioncomm' => 'ActionComm',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -164,6 +170,7 @@ class Categorie extends CommonObject
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
'warehouse'=> 'entrepot',
|
||||
'actioncomm' => 'actioncomm',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -214,6 +221,7 @@ class Categorie extends CommonObject
|
||||
* @see Categorie::TYPE_PROJECT
|
||||
* @see Categorie::TYPE_BANK_LINE
|
||||
* @see Categorie::TYPE_WAREHOUSE
|
||||
* @see Categorie::TYPE_ACTIONCOMM
|
||||
*/
|
||||
public $type;
|
||||
|
||||
|
||||
@ -59,7 +59,13 @@ elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCate
|
||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; }
|
||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||
elseif ($type == Categorie::TYPE_ACTIONCOMM) {
|
||||
$title = $langs->trans("ActionCommCategoriesArea");
|
||||
$typetext = 'actioncomm';
|
||||
} else {
|
||||
$title = $langs->trans("CategoriesArea");
|
||||
$typetext = 'unknown';
|
||||
}
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
|
||||
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda"));
|
||||
@ -374,6 +375,10 @@ if (empty($reshook) && $action == 'add')
|
||||
{
|
||||
if (!$object->error)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
unset($_SESSION['assignedtouser']);
|
||||
|
||||
$moreparam = '';
|
||||
@ -595,6 +600,10 @@ if (empty($reshook) && $action == 'update')
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
unset($_SESSION['assignedtouser']);
|
||||
|
||||
$db->commit();
|
||||
@ -1000,6 +1009,14 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -1411,6 +1428,19 @@ if ($id > 0)
|
||||
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM);
|
||||
$arrayselected = array();
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1461,6 +1491,7 @@ if ($id > 0)
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td>';
|
||||
print '<input type="text" name="priority" value="'.($object->priority ? $object->priority : '').'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Object linked
|
||||
if (!empty($object->fk_element) && !empty($object->elementtype))
|
||||
{
|
||||
@ -1716,6 +1747,12 @@ if ($id > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -514,9 +514,10 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
|
||||
|
||||
// Now insert assignedusers
|
||||
// Now insert assigned users
|
||||
if (!$error)
|
||||
{
|
||||
//dol_syslog(var_export($this->userassigned, true));
|
||||
foreach ($this->userassigned as $key => $val)
|
||||
{
|
||||
if (!is_array($val)) // For backward compatibility when val=id
|
||||
@ -524,16 +525,20 @@ class ActionComm extends CommonObject
|
||||
$val = array('id'=>$val);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
||||
if ($val['id'] > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
//var_dump($sql);exit;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR);
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
//var_dump($sql);exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,7 +546,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
if (!empty($this->socpeopleassigned))
|
||||
{
|
||||
foreach ($this->socpeopleassigned as $id => $Tab)
|
||||
foreach ($this->socpeopleassigned as $id => $val)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
||||
@ -550,6 +555,7 @@ class ActionComm extends CommonObject
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR);
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
@ -558,8 +564,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$action = 'create';
|
||||
|
||||
// Actions on extra fields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
@ -787,16 +791,16 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public function fetchResources()
|
||||
{
|
||||
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
|
||||
$this->userassigned = array();
|
||||
$this->socpeopleassigned = array();
|
||||
|
||||
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
|
||||
$sql .= ' WHERE fk_actioncomm = '.$this->id;
|
||||
$sql .= " AND element_type IN ('user', 'socpeople')";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->userassigned = array();
|
||||
$this->socpeopleassigned = array();
|
||||
|
||||
// If owner is known, we must but id first into list
|
||||
if ($this->userownerid > 0) $this->userassigned[$this->userownerid] = array('id'=>$this->userownerid); // Set first so will be first into list.
|
||||
|
||||
@ -1374,13 +1378,13 @@ class ActionComm extends CommonObject
|
||||
* Return URL of event
|
||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
||||
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
|
||||
* @param string $classname Force style class on a link
|
||||
* @param string $option ''=Link to action, 'birthday'=Link to contact
|
||||
* @param int $overwritepicto 1=Overwrite picto
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
|
||||
* @param int $overwritepicto 1 = Overwrite picto
|
||||
* @param int $notooltip 1 = Disable tooltip
|
||||
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||
@ -1389,7 +1393,11 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
$canread = 0;
|
||||
if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event
|
||||
if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned
|
||||
if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other
|
||||
if (! $canread)
|
||||
{
|
||||
$option = 'nolink';
|
||||
}
|
||||
@ -1447,6 +1455,8 @@ class ActionComm extends CommonObject
|
||||
$url = '';
|
||||
if ($option == 'birthday')
|
||||
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
|
||||
elseif ($option == 'holiday')
|
||||
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
|
||||
else
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
|
||||
if ($option !== 'nolink')
|
||||
@ -1506,6 +1516,50 @@ class ActionComm extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets object to supplied categories.
|
||||
*
|
||||
* Deletes object from existing categories not supplied.
|
||||
* Adds it to non existing supplied categories.
|
||||
* Existing categories are left untouch.
|
||||
*
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return void
|
||||
*/
|
||||
public function setCategories($categories)
|
||||
{
|
||||
// Handle single category
|
||||
if (! is_array($categories)) {
|
||||
$categories = array($categories);
|
||||
}
|
||||
|
||||
// Get current categories
|
||||
include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
$existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id');
|
||||
|
||||
// Diff
|
||||
if (is_array($existing)) {
|
||||
$to_del = array_diff($existing, $categories);
|
||||
$to_add = array_diff($categories, $existing);
|
||||
} else {
|
||||
$to_del = array(); // Nothing to delete
|
||||
$to_add = $categories;
|
||||
}
|
||||
|
||||
// Process
|
||||
foreach($to_del as $del) {
|
||||
if ($c->fetch($del) > 0) {
|
||||
$c->del_type($this, Categorie::TYPE_ACTIONCOMM);
|
||||
}
|
||||
}
|
||||
foreach ($to_add as $add) {
|
||||
if ($c->fetch($add) > 0) {
|
||||
$c->add_type($this, Categorie::TYPE_ACTIONCOMM);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
|
||||
@ -757,6 +757,95 @@ if ($showbirthday)
|
||||
}
|
||||
}
|
||||
|
||||
if($conf->global->AGENDA_SHOW_HOLIDAYS)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = x.fk_user";
|
||||
$sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
if($action == 'show_day')
|
||||
{
|
||||
// Request only leaves for the current selected day
|
||||
$sql.= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin";
|
||||
}
|
||||
elseif($action == 'show_week')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
elseif($action == 'show_month')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$dateStartArray = dol_getdate(dol_stringtotime($obj->date_start, 1), true);
|
||||
$dateEndArray = dol_getdate(dol_stringtotime($obj->date_end, 1), true);
|
||||
|
||||
$event = new ActionComm($db);
|
||||
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true);
|
||||
$event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true);
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
if($obj->status == 3)
|
||||
{
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
}
|
||||
elseif($obj->status == 2)
|
||||
{
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
}
|
||||
|
||||
if($obj->halfday == 1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
}
|
||||
elseif($obj->halfday == -1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$annee = date('Y', $event->date_start_in_calendar);
|
||||
$mois = date('m', $event->date_start_in_calendar);
|
||||
$jour = date('d', $event->date_start_in_calendar);
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||
|
||||
do
|
||||
{
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60*60*24;
|
||||
}
|
||||
|
||||
while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete $eventarray with external import Ical
|
||||
if (count($listofextcals))
|
||||
{
|
||||
@ -1512,7 +1601,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
{
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
|
||||
}
|
||||
if ($event->type_code != 'BIRTHDAY')
|
||||
elseif ($event->type_code == 'HOLIDAY')
|
||||
{
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user');
|
||||
}
|
||||
elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY')
|
||||
{
|
||||
// Picto
|
||||
if (empty($event->fulldayevent))
|
||||
@ -1568,13 +1661,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$titletoshow = $daterange;
|
||||
$titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle);
|
||||
|
||||
if ($event->type_code == 'ICALEVENT') print $titletoshow;
|
||||
else
|
||||
{
|
||||
if ($event->type_code != 'ICALEVENT') {
|
||||
$savlabel = $event->label ? $event->label : $event->libelle;
|
||||
$event->label = $titletoshow;
|
||||
$event->libelle = $titletoshow;
|
||||
print $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
|
||||
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
|
||||
$titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
|
||||
$event->label = $savlabel;
|
||||
$event->libelle = $savlabel;
|
||||
}
|
||||
@ -1595,6 +1687,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
|
||||
}
|
||||
|
||||
print $titletoshow;
|
||||
print $listofusertoshow;
|
||||
|
||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
|
||||
@ -1740,6 +1834,17 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
||||
*/
|
||||
function sort_events_by_date($a, $b)
|
||||
{
|
||||
// Sort holidays at first
|
||||
if($a->type_code === 'HOLIDAY')
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($b->type_code === 'HOLIDAY')
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// datep => Event start time
|
||||
// datef => Event end time
|
||||
|
||||
|
||||
@ -308,7 +308,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND (a.fk_soc IS
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($type) $sql .= " AND c.id = ".$type;
|
||||
if ($type) $sql .= " AND c.id = ".(int) $type;
|
||||
if ($status == '0') { $sql .= " AND a.percent = 0"; }
|
||||
if ($status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable
|
||||
if ($status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
||||
@ -554,7 +554,10 @@ if ($resql)
|
||||
$actionstatic->type_picto = $obj->type_picto;
|
||||
$actionstatic->label = $obj->label;
|
||||
$actionstatic->location = $obj->location;
|
||||
$actionstatic->note = dol_htmlentitiesbr($obj->note);
|
||||
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
|
||||
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
|
||||
|
||||
$actionstatic->fetchResources();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -656,7 +659,6 @@ if ($resql)
|
||||
if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
||||
print '<td>';
|
||||
|
||||
$actionstatic->fetchResources();
|
||||
if (!empty($actionstatic->socpeopleassigned))
|
||||
{
|
||||
$contactList = array();
|
||||
|
||||
@ -513,7 +513,7 @@ if ($object->id > 0)
|
||||
$langs->load("categories");
|
||||
print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
|
||||
print '<td>';
|
||||
print $form->showCategories($object->id, 'customer', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/comm/multiprix.php
|
||||
* \ingroup societe
|
||||
* \brief Onglet choix du niveau de prix
|
||||
* \brief Tab to set the price level of a thirdparty
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -64,20 +64,11 @@ $userstatic = new User($db);
|
||||
|
||||
if ($_socid > 0)
|
||||
{
|
||||
// On recupere les donnees societes par l'objet
|
||||
// We load data of thirdparty
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id = $_socid;
|
||||
$objsoc->fetch($_socid, $to);
|
||||
|
||||
if ($errmesg)
|
||||
{
|
||||
print '<div class="error">'.$errmesg.'</div><br>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
|
||||
$head = societe_prepare_head($objsoc);
|
||||
|
||||
@ -91,7 +82,7 @@ if ($_socid > 0)
|
||||
|
||||
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $langs->trans("PriceLevel").'</td><td>'.$objsoc->price_level."</td></tr>";
|
||||
|
||||
@ -1800,7 +1800,7 @@ class Propal extends CommonObject
|
||||
$this->newref = $num;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET ref = '".$num."',";
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql .= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
@ -3346,7 +3346,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
@ -3385,6 +3385,10 @@ class Propal extends CommonObject
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
@ -3541,9 +3545,10 @@ class Propal extends CommonObject
|
||||
* @param string $get_params Parametres added to url
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $addlinktonotes Add linkt to notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@ -3609,6 +3614,22 @@ class Propal extends CommonObject
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
||||
if ($txttoshow)
|
||||
{
|
||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
||||
$result .= ' <span class="note inline-block">';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
||||
$result .= img_picto('', 'note');
|
||||
$result .= '</a>';
|
||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||
//$result.='</a>';
|
||||
$result .= '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,19 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
@ -75,15 +76,12 @@ $search_zip = GETPOST('search_zip', 'alpha');
|
||||
$search_state = trim(GETPOST("search_state"));
|
||||
$search_country = GETPOST("search_country", 'int');
|
||||
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
||||
$search_day = GETPOST("search_day", "int");
|
||||
$search_month = GETPOST("search_month", "int");
|
||||
$search_year = GETPOST("search_year", "int");
|
||||
$search_dayfin = GETPOST("search_dayfin", "int");
|
||||
$search_month_end = GETPOST("search_month_end", "int");
|
||||
$search_yearfin = GETPOST("search_yearfin", "int");
|
||||
$search_daydelivery = GETPOST("search_daydelivery", "int");
|
||||
$search_monthdelivery = GETPOST("search_monthdelivery", "int");
|
||||
$search_yeardelivery = GETPOST("search_yeardelivery", "int");
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||
$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
|
||||
$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
|
||||
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||
$search_availability = GETPOST('search_availability', 'int');
|
||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||
$search_btn = GETPOST('button_search', 'alpha');
|
||||
@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_type = '';
|
||||
$search_country = '';
|
||||
$search_type_thirdparty = '';
|
||||
$search_year = '';
|
||||
$search_month = '';
|
||||
$search_day = '';
|
||||
$search_yearfin = '';
|
||||
$search_month_end = '';
|
||||
$search_dayfin = '';
|
||||
$search_yeardelivery = '';
|
||||
$search_monthdelivery = '';
|
||||
$search_daydelivery = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_dateend_start = '';
|
||||
$search_dateend_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_availability = '';
|
||||
$viewstatut = '';
|
||||
$object_statut = '';
|
||||
@ -275,6 +270,7 @@ $sql .= " ava.rowid as availability,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||
$sql .= ' p.note_public, p.note_private,';
|
||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql .= ' u.login';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
@ -313,38 +309,42 @@ if (!$user->rights->societe->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject);
|
||||
if ($search_project) $sql .= natural_search('pr.title', $search_project);
|
||||
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
|
||||
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject);
|
||||
if ($search_project) $sql .= natural_search('pr.title', $search_project);
|
||||
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
|
||||
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category);
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category);
|
||||
if ($socid > 0) $sql .= ' AND s.rowid = '.$socid;
|
||||
if ($viewstatut != '' && $viewstatut != '-1')
|
||||
{
|
||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||
}
|
||||
$sql .= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year);
|
||||
$sql .= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin);
|
||||
$sql .= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
|
||||
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
|
||||
@ -414,22 +414,25 @@ if ($resql)
|
||||
$param = '&viewstatut='.urlencode($viewstatut);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
||||
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
||||
if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
|
||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_town) $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
|
||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start);
|
||||
if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end);
|
||||
if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start);
|
||||
if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
||||
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
||||
if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
|
||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_town) $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
|
||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($search_product_category != '') $param .= '&search_product_category='.$search_product_category;
|
||||
|
||||
@ -594,34 +597,43 @@ if ($resql)
|
||||
// Date
|
||||
if (!empty($arrayfields['p.date']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Date end
|
||||
if (!empty($arrayfields['p.fin_validite']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Date delivery
|
||||
if (!empty($arrayfields['p.date_livraison']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="'.dol_escape_htmltag($search_daydelivery).'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="'.dol_escape_htmltag($search_monthdelivery).'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Availability
|
||||
@ -719,37 +731,37 @@ if ($resql)
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -764,6 +776,8 @@ if ($resql)
|
||||
|
||||
$objectstatic->id = $obj->rowid;
|
||||
$objectstatic->ref = $obj->ref;
|
||||
$objectstatic->note_public = $obj->note_public;
|
||||
$objectstatic->note_private = $obj->note_private;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
@ -784,18 +798,11 @@ if ($resql)
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1, '', '', 0, 1);
|
||||
print $objectstatic->getNomUrl(1, '', '', 0, 1, 1);
|
||||
print '</td>';
|
||||
// Warning
|
||||
$warnornote = '';
|
||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
|
||||
if (!empty($obj->note_private))
|
||||
{
|
||||
$warnornote .= ($warnornote ? ' ' : '');
|
||||
$warnornote .= '<span class="note">';
|
||||
$warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
|
||||
$warnornote .= '</span>';
|
||||
}
|
||||
if ($warnornote)
|
||||
{
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
@ -945,7 +952,7 @@ if ($resql)
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['p.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
|
||||
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
||||
@ -953,7 +960,7 @@ if ($resql)
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['p.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_vat)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_vat)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
|
||||
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
||||
@ -961,7 +968,7 @@ if ($resql)
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['p.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
|
||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||
@ -982,7 +989,7 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
||||
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
||||
@ -1003,7 +1010,7 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
||||
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
||||
|
||||
@ -222,7 +222,7 @@ if ($socid > 0)
|
||||
$sql .= " u.login, u.rowid as user_id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE rc.fk_soc = ".$object->id;
|
||||
$sql .= " AND rc.entity = ".$conf->entity;
|
||||
$sql .= " AND rc.entity IN (".getEntity('discount').")";
|
||||
$sql .= " AND u.rowid = rc.fk_user_author";
|
||||
$sql .= " ORDER BY rc.datec DESC";
|
||||
|
||||
@ -281,7 +281,7 @@ if ($socid > 0)
|
||||
$sql .= " u.login, u.rowid as user_id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_supplier as rc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE rc.fk_soc = ".$object->id;
|
||||
$sql .= " AND rc.entity = ".$conf->entity;
|
||||
$sql .= " AND rc.entity IN (".getEntity('discount').")";
|
||||
$sql .= " AND u.rowid = rc.fk_user_author";
|
||||
$sql .= " ORDER BY rc.datec DESC";
|
||||
|
||||
|
||||
@ -2542,6 +2542,11 @@ if ($action == 'create' && $usercancreate)
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
if ($usercansend) {
|
||||
@ -2619,11 +2624,6 @@ if ($action == 'create' && $usercancreate)
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
|
||||
|
||||
@ -959,6 +959,7 @@ class Commande extends CommonOrder
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->db->rollback();
|
||||
@ -1434,6 +1435,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
@ -1447,6 +1449,7 @@ class Commande extends CommonOrder
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
@ -3082,6 +3085,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
@ -3558,9 +3562,10 @@ class Commande extends CommonOrder
|
||||
* @param int $short ???
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $addlinktonotes Add linkt to notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@ -3627,6 +3632,22 @@ class Commande extends CommonOrder
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
||||
if ($txttoshow)
|
||||
{
|
||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
||||
$result .= ' <span class="note inline-block">';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
||||
$result .= img_picto('', 'note');
|
||||
$result .= '</a>';
|
||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||
//$result.='</a>';
|
||||
$result .= '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -3697,7 +3718,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||
|
||||
@ -3731,8 +3752,13 @@ class Commande extends CommonOrder
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->availability_code = 'DSP';
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@ -56,12 +56,10 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
|
||||
|
||||
$search_orderyear = GETPOST("search_orderyear", "int");
|
||||
$search_ordermonth = GETPOST("search_ordermonth", "int");
|
||||
$search_orderday = GETPOST("search_orderday", "int");
|
||||
$search_deliveryyear = GETPOST("search_deliveryyear", "int");
|
||||
$search_deliverymonth = GETPOST("search_deliverymonth", "int");
|
||||
$search_deliveryday = GETPOST("search_deliveryday", "int");
|
||||
$search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int'));
|
||||
$search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int'));
|
||||
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||
$search_product_category = GETPOST('search_product_category', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha');
|
||||
$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
|
||||
@ -77,6 +75,7 @@ $search_user = GETPOST('search_user', 'int');
|
||||
$search_sale = GETPOST('search_sale', 'int');
|
||||
$search_total_ht = GETPOST('search_total_ht', 'alpha');
|
||||
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
||||
$search_login=GETPOST('search_login', 'alpha');
|
||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$billed = GETPOST('billed', 'int');
|
||||
@ -142,6 +141,7 @@ $arrayfields = array(
|
||||
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
@ -197,12 +197,11 @@ if (empty($reshook))
|
||||
$search_total_ht = '';
|
||||
$search_total_vat = '';
|
||||
$search_total_ttc = '';
|
||||
$search_orderyear = '';
|
||||
$search_ordermonth = '';
|
||||
$search_orderday = '';
|
||||
$search_deliveryday = '';
|
||||
$search_deliverymonth = '';
|
||||
$search_deliveryyear = '';
|
||||
$search_login='';
|
||||
$search_dateorder_start = '';
|
||||
$search_dateorder_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_project_ref = '';
|
||||
$search_project = '';
|
||||
$viewstatut = '';
|
||||
@ -250,10 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
$sql.= " u.login";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
||||
@ -272,6 +272,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
@ -311,22 +313,27 @@ if ($viewstatut <> '')
|
||||
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
||||
}
|
||||
}
|
||||
$sql .= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear);
|
||||
$sql .= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -402,34 +409,33 @@ if ($resql)
|
||||
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||
if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut);
|
||||
if ($search_orderday) $param .= '&search_orderday='.urlencode($search_orderday);
|
||||
if ($search_ordermonth) $param .= '&search_ordermonth='.urlencode($search_ordermonth);
|
||||
if ($search_orderyear) $param .= '&search_orderyear='.urlencode($search_orderyear);
|
||||
if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday);
|
||||
if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
|
||||
if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||
if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
|
||||
if ($search_state != '') $param .= '&search_state='.urlencode($search_state);
|
||||
if ($search_country != '') $param .= '&search_country='.urlencode($search_country);
|
||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||
if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut);
|
||||
if ($search_dateorder_start) $param .= '&search_dateorder_start='.urlencode($search_dateorder_start);
|
||||
if ($search_dateorder_end) $param .= '&search_dateorder_end='.urlencode($search_dateorder_end);
|
||||
if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start);
|
||||
if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||
if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_login) $param.='&search_login='.urlencode($search_login);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
|
||||
if ($search_state != '') $param .= '&search_state='.urlencode($search_state);
|
||||
if ($search_country != '') $param .= '&search_country='.urlencode($search_country);
|
||||
if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
|
||||
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param .= '&billed='.urlencode($billed);
|
||||
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param .= '&billed='.urlencode($billed);
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@ -646,18 +652,28 @@ if ($resql)
|
||||
// Date order
|
||||
if (!empty($arrayfields['c.date_commande']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_orderday" value="'.$search_orderday.'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_ordermonth" value="'.$search_ordermonth.'">';
|
||||
$formother->select_year($search_orderyear ? $search_orderyear : -1, 'search_orderyear', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.date_delivery']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliveryday" value="'.$search_deliveryday.'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliverymonth" value="'.$search_deliverymonth.'">';
|
||||
$formother->select_year($search_deliveryyear ? $search_deliveryyear : -1, 'search_deliveryyear', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.total_ht']['checked']))
|
||||
@ -681,6 +697,13 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
@ -752,6 +775,8 @@ if ($resql)
|
||||
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -773,7 +798,7 @@ if ($resql)
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
|
||||
$userstatic = new User($db);
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
@ -804,6 +829,8 @@ if ($resql)
|
||||
$generic_commande->total_ht = $obj->total_ht;
|
||||
$generic_commande->total_tva = $obj->total_tva;
|
||||
$generic_commande->total_ttc = $obj->total_ttc;
|
||||
$generic_commande->note_public = $obj->note_public;
|
||||
$generic_commande->note_private = $obj->note_private;
|
||||
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
@ -816,9 +843,9 @@ if ($resql)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1);
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
@ -926,12 +953,6 @@ if ($resql)
|
||||
if ($generic_commande->hasDelay()) {
|
||||
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
|
||||
}
|
||||
if (!empty($obj->note_private) || !empty($obj->note_public))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
@ -1054,7 +1075,7 @@ if ($resql)
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['c.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
|
||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||
@ -1062,7 +1083,7 @@ if ($resql)
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['c.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_tva)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_tva)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
|
||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||
@ -1070,12 +1091,25 @@ if ($resql)
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['c.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
|
||||
// Author
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Onglets
|
||||
$head = account_statement_prepare_head($object, $num);
|
||||
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), -1, 'account');
|
||||
dol_fiche_head($head, 'document', $langs->trans("AccountStatement"), -1, 'account');
|
||||
|
||||
|
||||
// Build file list
|
||||
@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
|
||||
$title = $langs->trans("AccountStatement").' '.$num.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title, '', 'title_bank.png');
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -573,11 +573,13 @@ if ($page >= $nbtotalofpages)
|
||||
if (empty($search_account)) $mode_balance_ok = false;
|
||||
// If a search is done $mode_balance_ok=false
|
||||
if (!empty($search_ref)) $mode_balance_ok = false;
|
||||
if (!empty($req_nb)) $mode_balance_ok = false;
|
||||
if (!empty($search_description)) $mode_balance_ok = false;
|
||||
if (!empty($search_type)) $mode_balance_ok = false;
|
||||
if (!empty($debit)) $mode_balance_ok = false;
|
||||
if (!empty($credit)) $mode_balance_ok = false;
|
||||
if (!empty($thirdparty)) $mode_balance_ok = false;
|
||||
if (!empty($search_debit)) $mode_balance_ok = false;
|
||||
if (!empty($search_credit)) $mode_balance_ok = false;
|
||||
if (!empty($search_thirdparty)) $mode_balance_ok = false;
|
||||
if ($search_conciliated != '') $mode_balance_ok = false;
|
||||
if (!empty($search_num_releve)) $mode_balance_ok = false;
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
@ -690,7 +690,7 @@ else
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||
print $form->showCategories($object->id, 'bank_account', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -135,9 +135,9 @@ class PaymentVarious extends CommonObject
|
||||
if ($this->tms) $sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " sens=".$this->sens.",";
|
||||
$sql.= " sens=".(int) $this->sens.",";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
$sql.= " fk_typepayment=".(int) $this->fk_typepayment.",";
|
||||
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
@ -145,8 +145,8 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " subledger_account='".$this->db->escape($this->subledger_account)."',";
|
||||
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
|
||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif;
|
||||
$sql.= " fk_user_author=".(int) $this->fk_user_author.",";
|
||||
$sql.= " fk_user_modif=".(int) $this->fk_user_modif;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -682,4 +682,40 @@ class PaymentVarious extends CommonObject
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a various payment linked to a bank line id was dispatched into bookkeeping
|
||||
*
|
||||
* @return int <0 if KO, 0=no, 1=yes
|
||||
*/
|
||||
public function getVentilExportCompta()
|
||||
{
|
||||
$banklineid = $this->fk_bank;
|
||||
|
||||
$alreadydispatched = 0;
|
||||
|
||||
$type = 'bank';
|
||||
|
||||
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$type."' AND ab.fk_doc = ".$banklineid;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$alreadydispatched = $obj->nb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($alreadydispatched)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
|
||||
@ -38,12 +38,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
//show files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("banks", "categories", "companies", "bills", "trips"));
|
||||
$langs->loadLangs(array("banks", "categories", "companies", "bills", "trips", "donations", "loan"));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$id = GETPOST('account', 'int');
|
||||
@ -202,6 +205,9 @@ $paymentvatstatic = new TVA($db);
|
||||
$bankstatic = new Account($db);
|
||||
$banklinestatic = new AccountLine($db);
|
||||
$remisestatic = new RemiseCheque($db);
|
||||
$paymentdonationstatic=new PaymentDonation($db);
|
||||
$paymentloanstatic=new PaymentLoan($db);
|
||||
$paymentvariousstatic=new PaymentVarious($db);
|
||||
|
||||
// Must be before button action
|
||||
$param = '';
|
||||
@ -358,12 +364,12 @@ if (empty($numref))
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Show list of bank statements
|
||||
* Show list of record into a bank statement
|
||||
*/
|
||||
|
||||
// Onglets
|
||||
$head = account_statement_prepare_head($object, $numref);
|
||||
dol_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');
|
||||
dol_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account');
|
||||
|
||||
|
||||
$mesprevnext = '';
|
||||
@ -376,7 +382,7 @@ else
|
||||
$mesprevnext .= '</ul></div>';
|
||||
|
||||
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title, $mesprevnext, 'title_bank.png');
|
||||
print load_fiche_titre($title, $mesprevnext, '');
|
||||
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'title_bank.png', 0, '', '', 0, 1);
|
||||
|
||||
print "<form method=\"post\" action=\"releve.php\">";
|
||||
@ -438,12 +444,11 @@ else
|
||||
// Date de valeur
|
||||
print '<td valign="center" class="center nowrap">';
|
||||
print dol_print_date($db->jdate($objp->dv), "day").' ';
|
||||
print '<a href="releve.php?action=dvprev&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print img_edit_remove()."</a> ";
|
||||
print '<a href="releve.php?action=dvnext&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print img_edit_add()."</a>";
|
||||
print "</td>\n";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
|
||||
// Type and num
|
||||
if ($objp->fk_type == 'SOLD') {
|
||||
@ -460,7 +465,8 @@ else
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq ? $objp->num_chq : '').$link.'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
print '<td valign="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
$reg = array();
|
||||
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
|
||||
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) print $langs->trans($reg[1]);
|
||||
@ -512,7 +518,28 @@ else
|
||||
print '</a>';
|
||||
$newline = 0;
|
||||
}
|
||||
elseif ($links[$key]['type'] == 'banktransfert') {
|
||||
elseif ($links[$key]['type']=='payment_donation')
|
||||
{
|
||||
$paymentdonationstatic->id=$links[$key]['url_id'];
|
||||
$paymentdonationstatic->ref=$langs->trans("Payment");
|
||||
print ' '.$paymentdonationstatic->getNomUrl(1);
|
||||
$newline = 0;
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_loan')
|
||||
{
|
||||
$paymentloanstatic->id=$links[$key]['url_id'];
|
||||
$paymentloanstatic->ref=$langs->trans("Payment");
|
||||
print ' '.$paymentloanstatic->getNomUrl(1);
|
||||
$newline = 0;
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_various')
|
||||
{
|
||||
$paymentvariousstatic->id=$links[$key]['url_id'];
|
||||
$paymentvariousstatic->ref=$langs->trans("Payment");
|
||||
print ' '.$paymentvariousstatic->getNomUrl(1);
|
||||
$newline = 0;
|
||||
}
|
||||
elseif ($links[$key]['type']=='banktransfert') {
|
||||
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
||||
if ($objp->amount > 0)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
@ -238,6 +238,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>';
|
||||
@ -261,6 +262,7 @@ print '<td><input name="amount" class="flat" type="text" size="6" value="'.dol_e
|
||||
print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></div>';
|
||||
|
||||
|
||||
@ -64,6 +64,7 @@ $object = new PaymentVarious($db);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('variouscard','globalcard'));
|
||||
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
@ -216,6 +217,20 @@ if (empty($reshook))
|
||||
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setsubledger_account') {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "");
|
||||
|
||||
$res = $object->update($user);
|
||||
if ($res > 0) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -412,6 +427,8 @@ if ($action == 'create')
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$alreadyaccounted = $object->getVentilExportCompta();
|
||||
|
||||
$head=various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||
@ -456,7 +473,7 @@ if ($id)
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
@ -495,9 +512,9 @@ if ($id)
|
||||
|
||||
// Subledger account
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("SubledgerAccount");
|
||||
print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
||||
print '</td><td>';
|
||||
print $object->subledger_account;
|
||||
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->banque->enabled))
|
||||
@ -542,7 +559,11 @@ if ($id)
|
||||
{
|
||||
if (!empty($user->rights->banque->modifier))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
if ($alreadyaccounted) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("Accounted").'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -134,7 +134,7 @@ if ($object->id)
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
@ -31,24 +31,28 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","banks","bills","accountancy"));
|
||||
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_user = GETPOST('search_user', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||
$search_amount_deb = GETPOST('search_amount_deb', 'alpha');
|
||||
$search_amount_cred = GETPOST('search_amount_cred', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'int');
|
||||
$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int'));
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
$search_accountancy_account = GETPOST("search_accountancy_account");
|
||||
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
|
||||
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
|
||||
if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = '';
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
@ -57,36 +61,38 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="v.datep,v.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield = "v.datep,v.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
$filtre=GETPOST("filtre", 'alpha');
|
||||
$filtre = GETPOST("filtre", 'alpha');
|
||||
|
||||
if (! GETPOST('typeid'))
|
||||
if (!GETPOST('typeid'))
|
||||
{
|
||||
$newfiltre=str_replace('filtre=', '', $filtre);
|
||||
$filterarray=explode('-', $newfiltre);
|
||||
foreach($filterarray as $val)
|
||||
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||
$filterarray = explode('-', $newfiltre);
|
||||
foreach ($filterarray as $val)
|
||||
{
|
||||
$part=explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
|
||||
$part = explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeid=GETPOST('typeid');
|
||||
$typeid = GETPOST('typeid');
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
$search_amount_deb="";
|
||||
$search_amount_cred="";
|
||||
$search_account='';
|
||||
$typeid="";
|
||||
$search_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_ref = "";
|
||||
$search_label = "";
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_amount_deb = "";
|
||||
$search_amount_cred = "";
|
||||
$search_account = '';
|
||||
$search_accountancy_account = '';
|
||||
$search_accountancy_subledger = '';
|
||||
$typeid = "";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -100,59 +106,63 @@ $formaccounting = new FormAccounting($db);
|
||||
$variousstatic = new PaymentVarious($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql .= " pst.code as payment_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
|
||||
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'";
|
||||
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code);
|
||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":", "=", $filtre);
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
$total = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
|
||||
//if ($search_date) $param.='&search_date='.$search_date;
|
||||
if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code);
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
||||
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->banque->modifier)
|
||||
@ -188,7 +198,13 @@ if ($result)
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date, 'date_doc', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
@ -208,9 +224,17 @@ if ($result)
|
||||
// Accounting account
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accounting account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array(), 1, 1, 'maxwidth200');
|
||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Subledger account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -222,7 +246,7 @@ if ($result)
|
||||
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -235,7 +259,8 @@ if ($result)
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
@ -254,19 +279,19 @@ if ($result)
|
||||
|
||||
// Ref
|
||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Account
|
||||
if (!empty($conf->banque->enabled))
|
||||
@ -291,7 +316,7 @@ if ($result)
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
@ -300,7 +325,14 @@ if ($result)
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting subledger account
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Debit
|
||||
@ -310,9 +342,9 @@ if ($result)
|
||||
print price($obj->amount);
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
|
||||
print "</td>";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||
print '</td>';
|
||||
|
||||
// Credit
|
||||
print '<td class="nowrap right">';
|
||||
@ -321,12 +353,12 @@ if ($result)
|
||||
print price($obj->amount);
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
||||
print '</td>' ;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products'));
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products', 'banks'));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
@ -1030,6 +1030,8 @@ if ($action == 'create')
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
|
||||
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
@ -1446,8 +1448,6 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Bank Account
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
@ -1468,8 +1468,6 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Model pdf
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('Model');
|
||||
|
||||
@ -103,7 +103,9 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
if ($action != 'add') {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -134,6 +136,8 @@ if ($user->socid) $socid = $user->socid;
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -286,6 +290,39 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Also negative lines should not be allowed on 'non Credit notes' invoices. A test is done when adding or updating lines but we must
|
||||
// do it again in validation to avoid cases where invoice is created from another object that allow negative lines.
|
||||
// Note that we can accept the negative line if sum with other lines with same vat is positivie: Because all the lines will be merged together
|
||||
// when converted into 'available credit' and we will get a positive available credit line.
|
||||
// Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only).
|
||||
$array_of_pu_ht_per_vat_rate = array();
|
||||
$array_of_pu_ht_devise_per_vat_rate = array();
|
||||
foreach($object->lines as $line) {
|
||||
if (empty($array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
if (empty($array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
$array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->subprice;
|
||||
$array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice;
|
||||
}
|
||||
//var_dump($array_of_pu_ht_per_vat_rate);exit;
|
||||
foreach($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
{
|
||||
$pu_ht = $array_of_pu_ht_per_vat_rate[$vatrate];
|
||||
$pu_ht_devise = $array_of_pu_ht_devise_per_vat_rate[$vatrate];
|
||||
|
||||
if (($pu_ht < 0 || $pu_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,6 +817,23 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// If some payments were already done, we change the amount to pay using same prorate
|
||||
if (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
|
||||
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
|
||||
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
|
||||
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);
|
||||
foreach($amount_ht as $vatrate => $val) {
|
||||
$amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU');
|
||||
$amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU');
|
||||
$amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU');
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($amount_ht);var_dump($amount_tva);var_dump($amount_ttc);exit;
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($db);
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
||||
@ -924,11 +978,13 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!($_POST['fac_replacement'] > 0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -975,6 +1031,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@ -982,6 +1039,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1164,6 +1222,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1206,6 +1265,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@ -1213,6 +1273,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@ -1520,7 +1581,7 @@ if (empty($reshook))
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
|
||||
// View third's localtaxes for NOW and do not use value from origin.
|
||||
// TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ?
|
||||
// TODO Is this really what we want ? Yes if source is template invoice but what if proposal or order ?
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
||||
|
||||
@ -1625,6 +1686,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -1794,7 +1856,12 @@ if (empty($reshook))
|
||||
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@ -2106,7 +2173,7 @@ if (empty($reshook))
|
||||
if (!GETPOST('qty')) $special_code = 3;
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$line->fetch(GETPOST('lineid', 'int'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0)
|
||||
@ -2175,7 +2242,12 @@ if (empty($reshook))
|
||||
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@ -2266,17 +2338,17 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier'))
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice
|
||||
{
|
||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||
if (GETPOST('all_progress') != "")
|
||||
{
|
||||
$all_progress = GETPOST('all_progress', 'int');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
if (floatval($all_progress) < floatval($percent)) {
|
||||
$mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
$mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else
|
||||
@ -2286,7 +2358,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -2922,7 +2994,7 @@ if ($action == 'create')
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
||||
@ -2975,14 +3047,16 @@ if ($action == 'create')
|
||||
exit();
|
||||
}
|
||||
$options = "";
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
if (is_array($facids)) {
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<!-- replacement line -->';
|
||||
@ -3189,13 +3263,13 @@ if ($action == 'create')
|
||||
|
||||
$thirdparty = $soc;
|
||||
$discount_type = 0;
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'));
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin', 'alpha').'&originid='.GETPOST('originid', 'int'));
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
@ -3206,14 +3280,14 @@ if ($action == 'create')
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION))
|
||||
@ -3730,18 +3804,24 @@ elseif ($id > 0 || !empty($ref))
|
||||
$i++;
|
||||
$close[$i]['code'] = 'badcustomer';
|
||||
$i++;
|
||||
$close[$i]['code'] = 'other';
|
||||
$i++;
|
||||
// Help
|
||||
$i = 0;
|
||||
$close[$i]['label'] = $langs->trans("HelpEscompte").'<br><br>'.$langs->trans("ConfirmClassifyPaidPartiallyReasonDiscountVatDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("Other");
|
||||
$i++;
|
||||
// Texte
|
||||
$i = 0;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscount", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
// arrayreasons[code]=reason
|
||||
foreach ($close as $key => $val) {
|
||||
$arrayreasons[$close [$key]['code']] = $close[$key]['reason'];
|
||||
@ -3932,7 +4012,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
if ($result > 0) {
|
||||
print '. <span class="opacitymediumbycolor">'.$langs->trans(
|
||||
"GeneratedFromTemplate",
|
||||
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
|
||||
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
|
||||
).'</span>';
|
||||
}
|
||||
}
|
||||
@ -4217,7 +4297,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
if (!$displayWarranty) {
|
||||
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
|
||||
}
|
||||
@ -4534,7 +4614,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Payments already done (from payment on this invoice)
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||
$sql .= ' pf.amount,';
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||
@ -4560,7 +4640,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
$paymentstatic->id = $objp->rowid;
|
||||
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentstatic->ref = $objp->ref;
|
||||
$paymentstatic->num_paiement = $objp->num_paiement;
|
||||
$paymentstatic->num_payment = $objp->num_payment;
|
||||
$paymentstatic->payment_code = $objp->payment_code;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
@ -4568,7 +4648,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
|
||||
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
|
||||
print '<td>'.$label.' '.$objp->num_paiement.'</td>';
|
||||
print '<td>'.$label.' '.$objp->num_payment.'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
@ -5014,7 +5094,9 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').'</a>';
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) {
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate
|
||||
&& (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
@ -5057,21 +5139,6 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
|
||||
{
|
||||
@ -5083,6 +5150,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
|
||||
// For situation invoice with excess received
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $usercancreate
|
||||
&& !$objectidnext
|
||||
@ -5098,6 +5166,21 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Remove situation from cycle
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
|
||||
@ -448,10 +448,12 @@ class Facture extends CommonInvoice
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y');
|
||||
$substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y');
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
|
||||
// Only for tempalte invoice
|
||||
// Only for template invoice
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $_facrec->nb_gen_done;
|
||||
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $_facrec->nb_gen_max;
|
||||
|
||||
//var_dump($substitutionarray);exit;
|
||||
|
||||
@ -4046,7 +4048,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function initAsSpecimen($option = '')
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$now = dol_now();
|
||||
$arraynow = dol_getdate($now);
|
||||
@ -4088,9 +4090,14 @@ class Facture extends CommonInvoice
|
||||
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
|
||||
$this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR
|
||||
$this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR
|
||||
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
$this->note = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
$this->fk_incoterms = 0;
|
||||
$this->location_incoterms = '';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user