Merge pull request #4 from Dolibarr/develop

Pull latest
This commit is contained in:
IJ 2018-12-05 12:33:20 +00:00 committed by GitHub
commit ffeda25de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1002 changed files with 16947 additions and 12974 deletions

View File

@ -289,7 +289,7 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
#parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e set +e
echo echo

103
ChangeLog
View File

@ -5,20 +5,111 @@ English Dolibarr ChangeLog
***** ChangeLog for 9.0.0 compared to 8.0.0 ***** ***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users: For Users:
NEW: Stable module: Website NEW: Stable module: DAV (WebDAV only for the moment)
NEW: Stable module: WebDAV
NEW: Stable module: Module Builder
NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more services. NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more services.
NEW: Stable module "Module Builder"
NEW: Stable module: Website
NEW: Experimental module "TakePos" NEW: Experimental module "TakePos"
NEW: Experimental module "Ticket" NEW: Experimental module "Ticket"
NEW: Experimental module "Data Privacy"
NEW: Experimental module "Email Collector"
NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making
Android application like DoliDroid able to provide native features for multicompany module. Android application like DoliDroid able to provide native features for multicompany module.
NEW: Compatibility with PHP 7.3 NEW: Compatibility with PHP 7.3 =>
NEW: Add admin page for modulebuilder
NEW: Add civility in list of members. Close #9251
NEW: Add configuration to disable "customer/prospect" thirdparty type
NEW: Add CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY and CONTRACT_HIDE_UNSELECTABLES by SELECT_HIDE_UNSELECTABLES
NEW: Add __DAY_TEXT__ and __MONTH_TEXT__ substitutions vars
NEW: Add due date column in payment lists
NEW: Add email in event history, for reminder email of expired subsription
NEW: Add event tab on resource record
NEW: Add FEC Export in accountancy
NEW: Add filter on staff range in list of thirdparties
NEW: Add a first complete template of website
NEW: Add format code into exported filename of ledger
NEW: Add hidden option EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE
NEW: Add hidden option MAIN_DOCUMENTS_DESCRIPTION_FIRST
NEW: Add link to inventory code
NEW: Add more common social networks fields for business
NEW: Add option PDF_DISABLE_MYCOMPANY_LOGO to disable logo on PDF
NEW: add option PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT
NEW: Add option to display thirdparty adress in combolist
NEW: Add option to swap sender/recipient address on PDF
NEW: Add option to display thirdparty adress in combolist
NEW: Add project on pament of salaries
NEW: Add SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME and
NEW: Add somes hooks in bank planned entries
NEW: Add supplier ref in item reception page
NEW: Advanced permission to ignore price min
NEW: Allow to enter a timespent with a numeric value
NEW: Automatic position of scroll when creating an extrafield
NEW: Can add autorefresh=X in any URLs to refresh page after X seconds
NEW: can add project's task to agenda on create event form
NEW: Can delete a website in experimental website module
NEW: Can disable meteo on smartphone only
NEW: Can export/import a website template
NEW: Can filter on EEC, not EEC, etc... in binding step of accountancy
NEW: Can mix offset before and after with rules for due date of invoices
NEW: Can record the supplier product description
NEW: Can select several prospect level in thirdparty filter.
NEW: Can set 2 url in url field of thirdparty
NEW: Can set if a field is mandatory on form level.
NEW: Can set the default focus of each page.
NEW: Add category filter on user list
NEW: Change forgotten password link in general parameters
NEW: Child label of variants change if parent label changes
NEW: Compatibility with new Paybox HMAC requirement
NEW: Each user can set its prefered default calendar page
NEW: Enhancement in process to make manual bank conciliation
NEW: Enhancement in the generic file manager
NEW: Extrafield totalizable
NEW: Hidden conf INVOICE_USE_DEFAULT_DOCUMENT
NEW: hidden conf to search product by supplier ref
NEW: hidden constant to be able to use a thirdparty for donation
NEW: hidden option to define an invoice template for each invoice type
NEW: Highlight lines on lists when they are checked
NEW: Notification module support expense report+holiday validation and approval
NEW: On customer/supplier card, add simple tooltip to amount boxes
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements
NEW: possibility to add all rights of all modules in one time
NEW: redirect if only one result on global search on card
NEW: Permission to ignore price min
NEW: Can build an archive of full documents directory from backup page
NEW: tag odt line_product_ref_fourn for supplier doc lines
NEW: The binding step in accountancy has a country filter with autocompletion
NEW: Top menu is always on screen with MD theme.
NEW: Withdraw request massaction can include already partially paid invoices
For developers: For developers:
* Code changes to be more compatible with PSR2 NEW: Add lib for multiselect with checkboxes
* Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that) NEW: Add function isValidMXRecord
NEW: Add hook changeRoundingMode in update_price
NEW: Add hook formconfirm to contractcard
NEW: Add hook for virtual stock
NEW: ADD url to see the last version of a external module
NEW: Can enable a module, even external module, from command line
NEW: Can set a tooltip help text on extrafields
NEW: Add product search from barcode via REST api
NEW: can add documents on agenda events using API REST
NEW: Can set the datestart and dateend of cron job into module descriptor
NEW: Close #9296 Add field ref_ext into llx_categorie
NEW: move ticket dictionary in API /setup
NEW: PHPUnitTest on Loan class #3163
NEW: Code changes to be more compatible with PSR2
NEW: Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that)
NEW: Add agenda documents in API REST
NEW: Add "checked" field for new list engine compatibility
NEW: REST API improvements
NEW: Save external payment IDs into table of payment
NEW: triggers add commercial and del commercial
NEW: #9236 Allow to import shipment lines via API
NEW: ADD civility list in API
NEW: support selllist in the module builder
NEW: optional param to show a specific extrafield
NEW: hook formConfirm always called if hooked
NEW: hook on dispatch order fourn
WARNING: WARNING:

View File

@ -3,18 +3,30 @@ FROM php:7.0-apache
ENV HOST_USER_ID 33 ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \ && docker-php-ext-install ldap \
&& docker-php-ext-install mysqli \ && docker-php-ext-install mysqli \
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev && apt-get purge -y libjpeg-dev libldap2-dev
COPY docker-run.sh /usr/local/bin/ COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_host=docker.for.mac.host.internal' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["docker-run.sh"] ENTRYPOINT ["docker-run.sh"]

View File

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
return ( "7.0.0", "6.0.5", "5.0.7" ); return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
} }
sub script_dolibarr_release sub script_dolibarr_release
@ -263,15 +263,16 @@ if ($upgrade) {
local @params = ( [ "action", "upgrade" ], local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ], [ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ], [ "versionto", $ver ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory. # Remove the installation directory. (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
} }
else { else {
@ -306,15 +307,18 @@ else {
[ "login", "admin" ], [ "login", "admin" ],
[ "pass", $dompass ], [ "pass", $dompass ],
[ "pass_verif", $dompass ], [ "pass_verif", $dompass ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file. # Remove the installation directory (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Protect config file
&set_permissions_as_domain_user($d, 0644, $cfile); &set_permissions_as_domain_user($d, 0644, $cfile);
&set_permissions_as_domain_user($d, 0755, $cfiledir); &set_permissions_as_domain_user($d, 0755, $cfiledir);
} }
@ -386,6 +390,8 @@ sub script_dolibarr_check_latest
{ {
local ($ver) = @_; local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr", local @vers = &osdn_package_versions("dolibarr",
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,6 +41,7 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$accountingaccount = GETPOST('accountingaccount','alpha');
// Security check // Security check
@ -229,7 +230,7 @@ if ($action == 'create') {
// Account number // Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>'; print '<td><input name="account_number" size="30" value="' . $accountingaccount . '"></td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';

View File

@ -58,7 +58,7 @@ $pagenext = $page + 1;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
@ -127,7 +127,6 @@ if (! empty($search_accountancy_code_end)) {
$param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
} }
/* /*
* Action * Action
*/ */
@ -154,7 +153,7 @@ if ($action == 'export_csv')
$type_export = 'balance'; $type_export = 'balance';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -266,7 +265,7 @@ if ($action != 'export_csv')
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte); $root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($description)) { if (empty($description)) {
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; $link = '<a href="../admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -817,7 +817,7 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) { while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -866,14 +866,13 @@ class BookKeeping extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit offset limit * @param int $limit Offset limit
* @param int $offset offset limit * @param int $offset Offset limit
* @param array $filter filter array * @param array $filter Filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode Filter mode (AND or OR)
* * @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
@ -932,7 +931,7 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')'; $sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
@ -950,7 +949,8 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) { while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
{
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -989,8 +989,7 @@ class BookKeeping extends CommonObject
} else { } else {
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
return -1;
return - 1;
} }
} }
@ -1067,6 +1066,7 @@ class BookKeeping extends CommonObject
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$this->lines[] = $line; $this->lines[] = $line;
$i++; $i++;
@ -1577,7 +1577,7 @@ class BookKeeping extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
while ( $obj = $this->db->fetch_object($result) ) { while ($obj = $this->db->fetch_object($result)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
@ -1641,7 +1641,7 @@ class BookKeeping extends CommonObject
$this->linesexport = array (); $this->linesexport = array ();
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;

View File

@ -211,7 +211,7 @@ class Lettering extends BookKeeping
} }
if (count($ids) > 1) { if (count($ids) > 1) {
$result = $this->updatelettrage($ids); $result = $this->updateLettering($ids);
} }
} }
} }

View File

@ -1286,8 +1286,11 @@ else
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_MEMBER); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
foreach ($cats as $cat) { $arrayselected = array();
$arrayselected[] = $cat->id; if (is_array($cats)) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
} }
print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>"; print "</td></tr>";

View File

@ -59,6 +59,9 @@ class Adherent extends CommonObject
public $mesgs; public $mesgs;
/**
* @var string login of member
*/
public $login; public $login;
//! Clear password in memory //! Clear password in memory
@ -68,29 +71,70 @@ class Adherent extends CommonObject
//! Encrypted password in database (always defined) //! Encrypted password in database (always defined)
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/**
* @var string company name
* @deprecated
*/
public $societe; public $societe;
/** /**
* @var Societe $company {@type Societe} * @var string company name
*/ */
public $company; public $company;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
/** /**
* @var string Address * @var string Address
*/ */
public $address; public $address;
public $zip; /**
* @var string zipcode
*/
public $zip;
/**
* @var string town
*/
public $town; public $town;
public $state_id; // Id of department /**
public $state_code; // Code of department * @var int Id of state
public $state; // Label of department */
public $state_id;
/**
* @var string Code of state
*/
public $state_code;
/**
* @var string Label of state
*/
public $state;
/**
* @var string email
*/
public $email; public $email;
public $skype; /**
public $twitter; * @var string skype account
*/
public $skype;
/**
* @var string twitter account
*/
public $twitter;
/**
* @var string facebook account
*/
public $facebook; public $facebook;
/** /**
@ -120,8 +164,12 @@ class Adherent extends CommonObject
public $morphy; public $morphy;
public $public; public $public;
public $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
public $photo; // -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object
//public $statut;
public $photo;
public $datec; public $datec;
public $datem; public $datem;
@ -129,21 +177,20 @@ class Adherent extends CommonObject
public $birth; public $birth;
public $note_public; /**
public $note_private; * @var int id type member
*/
public $typeid;
public $typeid; // Id type adherent /**
public $type; // Libelle type adherent * @var string label type member
*/
public $type;
public $need_subscription; public $need_subscription;
public $user_id; public $user_id;
public $user_login; public $user_login;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
public $datefin; // From member table public $datefin; // From member table
// Fields loaded by fetch_subscriptions() // Fields loaded by fetch_subscriptions()
@ -155,7 +202,10 @@ class Adherent extends CommonObject
public $last_subscription_amount; public $last_subscription_amount;
public $subscriptions=array(); public $subscriptions=array();
public $oldcopy; // To contains a clone of this when we need to save old properties of object /**
* @var Adherent To contains a clone of this when we need to save old properties of object
*/
public $oldcopy;
/** /**
* @var int Entity * @var int Entity
@ -593,11 +643,11 @@ class Adherent extends CommonObject
$luser->societe_id=$this->societe; $luser->societe_id=$this->societe;
$luser->birth=$this->birth; $luser->birth=$this->birth;
$luser->address=$this->address; $luser->address=$this->address;
$luser->zip=$this->zip; $luser->zip=$this->zip;
$luser->town=$this->town; $luser->town=$this->town;
$luser->country_id=$this->country_id; $luser->country_id=$this->country_id;
$luser->state_id=$this->state_id; $luser->state_id=$this->state_id;
$luser->email=$this->email; $luser->email=$this->email;
$luser->skype=$this->skype; $luser->skype=$this->skype;

View File

@ -397,7 +397,7 @@ print '<br><br>';
*/ */
//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) //if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{ //{
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', ''); print load_fiche_titre($langs->trans("Other"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n"; print "<table class=\"noborder\" width=\"100%\">\n";

View File

@ -63,7 +63,7 @@ if ($action == 'setcoder')
$resql=$db->query($sqlp); $resql=$db->query($sqlp);
if (! $resql) dol_print_error($db); if (! $resql) dol_print_error($db);
} }
else if ($action == 'update') elseif ($action == 'update')
{ {
$location = GETPOST('GENBARCODE_LOCATION','alpha'); $location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
@ -71,17 +71,8 @@ else if ($action == 'update')
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha'); $coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
else if ($action == 'updateengine')
{
// TODO Update engines.
}
if ($action && $action != 'setcoder' && $action != 'setModuleOptions') if ($res > 0)
{
if (! $res > 0) $error++;
if (! $error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -90,6 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'updateengine')
{
$sql = "SELECT rowid, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid,'alpha');
$code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db);
}
$i++;
}
}
}
/* /*
* View * View
@ -161,9 +188,12 @@ foreach($dirbarcode as $reldir)
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">"; if (empty($conf->use_javascript_ajax))
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; {
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">"; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateengine">';
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -258,10 +288,9 @@ print "</table>\n";
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
// TODO Implement code behind action updateengine print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>'; print '</form>';
} }
//print '</form>';
print "<br>"; print "<br>";

View File

@ -11,6 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -995,7 +996,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print '<td>'; print '<td>';
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
$selectedlang = GETPOSTISSET('langcode','aZ09')?GETPOST('langcode','aZ09'):$langs->defaultlang; $selectedlang = GETPOSTISSET('langcode')?GETPOST('langcode', 'aZ09'):$langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
} }

View File

@ -129,4 +129,4 @@ print '</form>';
// End of page // End of page
llxFooter(); llxFooter();
$db->close();; $db->close();

View File

@ -517,7 +517,6 @@ print '<br>';
<input type="hidden" name="export_type" value="server" /> <input type="hidden" name="export_type" value="server" />
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend> <fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
<div class="fichehalfleft">
<?php <?php
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
@ -525,6 +524,13 @@ print $langs->trans("BackupDescX").'<br><br>';
?> ?>
<div id="backupfilesleft" class="fichehalfleft">
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
?>
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br> <label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
<input type="text" name="zipfilename_template" style="width: 90%" <input type="text" name="zipfilename_template" style="width: 90%"
id="zipfilename_template" id="zipfilename_template"
@ -537,6 +543,7 @@ echo $file;
?>" /> <br> ?>" /> <br>
<br> <br>
<?php <?php
// Show compression choices // Show compression choices
print '<div class="formelementrow">'; print '<div class="formelementrow">';

View File

@ -304,7 +304,7 @@ if (GETPOST('withtab','alpha'))
dol_fiche_head($head, 'fingerprints', '', -1); dol_fiche_head($head, 'fingerprints', '', -1);
} }
print '<span class="opacitymedium">'.$langs->trans("FingerprintsDesc")."</span><br>\n"; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("FingerprintsDesc")."<br></span>\n";
print '<br>'; print '<br>';
@ -342,7 +342,7 @@ for ($month = 1 ; $month <= 12 ; $month++)
} }
$retstring.="</select>"; $retstring.="</select>";
print $retstring; print $retstring;
print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth75" value="'.GETPOST('yeartoexport','int').'">'; print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOST('yeartoexport','int').'">';
print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">'; print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">';
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">'; print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>'; if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>';

View File

@ -1280,7 +1280,7 @@ $db->close();
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0) function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0)
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form global $action, $filter, $filtert, $status, $actioncode, $usergroup; // Filters used into search form
global $theme_datacolor; global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
@ -1639,6 +1639,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year; print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:''); print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
print ($filtert?'&filtert='.$filtert:''); print ($filtert?'&filtert='.$filtert:'');
print ($usergroup?'&usergroup='.$usergroup:'');
print ($actioncode!=''?'&actioncode='.$actioncode:''); print ($actioncode!=''?'&actioncode='.$actioncode:'');
print '">'.img_picto("all","1downarrow_selected.png").' ...'; print '">'.img_picto("all","1downarrow_selected.png").' ...';
print ' +'.(count($eventarray[$daykey])-$maxprint); print ' +'.(count($eventarray[$daykey])-$maxprint);

View File

@ -234,7 +234,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$sql = "SELECT"; $sql = "SELECT";
if ($usergroup > 0) $sql.=" DISTINCT"; if ($usergroup > 0) $sql.=" DISTINCT";
$sql.= " s.nom as societe, s.rowid as socid, s.client,"; $sql.= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; $sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,";
$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_contact, a.note, a.percent as percent,";
@ -605,11 +605,13 @@ if ($resql)
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) { if (! empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax100">'; print '<td class="tdoverflowmax100">';
if ($obj->socid) if ($obj->socid > 0)
{ {
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->client=$obj->client; $societestatic->client=$obj->client;
$societestatic->name=$obj->societe; $societestatic->name=$obj->societe;
$societestatic->email=$obj->socemail;
print $societestatic->getNomUrl(1,'',28); print $societestatic->getNomUrl(1,'',28);
} }
else print '&nbsp;'; else print '&nbsp;';

View File

@ -14,6 +14,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -438,38 +439,40 @@ class Propal extends CommonObject
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
$this->db->begin(); $this->db->begin();
$product_type=$type; $product_type=$type;
@ -2432,7 +2435,7 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function cloture($user, $statut, $note, $notrigger=0) function cloture($user, $statut, $note="", $notrigger=0)
{ {
global $langs,$conf; global $langs,$conf;

View File

@ -11,7 +11,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -175,9 +175,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
} }
} }
$object = new Propal($db); // To be passed as parameter of executeHooks that need
/* /*
* Actions * Actions
*/ */
@ -426,7 +423,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -469,7 +466,7 @@ if ($resql)
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Closed"); if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close");
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -9,8 +9,8 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1312,45 +1312,47 @@ class Commande extends CommonOrder
$logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise"; $logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
dol_syslog(get_class($this).$logtext, LOG_DEBUG); dol_syslog(get_class($this).$logtext, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);
// Check parameters
if ($type < 0) return -1;
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
$this->db->begin(); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);
// Check parameters
if ($type < 0) return -1;
$this->db->begin();
$product_type=$type; $product_type=$type;
if (!empty($fk_product)) if (!empty($fk_product))

View File

@ -401,7 +401,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;

View File

@ -634,7 +634,7 @@ if ($resql)
} }
// Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) if (! empty($conf->global->BANK_REPORT_LAST_NUM_RELEVE))
{ {
print ' print '
<script type="text/javascript"> <script type="text/javascript">

View File

@ -2663,55 +2663,47 @@ class Facture extends CommonInvoice
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
if (! empty($this->brouillon)) if (! empty($this->brouillon))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
$this->db->begin(); $this->db->begin();
$product_type=$type; $product_type=$type;
@ -2729,6 +2721,16 @@ class Facture extends CommonInvoice
} }
} }
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker

View File

@ -541,7 +541,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->id; $id = $obj->id;

View File

@ -589,7 +589,7 @@ else
// Localtax // Localtax
print '<td class="nowrap" align="right">'; print '<td class="nowrap" align="right">';
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;; $temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
print price(price2num($temp_vat,'MT'),1); print price(price2num($temp_vat,'MT'),1);
//print price($fields['vat']); //print price($fields['vat']);
print '</td>'; print '</td>';

View File

@ -75,6 +75,8 @@ if (! $sortfield) $sortfield="p.rowid";
$hookmanager->initHooks(array('paymentlist')); $hookmanager->initHooks(array('paymentlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$arrayfields=array();
/* /*
* Actions * Actions
@ -131,7 +133,7 @@ else
$sql.= " p.statut, p.num_paiement,"; $sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code,"; $sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
$sql.= " s.rowid as socid, s.nom as name"; $sql.= " s.rowid as socid, s.nom as name, s.email";
// Add fields for extrafields // Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks // Add fields from hooks
@ -209,8 +211,8 @@ if ($resql)
$i = 0; $i = 0;
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
$param.=(GETPOST("orphelins")?"&orphelins=1":""); $param.=(GETPOST("orphelins")?"&orphelins=1":"");
$param.=($search_ref?"&search_ref=".urlencode($search_ref):""); $param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
$param.=($search_company?"&search_company=".urlencode($search_company):""); $param.=($search_company?"&search_company=".urlencode($search_company):"");
@ -296,11 +298,12 @@ if ($resql)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref;
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
print '</td>'; print '</td>';
@ -311,10 +314,12 @@ if ($resql)
// Thirdparty // Thirdparty
print '<td>'; print '<td>';
if ($objp->socid) if ($objp->socid > 0)
{ {
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->name=$objp->name; $companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print $companystatic->getNomUrl(1,'',24); print $companystatic->getNomUrl(1,'',24);
} }
else print '&nbsp;'; else print '&nbsp;';

View File

@ -63,7 +63,7 @@ $hookmanager->initHooks(array('salarycard','globalcard'));
if ($cancel) if ($cancel)
{ {
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
@ -139,7 +139,7 @@ if ($action == 'add' && empty($cancel))
if ($ret > 0) if ($ret > 0)
{ {
$db->commit(); $db->commit();
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
else else

View File

@ -940,8 +940,8 @@ class Contact extends CommonObject
$error=0; $error=0;
$this->old_lastname = $obj->lastname; //$this->old_lastname = $obj->lastname;
$this->old_firstname = $obj->firstname; //$this->old_firstname = $obj->firstname;
$this->db->begin(); $this->db->begin();

View File

@ -322,6 +322,7 @@ if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email); if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
if (strlen($search_zip)) $sql.= natural_search("p.zip",$search_zip); if (strlen($search_zip)) $sql.= natural_search("p.zip",$search_zip);
if (strlen($search_town)) $sql.= natural_search("p.town",$search_town); if (strlen($search_town)) $sql.= natural_search("p.town",$search_town);
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status); if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key); if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key);
if ($type == "o") // filtre sur type if ($type == "o") // filtre sur type

View File

@ -8,9 +8,9 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1382,7 +1382,9 @@ class Contrat extends CommonObject
$pu_ht=price2num($pu_ht); $pu_ht=price2num($pu_ht);
$pu_ttc=price2num($pu_ttc); $pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht); $pa_ht=price2num($pa_ht);
$txtva=price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1=price2num($txlocaltax1); $txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2); $txlocaltax2=price2num($txlocaltax2);
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
@ -1407,21 +1409,21 @@ class Contrat extends CommonObject
// Check parameters // Check parameters
if (empty($remise_percent)) $remise_percent=0; if (empty($remise_percent)) $remise_percent=0;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
$total_ht = $tabprice[0]; $total_ht = $tabprice[0];
$total_tva = $tabprice[1]; $total_tva = $tabprice[1];

View File

@ -29,7 +29,7 @@ $mesg=array();
$extrasize=GETPOST('size','int'); $extrasize=GETPOST('size','int');
$type=GETPOST('type','alpha'); $type=GETPOST('type','alpha');
$param=GETPOST('param','alpha');; $param=GETPOST('param','alpha');
if ($type=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if ($type=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
if ($type=='date') $extrasize=''; if ($type=='date') $extrasize='';

View File

@ -179,7 +179,7 @@ if ($type == 'directory')
$sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC);
// Right area. If module is defined here, we are in automatic ecm. // Right area. If module is defined here, we are in automatic ecm.
$automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport'); $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday');
// TODO change for multicompany sharing // TODO change for multicompany sharing
// Auto area for suppliers invoices // Auto area for suppliers invoices
@ -210,6 +210,8 @@ if ($type == 'directory')
else if ($module == 'user') $upload_dir = $conf->user->dir_output; else if ($module == 'user') $upload_dir = $conf->user->dir_output;
// Auto area for expense report // Auto area for expense report
else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
// Auto area for holiday
else if ($module == 'holiday') $upload_dir = $conf->holiday->dir_output;
// Automatic list // Automatic list
if (in_array($module, $automodules)) if (in_array($module, $automodules))

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -82,6 +82,9 @@ class box_task extends ModeleBoxes
$totalMnt = 0; $totalMnt = 0;
$totalnb = 0; $totalnb = 0;
$totalDuree=0; $totalDuree=0;
$totalplannedtot=0;
$totaldurationtot=0;
include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php"; include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
$taskstatic=new Task($db); $taskstatic=new Task($db);

View File

@ -1017,7 +1017,6 @@ abstract class CommonDocGenerator
global $hookmanager; global $hookmanager;
$parameters=array( $parameters=array(
'object' => $object,
'curY' => &$curY, 'curY' => &$curY,
'columnText' => $columnText, 'columnText' => $columnText,
'colKey' => $colKey 'colKey' => $colKey

View File

@ -6291,12 +6291,11 @@ abstract class CommonObject
// Load language if required // Load language if required
if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
$colspan='3';
if (is_array($params) && count($params)>0) { if (is_array($params) && count($params)>0) {
if (array_key_exists('colspan',$params)) { if (array_key_exists('colspan',$params)) {
$colspan=$params['colspan']; $colspan=$params['colspan'];
} }
}else {
$colspan='3';
} }
switch($mode) { switch($mode) {

View File

@ -238,7 +238,11 @@ class Conf
{ {
global $mc; global $mc;
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
if ($ret) $mc = new ActionsMulticompany($db); if ($ret)
{
$mc = new ActionsMulticompany($db);
$this->mc = $mc;
}
} }
// Clean some variables // Clean some variables

View File

@ -1108,7 +1108,7 @@ class DolGraph
// Background color // Background color
$color1=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[0],$this->bgcolorgrid[2]); $color1=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[0],$this->bgcolorgrid[2]);
$color2=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[1],$this->bgcolorgrid[2]); $color2=sprintf("%02x%02x%02x",$this->bgcolorgrid[0],$this->bgcolorgrid[1],$this->bgcolorgrid[2]);
$this->stringtoshow.=', grid: { hoverable: true, backgroundColor: { colors: ["#'.$color1.'", "#'.$color2.'"] }, borderWidth: 1, borderColor: \'#eee\', tickColor : \'#f3f3f3\' }'."\n"; $this->stringtoshow.=', grid: { hoverable: true, backgroundColor: { colors: ["#'.$color1.'", "#'.$color2.'"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }'."\n";
//$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this //$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this->stringtoshow.='});'."\n"; $this->stringtoshow.='});'."\n";
$this->stringtoshow.='}'."\n"; $this->stringtoshow.='}'."\n";

View File

@ -18,6 +18,7 @@
* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -6860,10 +6861,10 @@ class Form
$dir=$conf->user->dir_output; $dir=$conf->user->dir_output;
if (! empty($object->photo)) if (! empty($object->photo))
{ {
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini'); if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small'); else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; else $file=get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo;
$originalfile=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo;
} }
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email; $email=$object->email;

View File

@ -332,7 +332,7 @@ class FormActions
// phpcs:enable // phpcs:enable
global $langs,$user,$form,$conf; global $langs,$user,$form,$conf;
if (! is_object($form)) $form=new Form($db); if (! is_object($form)) $form=new Form($this->db);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@ -357,7 +357,7 @@ class FormActions
} }
else else
{ {
$out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', '', 1); $out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200', 1);
} }
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)

View File

@ -66,7 +66,7 @@ class FormBarCode
$disable = ''; $disable = '';
if ($conf->use_javascript_ajax) if (!empty($conf->use_javascript_ajax))
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
@ -87,18 +87,28 @@ class FormBarCode
$disable = 'disabled'; $disable = 'disabled';
} }
$select_encoder = '<form action="'.DOL_URL_ROOT.'/admin/barcode.php" method="post" id="form'.$idForm.'">'; if (!empty($conf->use_javascript_ajax))
$select_encoder.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; {
$select_encoder.= '<input type="hidden" name="action" value="update">'; $select_encoder = '<form action="'.DOL_URL_ROOT.'/admin/barcode.php" method="POST" id="form'.$idForm.'">';
$select_encoder.= '<input type="hidden" name="code_id" value="'.$code_id.'">'; $select_encoder.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$select_encoder.= '<select id="select'.$idForm.'" class="flat" name="coder">'; $select_encoder.= '<input type="hidden" name="action" value="update">';
$select_encoder.= '<input type="hidden" name="code_id" value="'.$code_id.'">';
}
$selectname=(!empty($conf->use_javascript_ajax)?'coder':'coder'.$code_id);
$select_encoder.= '<select id="select'.$idForm.'" class="flat" name="'.$selectname.'">';
$select_encoder.= '<option value="0"'.($selected==0?' selected':'').' '.$disable.'>'.$langs->trans('Disable').'</option>'; $select_encoder.= '<option value="0"'.($selected==0?' selected':'').' '.$disable.'>'.$langs->trans('Disable').'</option>';
$select_encoder.= '<option value="-1" disabled>--------------------</option>'; $select_encoder.= '<option value="-1" disabled>--------------------</option>';
foreach($barcodelist as $key => $value) foreach($barcodelist as $key => $value)
{ {
$select_encoder.= '<option value="'.$key.'"'.($selected==$key?' selected':'').'>'.$value.'</option>'; $select_encoder.= '<option value="'.$key.'"'.($selected==$key?' selected':'').'>'.$value.'</option>';
} }
$select_encoder.= '</select></form>'; $select_encoder.= '</select>';
if (!empty($conf->use_javascript_ajax))
{
$select_encoder.= '</form>';
}
return $select_encoder; return $select_encoder;
} }

View File

@ -1510,6 +1510,11 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$object_instance=new ExpenseReport($this->db); $object_instance=new ExpenseReport($this->db);
} }
else if ($modulepart == 'holiday')
{
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$object_instance=new Holiday($this->db);
}
foreach($filearray as $key => $file) foreach($filearray as $key => $file)
{ {
@ -1539,7 +1544,8 @@ class FormFile
if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');}
if (! $id && ! $ref) continue; if (! $id && ! $ref) continue;
$found=0; $found=0;

View File

@ -342,8 +342,7 @@ class FormMail extends Form
$model_id=$this->param["models_id"]; $model_id=$this->param["models_id"];
} }
// we set -1 if model_id empty $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); // If $model_id is empty, preselect the first one
$arraydefaultmessage = $this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, ($model_id ? $model_id : -1));
} }
// Define list of attached files // Define list of attached files

View File

@ -189,7 +189,7 @@ class Translate
// Load $this->tab_translate[] from database // Load $this->tab_translate[] from database
if (empty($loadfromfileonly) && count($this->tab_translate) == 0) $this->loadFromDatabase($db); // Nothing was loaded yet, so we load database. if (empty($loadfromfileonly) && count($this->tab_translate) == 0) $this->loadFromDatabase($db); // No translation was never loaded yet, so we load database.
$newdomain = $domain; $newdomain = $domain;
@ -231,7 +231,8 @@ class Translate
$filelangexists=is_file($file_lang_osencoded); $filelangexists=is_file($file_lang_osencoded);
//dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' newdomain='.$domain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists); //dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists);
//print 'Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' this->_tab_loaded[newdomain]='.$this->_tab_loaded[$newdomain].' file_lang='.$file_lang." => filelangexists=".$filelangexists."\n";
if ($filelangexists) if ($filelangexists)
{ {
@ -354,12 +355,12 @@ class Translate
$this->load($domain,$alt+1,$stopafterdirection,$langofdir); $this->load($domain,$alt+1,$stopafterdirection,$langofdir);
} }
// We already are the reference file. No more files to scan to complete. // We are in the pass of the reference file. No more files to scan to complete.
if ($alt == 2) if ($alt == 2)
{ {
if ($fileread) $this->_tab_loaded[$newdomain]=1; // Set domain file as loaded if ($fileread) $this->_tab_loaded[$newdomain]=1; // Set domain file as found so loaded
if (empty($this->_tab_loaded[$newdomain])) $this->_tab_loaded[$newdomain]=2; // Set this file as found if (empty($this->_tab_loaded[$newdomain])) $this->_tab_loaded[$newdomain]=2; // Set this file as not found
} }
// This part is deprecated and replaced with table llx_overwrite_trans // This part is deprecated and replaced with table llx_overwrite_trans
@ -410,22 +411,18 @@ class Translate
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang); //dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
$newdomain = $domain; $newdomain = $domain;
$modulename = '';
// Check cache // Check cache
if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain 'database'
{ {
//dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain);
return 0; return 0;
} }
$this->_tab_loaded[$newdomain] = 1; // We want to be sure this function is called once only. $this->_tab_loaded[$newdomain] = 1; // We want to be sure this function is called once only for domain 'database'
$fileread=0; $fileread=0;
$langofdir=(empty($forcelangdir)?$this->defaultlang:$forcelangdir); $langofdir=$this->defaultlang;
// Redefine alt
$alt=2;
if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir
{ {
@ -434,14 +431,14 @@ class Translate
} }
// TODO Move cache read out of loop on dirs or at least filelangexists // TODO Move cache read out of loop on dirs or at least filelangexists
$found=false; $found=false;
// Enable caching of lang file in memory (not by default) // Enable caching of lang file in memory (not by default)
$usecachekey=''; $usecachekey='';
// Using a memcached server // Using a memcached server
if (! empty($conf->memcached->enabled) && ! empty($conf->global->MEMCACHED_SERVER)) if (! empty($conf->memcached->enabled) && ! empty($conf->global->MEMCACHED_SERVER))
{ {
$usecachekey=$newdomain.'_'.$langofdir.'_'.md5($file_lang); // Should not contains special chars $usecachekey=$newdomain.'_'.$langofdir; // Should not contains special chars
} }
// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
else if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) else if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
@ -46,33 +46,33 @@ else header('Cache-Control: no-cache');
// Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8) // Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
$tradMonths=array( $tradMonths=array(
dol_escape_js($langs->transnoentitiesnoconv("January")), dol_escape_js($langs->transnoentitiesnoconv("Month01")),
dol_escape_js($langs->transnoentitiesnoconv("February")), dol_escape_js($langs->transnoentitiesnoconv("Month02")),
dol_escape_js($langs->transnoentitiesnoconv("March")), dol_escape_js($langs->transnoentitiesnoconv("Month03")),
dol_escape_js($langs->transnoentitiesnoconv("April")), dol_escape_js($langs->transnoentitiesnoconv("Month04")),
dol_escape_js($langs->transnoentitiesnoconv("May")), dol_escape_js($langs->transnoentitiesnoconv("Month05")),
dol_escape_js($langs->transnoentitiesnoconv("June")), dol_escape_js($langs->transnoentitiesnoconv("Month06")),
dol_escape_js($langs->transnoentitiesnoconv("July")), dol_escape_js($langs->transnoentitiesnoconv("Month07")),
dol_escape_js($langs->transnoentitiesnoconv("August")), dol_escape_js($langs->transnoentitiesnoconv("Month08")),
dol_escape_js($langs->transnoentitiesnoconv("September")), dol_escape_js($langs->transnoentitiesnoconv("Month09")),
dol_escape_js($langs->transnoentitiesnoconv("October")), dol_escape_js($langs->transnoentitiesnoconv("Month10")),
dol_escape_js($langs->transnoentitiesnoconv("November")), dol_escape_js($langs->transnoentitiesnoconv("Month11")),
dol_escape_js($langs->transnoentitiesnoconv("December")) dol_escape_js($langs->transnoentitiesnoconv("Month12"))
); );
$tradMonthsShort=array( $tradMonthsShort=array(
$langs->trans("JanuaryMin"), $langs->trans("MonthShort01"),
$langs->trans("FebruaryMin"), $langs->trans("MonthShort02"),
$langs->trans("MarchMin"), $langs->trans("MonthShort03"),
$langs->trans("AprilMin"), $langs->trans("MonthShort04"),
$langs->trans("MayMin"), $langs->trans("MonthShort05"),
$langs->trans("JuneMin"), $langs->trans("MonthShort06"),
$langs->trans("JulyMin"), $langs->trans("MonthShort07"),
$langs->trans("AugustMin"), $langs->trans("MonthShort08"),
$langs->trans("SeptemberMin"), $langs->trans("MonthShort09"),
$langs->trans("OctoberMin"), $langs->trans("MonthShort10"),
$langs->trans("NovemberMin"), $langs->trans("MonthShort11"),
$langs->trans("DecemberMin") $langs->trans("MonthShort12")
); );
$tradDays=array( $tradDays=array(

View File

@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
// select2 disabled for smartphones with standard browser. // select2 disabled for smartphones with standard browser.
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array) // TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
if ($conf->browser->layout == 'phone') return ''; if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone') return '';
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->use_javascript_ajax)) return '';

View File

@ -1317,8 +1317,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (! empty($conf->agenda->enabled)) if (! empty($conf->agenda->enabled))
{ {
// Recherche histo sur actioncomm // Recherche histo sur actioncomm
$sql = "SELECT a.id, a.label,"; if (is_object($objcon) && $objcon->id) {
$sql.= " a.datep as dp,"; $sql = "SELECT DISTINCT a.id, a.label,";
}
else
{
$sql = "SELECT a.id, a.label,";
}
$sql.= " a.datep as dp,";
$sql.= " a.datep2 as dp2,"; $sql.= " a.datep2 as dp2,";
$sql.= " a.note, a.percent,"; $sql.= " a.note, a.percent,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype,";
@ -1332,7 +1338,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (is_object($objcon) && $objcon->id) {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
}
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
$sql.= " ON er.resource_type = 'dolresource'"; $sql.= " ON er.resource_type = 'dolresource'";
@ -1344,7 +1355,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{ {
@ -1361,8 +1372,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
//TODO check how ot work with new table actioncomm_resources and multiple contact affectation
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id; // Work with new table actioncomm_resources and multiple contact affectation.
if (is_object($objcon) && $objcon->id)
{
$sql.= " AND r.element_type = '" . $objcon->table_element . "'" .
" AND r.fk_element = " . $objcon->id;
}
// Condition on actioncode // Condition on actioncode
if (! empty($actioncode)) if (! empty($actioncode))
{ {
@ -1386,6 +1403,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
//TODO Add limit for thirdparty in contexte very all result
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -2675,7 +2675,7 @@ function dol_print_ip($ip,$mode=0)
*/ */
function getUserRemoteIP() function getUserRemoteIP()
{ {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']?$_SERVER['HTTP_X_FORWARDED_FOR']:(($_SERVER['HTTP_CLIENT_IP']?$_SERVER['HTTP_CLIENT_IP']:$_SERVER['REMOTE_ADDR'])); $ip = empty($_SERVER['HTTP_X_FORWARDED_FOR'])? (empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']):$_SERVER['HTTP_CLIENT_IP']) : $_SERVER['HTTP_X_FORWARDED_FOR'];
return $ip; return $ip;
} }
@ -4816,7 +4816,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
{ {
$vatratecleaned = $vatrate; $vatratecleaned = $vatrate;
$vatratecode = ''; $vatratecode = '';
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
{ {
$vatratecleaned = $reg[1]; $vatratecleaned = $reg[1];
$vatratecode = $reg[2]; $vatratecode = $reg[2];
@ -6954,7 +6954,6 @@ function getLanguageCodeFromCountryCode($countrycode)
'sv-FI', 'sv-FI',
'sv-SE', 'sv-SE',
'sw-KE', 'sw-KE',
'syr-SY',
'ta-IN', 'ta-IN',
'te-IN', 'te-IN',
'th-TH', 'th-TH',

View File

@ -1868,6 +1868,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null) function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
{ {
if (empty($hookmanager)) global $hookmanager; if (empty($hookmanager)) global $hookmanager;
global $conf;
$reshook=0; $reshook=0;
$result=''; $result='';

View File

@ -91,7 +91,7 @@ function report_header($reportname,$notused,$period,$periodlink,$description,$bu
print '<td>'.$langs->trans("ReportPeriod").'</td>'; print '<td>'.$langs->trans("ReportPeriod").'</td>';
print '<td>'; print '<td>';
if ($period) print $period; if ($period) print $period;
if ($variante) print '<td>'.$periodlink.'</td>'; if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -142,7 +142,7 @@ function dol_hash($chain, $type='0')
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function. * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function.
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
* *
* @param string $chain String to hash * @param string $chain String to hash (not hashed string)
* @param string $hash hash to compare * @param string $hash hash to compare
* @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @return bool True if the computed hash is the same as the given one * @return bool True if the computed hash is the same as the given one

View File

@ -822,22 +822,22 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) if ($edit)
{ {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb'; if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' '; print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
} }
else else
{ {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb'; if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
if ($color) if ($color)
{ {
if ($color != 'edf4fb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default"); else print $langs->trans("Default");
} }
else print $langs->trans("None"); else print $langs->trans("None");
} }
print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>edf4fb</strong>) '; print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '</span>'; print '</span>';
print '</td>'; print '</td>';
@ -866,22 +866,22 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) if ($edit)
{ {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb'; if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
} }
else else
{ {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb'; if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
if ($color) if ($color)
{ {
if ($color != 'ffefbb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">'; if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default"); else print $langs->trans("Default");
} }
else print $langs->trans("None"); else print $langs->trans("None");
} }
print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>ffefbb</strong>) '; print ' &nbsp; <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '</span>'; print '</span>';
print '</td>'; print '</td>';

View File

@ -35,6 +35,8 @@
*/ */
function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0) function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
{ {
$nbrep = 0;
// Replace php code. Note $content may come from database and does not contains body tags. // Replace php code. Note $content may come from database and does not contains body tags.
$replacewith='...php...'; $replacewith='...php...';
if ($removephppart) $replacewith=''; if ($removephppart) $replacewith='';
@ -59,7 +61,12 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
//$replacewith='<span class="phptag">...php...</span>'; //$replacewith='<span class="phptag">...php...</span>';
$replacewith='<span class="phptag">...php...</span>'; $replacewith='<span class="phptag">...php...</span>';
if ($removephppart) $replacewith=''; if ($removephppart) $replacewith='';
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); //$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
/*if ($content === null) {
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
}*/
$content = dolStripPhpCode($content, $replacewith);
//var_dump($content);
// Replace relative link / with dolibarr URL // Replace relative link / with dolibarr URL
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep); $content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
@ -88,6 +95,45 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
} }
/**
* Remove PHP code part from a string.
*
* @param string $str String to clean
* @param string $replacewith String to use as replacement
* @return string Result string without php code
*/
function dolStripPhpCode($str, $replacewith='')
{
$newstr = '';
//split on each opening tag
$parts = explode('<?php',$str);
if (!empty($parts))
{
$i=0;
foreach($parts as $part)
{
if ($i == 0) // The first part is never php code
{
$i++;
$newstr .= $part;
continue;
}
//split on closing tag
$partlings = explode('?>', $part);
if (!empty($partlings))
{
//remove content before closing tag
if (count($partlings) > 1) $partlings[0] = '';
//append to out string
$newstr .= $replacewith.implode('',$partlings);
}
}
}
return $newstr;
}
/** /**
* Render a string of an HTML content and output it. * Render a string of an HTML content and output it.
* Used to ouput the page when viewed from server (Dolibarr or Apache). * Used to ouput the page when viewed from server (Dolibarr or Apache).

View File

@ -6,6 +6,7 @@
* Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2011 Fabrice CHERRIER
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -357,10 +358,43 @@ class pdf_strato extends ModelePDFContract
$txt.=$outputlangs->transnoentities("DateStartRealShort")." : <strong>".$daters.'</strong>'; $txt.=$outputlangs->transnoentities("DateStartRealShort")." : <strong>".$daters.'</strong>';
if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : '<strong>'".$datere.'</strong>'; if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : '<strong>'".$datere.'</strong>';
$pdf->startTransaction();
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0);
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
}
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$nexY = $pdf->GetY() + 2; $nexY = $pdf->GetY() + 2;
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore); $pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute); $pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
@ -378,26 +412,27 @@ class pdf_strato extends ModelePDFContract
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
if ($pagenb == 1) if ($pagenb == 1)
{ {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
} }
else else
{ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1);
} }
$this->_pagefoot($pdf,$object,$outputlangs,1); $this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
} }
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{ {
if ($pagenb == 1) if ($pagenb == 1)
{ {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
} }
else else
{ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1);
} }
$this->_pagefoot($pdf,$object,$outputlangs,1); $this->_pagefoot($pdf,$object,$outputlangs,1);
// New page // New page
@ -412,11 +447,13 @@ class pdf_strato extends ModelePDFContract
if ($pagenb == 1) if ($pagenb == 1)
{ {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->tabSignature($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1;
} }
else else
{ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->tabSignature($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1;
} }
@ -506,25 +543,34 @@ class pdf_strato extends ModelePDFContract
*/ */
// Output Rect // Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3); // Rect prend une longueur en 3eme param et 4eme param
}
if (empty($hidebottom)) /**
{ * Show footer signature of page
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2); * @param PDF $pdf Object PDF
$posy = $tab_top + $tab_height + 3 + 3; * @param int $tab_top tab height position
* @param int $tab_height tab height
* @param Translate $outputlangs Object language for output
* @return void
*/
private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
{
$pdf->SetDrawColor(128,128,128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
$posy = $tab_top + $tab_height + 3 + 3;
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0); $pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
$pdf->SetXY($this->marge_gauche, $posy + 5); $pdf->SetXY($this->marge_gauche, $posy + 5);
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 20, '', 1); $pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 20, '', 1);
$pdf->SetXY($posmiddle + 5, $posy); $pdf->SetXY($posmiddle + 5, $posy);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0); $pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
$pdf->SetXY($posmiddle + 5, $posy + 5); $pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1); $pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
}
} }
/** /**

View File

@ -289,9 +289,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
dol_mkdir($conf->expedition->dir_temp); dol_mkdir($conf->expedition->dir_temp);
// If BILLING contact defined on invoice, we use it // If SHIPMENT contact defined on invoice, we use it
$usecontact=false; $usecontact=false;
$arrayidcontact=$object->getIdContact('external','BILLING'); $arrayidcontact=$object->getIdContact('external','SHIPPING');
if (count($arrayidcontact) > 0) if (count($arrayidcontact) > 0)
{ {
$usecontact=true; $usecontact=true;
@ -299,24 +299,27 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
} }
// Recipient name // Recipient name
if (! empty($usecontact)) $contactobject = null;
{ if (! empty($usecontact)) {
// On peut utiliser le nom de la societe du contact // On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))
else $socobject = $object->thirdparty; $socobject = $object->contact;
} else {
else $socobject = $object->thirdparty;
{ // if we have a SHIIPPING contact and we dont use it as recipient we store the contact object for later use
$socobject=$object->thirdparty; $contactobject = $object->contact;
}
} else {
$socobject = $object->thirdparty;
} }
// Make substitution // Make substitution
$substitutionarray=array( $substitutionarray=array(
'__FROM_NAME__' => $this->emetteur->name, '__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email, '__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht, '__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat '__TOTAL_VAT__' => $object->total_vat
); );
complete_substitutions_array($substitutionarray, $langs, $object); complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
@ -430,6 +433,29 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
dol_syslog($e->getMessage(), LOG_INFO); dol_syslog($e->getMessage(), LOG_INFO);
} }
} }
if ($usecontact && is_object($contactobject)) {
$tmparray=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
foreach($tmparray as $key=>$value)
{
try {
if (preg_match('/logo$/',$key)) // Image
{
if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
else // Text
{
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
}
// Replace tags of object + external modules // Replace tags of object + external modules
$tmparray=$this->get_substitutionarray_shipment($object,$outputlangs); $tmparray=$this->get_substitutionarray_shipment($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object); complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -300,20 +300,18 @@ class doc_generic_invoice_odt extends ModelePDFFactures
} }
// Recipient name // Recipient name
$contactobject=null; $contactobject = null;
if (! empty($usecontact)) if (! empty($usecontact)) {
{
// On peut utiliser le nom de la societe du contact // On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))
$socobject = $object->contact;
else { else {
$socobject = $object->thirdparty; $socobject = $object->thirdparty;
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use // if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact; $contactobject = $object->contact;
} }
} } else {
else $socobject = $object->thirdparty;
{
$socobject=$object->thirdparty;
} }
// Fetch info for linked propal // Fetch info for linked propal

View File

@ -80,7 +80,7 @@ class modAccounting extends DolibarrModules
"MAIN_COMPANY_CODE_ALWAYS_REQUIRED", "MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
"chaine", "chaine",
"1", "1",
"With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 0 "With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 1
); );
$this->const[2] = array( $this->const[2] = array(
"MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED", "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",

View File

@ -323,7 +323,7 @@ class modAdherent extends DolibarrModules
'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription' 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'
); );
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -97,7 +97,7 @@ class modCashDesk extends DolibarrModules
// This is to declare the Top Menu entry: // This is to declare the Top Menu entry:
$this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
'type'=>'top', // This is a Top menu entry 'type'=>'top', // This is a Top menu entry
'titre'=>'CashDeskMenu', 'titre'=>'PointOfSaleShort',
'mainmenu'=>'cashdesk', 'mainmenu'=>'cashdesk',
'url'=>'/cashdesk/index.php?user=__LOGIN__', 'url'=>'/cashdesk/index.php?user=__LOGIN__',
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.

View File

@ -91,7 +91,7 @@ class modDav extends DolibarrModules
$this->requiredby = array(); // List of module ids to disable if this one is disabled $this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->langfiles = array("admin"); $this->langfiles = array("admin");
$this->phpmin = array(5,4); // Minimum version of PHP required by module $this->phpmin = array(5,6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)

View File

@ -317,7 +317,7 @@ class modProduct extends DolibarrModules
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
// Add extra fields // Add extra fields
$import_extrafield_sample=array(); $import_extrafield_sample=array();
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')'; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -278,7 +278,7 @@ class modProjet extends DolibarrModules
$this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation"); $this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation");
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -265,7 +265,7 @@ class modResource extends DolibarrModules
$this->import_tables_array[$r]=array('r'=>MAIN_DB_PREFIX.'resource','extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r]=array('r'=>MAIN_DB_PREFIX.'resource','extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('r.ref'=>"ResourceFormLabel_ref*",'r.fk_code_type_resource'=>'ResourceTypeCode','r.description'=>'ResourceFormLabel_description','r.note_private'=>"NotePrivate",'r.note_public'=>"NotePublic",'r.asset_number'=>'AssetNumber','r.datec'=>'DateCreation'); $this->import_fields_array[$r]=array('r.ref'=>"ResourceFormLabel_ref*",'r.fk_code_type_resource'=>'ResourceTypeCode','r.description'=>'ResourceFormLabel_description','r.note_private'=>"NotePrivate",'r.note_public'=>"NotePublic",'r.asset_number'=>'AssetNumber','r.datec'=>'DateCreation');
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -255,7 +255,7 @@ class modService extends DolibarrModules
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -395,7 +395,7 @@ class modSociete extends DolibarrModules
's.barcode'=>'BarCode','s.datec'=>"DateCreation" 's.barcode'=>'BarCode','s.datec'=>"DateCreation"
); );
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {
@ -441,11 +441,11 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array( $this->import_fields_array[$r]=array(
's.fk_soc'=>'ThirdPartyName','s.civility'=>'UserTitle','s.lastname'=>"Lastname*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip", 's.fk_soc'=>'ThirdPartyName','s.civility'=>'UserTitle','s.lastname'=>"Lastname*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",
's.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso", 's.town'=>"Town",'s.fk_departement'=>"StateId",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",
's.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation" 's.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation"
); );
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {
@ -461,7 +461,7 @@ class modSociete extends DolibarrModules
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
's.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), 's.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
's.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'), 's.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'), 's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
); );
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); $this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
@ -480,11 +480,14 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib'); $this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib');
$this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank", $this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank",
'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*", 'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*",
'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default' 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default',
'sr.fk_departement'=>"StateId",'sr.fk_pays'=>"CountryCode"
); );
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
'sr.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
'sr.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
); );
$this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING", $this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING",
'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333", 'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333",

View File

@ -102,7 +102,7 @@ class modTakePos extends DolibarrModules
$this->requiredby = array(); // List of module ids to disable if this one is disabled $this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->langfiles = array("cashdesk"); $this->langfiles = array("cashdesk");
$this->phpmin = array(5,43); // Minimum version of PHP required by module $this->phpmin = array(5,4); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
@ -226,7 +226,7 @@ class modTakePos extends DolibarrModules
/* BEGIN MODULEBUILDER TOPMENU */ /* BEGIN MODULEBUILDER TOPMENU */
$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode $this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top', // This is a Top menu entry 'type'=>'top', // This is a Top menu entry
'titre'=>'PointOfSale', 'titre'=>'PointOfSaleShort',
'mainmenu'=>'takepos', 'mainmenu'=>'takepos',
'leftmenu'=>'', 'leftmenu'=>'',
'url'=>'/takepos/takepos.php', 'url'=>'/takepos/takepos.php',

View File

@ -261,7 +261,7 @@ class modUser extends DolibarrModules
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation" 'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
); );
// Add extra fields // Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity = ".$conf->entity; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -167,7 +167,7 @@ class modWebsite extends DolibarrModules
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyDirectory',$src,$dest); $this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest);
return 0; return 0;
} }
} }

View File

@ -796,7 +796,7 @@ class doc_generic_project_odt extends ModelePDFProjects
if (!empty($row['thm'])) { if (!empty($row['thm'])) {
$row['amountht']=($row['task_duration'] / 3600) * $row['thm']; $row['amountht']=($row['task_duration'] / 3600) * $row['thm'];
$defaultvat = get_default_tva($mysoc, $mysoc); $defaultvat = get_default_tva($mysoc, $mysoc);
$row['amountttc']=price2num($row['amountht'] * (1 + ($defaultvat / 100)),'MT');; $row['amountttc']=price2num($row['amountht'] * (1 + ($defaultvat / 100)),'MT');
} else { } else {
$row['amountht']=0; $row['amountht']=0;
$row['amountttc']=0; $row['amountttc']=0;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2015-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -191,10 +191,11 @@ class pdf_beluga extends ModelePDFProjects
// Complete object by loading several other informations // Complete object by loading several other informations
$task = new Task($this->db); $task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id); $tasksarray = array();
$tasksarray = $task->getTasksArray(0, 0, $object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines // Special case when used with object = specimen, we may return all lines
{ if (! $object->id > 0) {
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr> * Copyright (C) 2015-2018 Charlene BENKE <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -346,7 +346,7 @@ class pdf_paiement
*/ */
function _pagehead(&$pdf, $page, $showaddress, $outputlangs) function _pagehead(&$pdf, $page, $showaddress, $outputlangs)
{ {
global $langs; global $langs, $conf;
// Do not add the BACKGROUND as this is a report // Do not add the BACKGROUND as this is a report
//pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);

View File

@ -150,7 +150,7 @@ class pdf_stdmovement extends ModelePDFMovement
// Define position of columns // Define position of columns
$this->wref = 15; $this->wref = 15;
$this->posxidref = $this->marge_gauche; $this->posxidref = $this->marge_gauche;
$this->posxdatemouv = $this->marge_gauche+8;; $this->posxdatemouv = $this->marge_gauche+8;
$this->posxdesc=37; $this->posxdesc=37;
$this->posxlabel=50; $this->posxlabel=50;
$this->posxtva=80; $this->posxtva=80;

View File

@ -129,7 +129,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'"'.($cols?' colspan="'.$cols.'"':'').'>'; print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>';
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime')))

View File

@ -143,6 +143,8 @@ if ($action == 'delete_section')
if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
{ {
$langs->load("ecm");
print '<table width="100%" class="liste noborderbottom">'."\n"; print '<table width="100%" class="liste noborderbottom">'."\n";
print '<!-- Title for manual directories -->'."\n"; print '<!-- Title for manual directories -->'."\n";

View File

@ -227,6 +227,7 @@ if ($action=='activate')
if ($action=='inactive') if ($action=='inactive')
{ {
$object->status=0; $object->status=0;
$object->processing=0;
// Add cron task // Add cron task
$result = $object->update($user); $result = $object->update($user);

View File

@ -1068,8 +1068,9 @@ class Cronjob extends CommonObject
// Load langs // Load langs
if (! $error) if (! $error)
{ {
$result=$langs->load($this->module_name.'@'.$this->module_name); $result=$langs->load($this->module_name);
if ($result < 0) $result=$langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing
if ($result < 0) // If technical error
{ {
dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR);
$this->error = $langs->error; $this->error = $langs->error;
@ -1138,14 +1139,17 @@ class Cronjob extends CommonObject
$conf->entity = $savcurrententity; $conf->entity = $savcurrententity;
return -1; return -1;
} }
// Load langs // Load langs
$result=$langs->load($this->module_name . '@' . $this->module_name); $result=$langs->load($this->module_name);
if ($result<0) $result=$langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing
if ($result < 0) // If technical error
{ {
dol_syslog(get_class($this) . "::run_jobs Cannot load module langs" . $langs->error, LOG_ERR); dol_syslog(get_class($this) . "::run_jobs Cannot load module langs" . $langs->error, LOG_ERR);
$conf->entity = $savcurrententity; $conf->entity = $savcurrententity;
return -1; return -1;
} }
dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG); dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG);
$params_arr = explode(", ", $this->params); $params_arr = explode(", ", $this->params);
if (!is_array($params_arr)) if (!is_array($params_arr))
@ -1301,7 +1305,7 @@ class Cronjob extends CommonObject
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {
return $this->LibStatut($this->status,$mode); return $this->LibStatut($this->status, $mode, $this->processing);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@ -1310,43 +1314,47 @@ class Cronjob extends CommonObject
* *
* @param int $status Id statut * @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $processing 0=Not running, 1=Running
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($status,$mode=0) function LibStatut($status, $mode=0, $processing=0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load('users'); $langs->load('users');
$moretext = '';
if ($processing) $moretext=' ('.$langs->trans("Running").')';
if ($mode == 0) if ($mode == 0)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled').$moretext;
elseif ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled').$moretext;
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled').$moretext;
elseif ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled').$moretext;
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled').$moretext;
elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled').$moretext;
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); if ($status == 1) return img_picto($langs->trans('Enabled').$moretext,'statut4','class="pictostatus"');
elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); elseif ($status == 0) return img_picto($langs->trans('Disabled').$moretext,'statut5','class="pictostatus"');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled').$moretext,'statut4','class="pictostatus"').' '.$langs->trans('Enabled').$moretext;
elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled').$moretext,'statut5','class="pictostatus"').' '.$langs->trans('Disabled').$moretext;
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext,'statut4','class="pictostatus"');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext,'statut5','class="pictostatus"');
} }
} }
} }

View File

@ -711,8 +711,20 @@ class Don extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /**
/** * Validate a intervention
*
* @param User $user User that validate
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function setValid($user, $notrigger=0)
{
return $this->valid_promesse($this->id, $user->id, $notrigger);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Validate a promise of donation * Validate a promise of donation
* *
* @param int $id id of donation * @param int $id id of donation
@ -720,9 +732,9 @@ class Don extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function valid_promesse($id, $userid, $notrigger=0) function valid_promesse($id, $userid, $notrigger=0)
{ {
// phpcs:enable // phpcs:enable
global $langs, $user; global $langs, $user;
$error=0; $error=0;

View File

@ -331,6 +331,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED))
if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); }
if (! empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); } if (! empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); }
if (! empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); }
$rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers"));
} }

View File

@ -96,7 +96,7 @@ class EmailCollector extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1),
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'),
'user' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myacount@gmail.com'), 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myacount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password"), 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password"),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
@ -161,7 +161,7 @@ class EmailCollector extends CommonObject
public $host; public $host;
public $user; public $login;
public $password; public $password;
public $source_directory; public $source_directory;
public $target_directory; public $target_directory;
@ -829,7 +829,7 @@ class EmailCollector extends CommonObject
$this->error=$langs->trans('ErrorFieldRequired', 'EMailHost'); $this->error=$langs->trans('ErrorFieldRequired', 'EMailHost');
return -1; return -1;
} }
if (empty($this->user)) if (empty($this->login))
{ {
$this->error=$langs->trans('ErrorFieldRequired', 'Login'); $this->error=$langs->trans('ErrorFieldRequired', 'Login');
return -1; return -1;
@ -855,7 +855,7 @@ class EmailCollector extends CommonObject
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connection = imap_open($connectstringsource, $this->user, $this->password); $connection = imap_open($connectstringsource, $this->login, $this->password);
if (! $connection) if (! $connection)
{ {
$this->error = 'Failed to open IMAP connection '.$connectstringsource; $this->error = 'Failed to open IMAP connection '.$connectstringsource;

View File

@ -83,7 +83,7 @@ class EmailCollectorAction extends CommonObject
*/ */
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollecotr.rowid'), 'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollector.rowid'),
'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1), 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1),
'actionparam' => array('type'=>'varchar(255)', 'label'=>'ParamForAction', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>-1), 'actionparam' => array('type'=>'varchar(255)', 'label'=>'ParamForAction', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>-1),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),

View File

@ -289,7 +289,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
// Actions on extra fields // Actions on extra fields
$result = $object->insertExtraFields('FICHINTER_MODIFY'); $result = $object->insertExtraFields('EXPENSEREPORT_MODIFY');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1,10 +1,10 @@
<?php <?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -459,7 +459,7 @@ class ExpenseReport extends CommonObject
$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime) $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime)
$sql.= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql.= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
$sql.= " d.fk_user_valid, d.fk_user_approve,"; $sql.= " d.fk_user_valid, d.fk_user_approve,";
$sql.= " d.fk_statut as status, d.fk_c_paiement,"; $sql.= " d.fk_statut as status, d.fk_c_paiement, d.paid,";
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement $sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id";
@ -1692,27 +1692,32 @@ class ExpenseReport extends CommonObject
*/ */
function addline($qty=0, $up=0, $fk_c_type_fees=0, $vatrate=0, $date='', $comments='', $fk_project=0, $fk_c_exp_tax_cat=0, $type=0) function addline($qty=0, $up=0, $fk_c_type_fees=0, $vatrate=0, $date='', $comments='', $fk_project=0, $fk_c_exp_tax_cat=0, $type=0)
{ {
global $conf,$langs; global $conf,$langs,$mysoc;
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
if (empty($qty)) $qty = 0;
if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0;
if (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) $fk_c_exp_tax_cat = 0;
if (empty($vatrate) || $vatrate < 0) $vatrate = 0;
if (empty($date)) $date = '';
if (empty($fk_project)) $fk_project = 0;
$qty = price2num($qty);
$vatrate = price2num($vatrate);
$up = price2num($up);
if ($this->fk_statut == self::STATUS_DRAFT) if ($this->fk_statut == self::STATUS_DRAFT)
{ {
if (empty($qty)) $qty = 0;
if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0;
if (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) $fk_c_exp_tax_cat = 0;
if (empty($vatrate) || $vatrate < 0) $vatrate = 0;
if (empty($date)) $date = '';
if (empty($fk_project)) $fk_project = 0;
$qty = price2num($qty);
if (!preg_match('/\((.*)\)/', $vatrate)) {
$vatrate = price2num($vatrate); // $txtva can have format '5.0(XXX)' or '5'
}
$up = price2num($up);
$this->db->begin(); $this->db->begin();
$this->line = new ExpenseReportLine($this->db); $this->line = new ExpenseReportLine($this->db);
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc,$this->thirdparty);
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $vatrate, $reg)) if (preg_match('/\((.*)\)/', $vatrate, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
@ -1721,7 +1726,8 @@ class ExpenseReport extends CommonObject
$vatrate = preg_replace('/\*/','',$vatrate); $vatrate = preg_replace('/\*/','',$vatrate);
$seller = ''; // seller is unknown $seller = ''; // seller is unknown
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$this->line->value_unit = $up; $this->line->value_unit = $up;
$this->line->vatrate = price2num($vatrate); $this->line->vatrate = price2num($vatrate);

View File

@ -315,7 +315,6 @@ class Fichinter extends CommonObject
*/ */
function update($user, $notrigger=0) function update($user, $notrigger=0)
{ {
global $conf;
if (! is_numeric($this->duration)) { if (! is_numeric($this->duration)) {
$this->duration = 0; $this->duration = 0;
} }

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('DOL_VERSION')) define('DOL_VERSION','10.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1504,42 +1505,47 @@ class CommandeFournisseur extends CommonOrder
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id"); dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters if ($this->statut == self::STATUS_DRAFT)
if (! $qty) $qty=1; {
if (! $info_bits) $info_bits=0; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($remise_percent)) $remise_percent=0;
$remise_percent=price2num($remise_percent); // Clean parameters
$qty=price2num($qty); if (! $qty) $qty=1;
$pu_ht=price2num($pu_ht); if (! $info_bits) $info_bits=0;
$pu_ht_devise=price2num($pu_ht_devise); if (empty($txtva)) $txtva=0;
$pu_ttc=price2num($pu_ttc); if (empty($txlocaltax1)) $txlocaltax1=0;
$txtva = price2num($txtva); if (empty($txlocaltax2)) $txlocaltax2=0;
$txlocaltax1 = price2num($txlocaltax1); if (empty($remise_percent)) $remise_percent=0;
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT') $remise_percent=price2num($remise_percent);
{ $qty=price2num($qty);
$pu=$pu_ht; $pu_ht=price2num($pu_ht);
} $pu_ht_devise=price2num($pu_ht_devise);
else $pu_ttc=price2num($pu_ttc);
{ if (!preg_match('/\((.*)\)/', $txtva)) {
$pu=$pu_ttc; $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
} }
$desc=trim($desc); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$desc=trim($desc);
// Check parameters
if ($qty < 1 && ! $fk_product)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product"));
return -1;
}
if ($type < 0) return -1;
// Check parameters
if ($qty < 1 && ! $fk_product)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product"));
return -1;
}
if ($type < 0) return -1;
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin(); $this->db->begin();
if ($fk_product > 0) if ($fk_product > 0)
@ -1605,10 +1611,9 @@ class CommandeFournisseur extends CommonOrder
$product_type = $type; $product_type = $type;
} }
// Calcul du total TTC et de la TVA pour la ligne a partir de if ($conf->multicurrency->enabled && $pu_ht_devise > 0) {
// qty, pu, remise_percent et txtva $pu = 0;
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker }
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty); $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty);
@ -1620,9 +1625,10 @@ class CommandeFournisseur extends CommonOrder
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
} }
if ($conf->multicurrency->enabled && $pu_ht_devise > 0) { // Calcul du total TTC et de la TVA pour la ligne a partir de
$pu = 0; // qty, pu, remise_percent et txtva
} // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise);

View File

@ -1564,201 +1564,214 @@ class FactureFournisseur extends CommonInvoice
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters if ($this->statut == self::STATUS_DRAFT)
if (empty($remise_percent)) $remise_percent=0; {
if (empty($qty)) $qty=0; // Clean parameters
if (empty($info_bits)) $info_bits=0; if (empty($remise_percent)) $remise_percent=0;
if (empty($rang)) $rang=0; if (empty($qty)) $qty=0;
if (empty($ventil)) $ventil=0; if (empty($info_bits)) $info_bits=0;
if (empty($txtva)) $txtva=0; if (empty($rang)) $rang=0;
if (empty($txlocaltax1)) $txlocaltax1=0; if (empty($ventil)) $ventil=0;
if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
$this->db->begin(); $remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu=price2num($pu);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
if ($fk_product > 0) $this->db->begin();
{
if (! empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY))
{
// Check quantity is enough
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." qty=".$qty." ref_supplier=".$ref_supplier);
$prod = new Product($this->db, $fk_product);
if ($prod->fetch($fk_product) > 0)
{
$product_type = $prod->type;
$label = $prod->label;
$fk_prod_fourn_price = 0;
// We use 'none' instead of $ref_supplier, because $ref_supplier may not exists anymore. So we will take the first supplier price ok. if ($fk_product > 0)
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price. {
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc if (! empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY))
if ($result > 0) {
{ // Check quantity is enough
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." qty=".$qty." ref_supplier=".$ref_supplier);
$ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice $prod = new Product($this->db, $fk_product);
// is remise percent not keyed but present for the product we add it if ($prod->fetch($fk_product) > 0)
if ($remise_percent == 0 && $prod->remise_percent !=0) {
$remise_percent =$prod->remise_percent; $product_type = $prod->type;
} $label = $prod->label;
if ($result == 0) // If result == 0, we failed to found the supplier reference price $fk_prod_fourn_price = 0;
{
$langs->load("errors"); // We use 'none' instead of $ref_supplier, because $ref_supplier may not exists anymore. So we will take the first supplier price ok.
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); // If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
$this->db->rollback(); $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price"); if ($result > 0)
//$pu = $prod->fourn_pu; // We do not overwrite unit price {
//$ref = $prod->ref_fourn; // We do not overwrite ref supplier price $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
return -1; $ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice
} // is remise percent not keyed but present for the product we add it
if ($result == -1) if ($remise_percent == 0 && $prod->remise_percent !=0)
{ $remise_percent =$prod->remise_percent;
$langs->load("errors"); }
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); if ($result == 0) // If result == 0, we failed to found the supplier reference price
$this->db->rollback(); {
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG); $langs->load("errors");
return -1; $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
} $this->db->rollback();
if ($result < -1) dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price");
{ //$pu = $prod->fourn_pu; // We do not overwrite unit price
$this->error=$prod->error; //$ref = $prod->ref_fourn; // We do not overwrite ref supplier price
$this->db->rollback(); return -1;
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); }
return -1; if ($result == -1)
} {
} $langs->load("errors");
else $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
{ $this->db->rollback();
$this->error=$prod->error; dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
$this->db->rollback(); return -1;
return -1; }
} if ($result < -1)
} {
$this->error=$prod->error;
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR);
return -1;
}
}
else
{
$this->error=$prod->error;
$this->db->rollback();
return -1;
}
}
}
else
{
$product_type = $type;
}
if ($conf->multicurrency->enabled && $pu_ht_devise > 0) {
$pu = 0;
}
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
$pu_ht = $tabprice[3];
// MultiCurrency
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
// Check parameters
if ($type < 0) return -1;
if ($rang < 0)
{
$rangmax = $this->line_max();
$rang = $rangmax + 1;
}
// Insert line
$this->line=new SupplierInvoiceLine($this->db);
$this->line->context = $this->context;
$this->line->fk_facture_fourn=$this->id;
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->ref_supplier=$ref_supplier;
$this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0);
$this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->product_type=$type;
$this->line->remise_percent=$remise_percent;
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
$this->line->ventil=$ventil;
$this->line->rang=$rang;
$this->line->info_bits=$info_bits;
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= $total_tva;
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->special_code=$this->special_code;
$this->line->fk_parent_line=$this->fk_parent_line;
$this->line->origin=$this->origin;
$this->line->origin_id=$origin_id;
$this->line->fk_unit=$fk_unit;
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
$this->line->multicurrency_subprice = $pu_ht_devise;
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_options;
}
$result=$this->line->insert($notrigger);
if ($result > 0)
{
// Reorder if child line
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto',0,$this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();
return $this->line->id;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
else
{
$this->error=$this->line->error;
$this->errors=$this->line->errors;
$this->db->rollback();
return -2;
}
} }
else else
{ {
$product_type = $type; return 0;
}
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu=price2num($pu);
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if ($conf->multicurrency->enabled && $pu_ht_devise > 0) {
$pu = 0;
}
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
$pu_ht = $tabprice[3];
// MultiCurrency
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
// Check parameters
if ($type < 0) return -1;
if ($rang < 0)
{
$rangmax = $this->line_max();
$rang = $rangmax + 1;
}
// Insert line
$this->line=new SupplierInvoiceLine($this->db);
$this->line->context = $this->context;
$this->line->fk_facture_fourn=$this->id;
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->ref_supplier=$ref_supplier;
$this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0);
$this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->product_type=$type;
$this->line->remise_percent=$remise_percent;
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
$this->line->ventil=$ventil;
$this->line->rang=$rang;
$this->line->info_bits=$info_bits;
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva= $total_tva;
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->special_code=$this->special_code;
$this->line->fk_parent_line=$this->fk_parent_line;
$this->line->origin=$this->origin;
$this->line->origin_id=$origin_id;
$this->line->fk_unit=$fk_unit;
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
$this->line->multicurrency_subprice = $pu_ht_devise;
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_options;
}
$result=$this->line->insert($notrigger);
if ($result > 0)
{
// Reorder if child line
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto',0,$this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();
return $this->line->id;
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
else
{
$this->error=$this->line->error;
$this->errors=$this->line->errors;
$this->db->rollback();
return -2;
} }
} }
@ -2022,7 +2035,8 @@ class FactureFournisseur extends CommonInvoice
* Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) * @return array|int Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
* <0 if error
*/ */
function list_replacable_supplier_invoices($socid=0) function list_replacable_supplier_invoices($socid=0)
{ {
@ -2050,9 +2064,11 @@ class FactureFournisseur extends CommonInvoice
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$return[$obj->rowid]=array( 'id' => $obj->rowid, $return[$obj->rowid]=array(
'ref' => $obj->ref, 'id' => $obj->rowid,
'status' => $obj->fk_statut); 'ref' => $obj->ref,
'status' => $obj->fk_statut
);
} }
//print_r($return); //print_r($return);
return $return; return $return;
@ -2071,7 +2087,8 @@ class FactureFournisseur extends CommonInvoice
* (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir * (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) * @return array|int Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
* <0 if error
*/ */
function list_qualified_avoir_supplier_invoices($socid=0) function list_qualified_avoir_supplier_invoices($socid=0)
{ {

View File

@ -612,6 +612,7 @@ class PaiementFourn extends Paiement
$this->ref = 'SPECIMEN'; $this->ref = 'SPECIMEN';
$this->specimen=1; $this->specimen=1;
$this->facid = 1; $this->facid = 1;
$this->socid = 1;
$this->datepaye = $nownotime; $this->datepaye = $nownotime;
} }

View File

@ -608,7 +608,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;

View File

@ -2717,7 +2717,7 @@ else
$paymentstatic->id=$objp->rowid; $paymentstatic->id=$objp->rowid;
$paymentstatic->datepaye=$db->jdate($objp->dp); $paymentstatic->datepaye=$db->jdate($objp->dp);
$paymentstatic->ref=($objp->ref ? $objp->ref : $objp->rowid);; $paymentstatic->ref=($objp->ref ? $objp->ref : $objp->rowid);
$paymentstatic->num_paiement=$objp->num_paiement; $paymentstatic->num_paiement=$objp->num_paiement;
$paymentstatic->payment_code=$objp->payment_code; $paymentstatic->payment_code=$objp->payment_code;

View File

@ -427,7 +427,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->facid; $id = $obj->facid;

View File

@ -32,3 +32,4 @@ INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 8, 'SRC_WOM',
INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 9, 'SRC_PARTNER', 'Partner', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 9, 'SRC_PARTNER', 'Partner', 1);
INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES (10, 'SRC_EMPLOYEE', 'Employee', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES (10, 'SRC_EMPLOYEE', 'Employee', 1);
INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES (11, 'SRC_SPONSORING', 'Sponsorship', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES (11, 'SRC_SPONSORING', 'Sponsorship', 1);
INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES (12, 'SRC_CUSTOMER', 'Incoming contact of a customer', 1);

View File

@ -317,6 +317,7 @@ ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN multicurrency_amount double
ALTER TABLE llx_paiementfourn ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_paiementfourn ADD COLUMN model_pdf varchar(255);
ALTER TABLE llx_paiementfourn ADD COLUMN fk_user_modif integer AFTER fk_user_author;
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);

View File

@ -728,3 +728,5 @@ UPDATE llx_cronjob set entity = 0 where entity = 1 and label in ('PurgeDeleteTem
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL; -- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL;
-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode ALTER COLUMN tracking DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode ALTER COLUMN tracking DROP NOT NULL;
ALTER TABLE llx_paiementfourn ADD COLUMN fk_user_modif integer AFTER fk_user_author;

View File

@ -159,7 +159,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
label varchar(255), label varchar(255),
description text, description text,
host varchar(255), host varchar(255),
user varchar(128), login varchar(128),
password varchar(128), password varchar(128),
source_directory varchar(255) NOT NULL, source_directory varchar(255) NOT NULL,
target_directory varchar(255), target_directory varchar(255),
@ -222,6 +222,6 @@ ALTER TABLE llx_emailcollector_emailcollectoraction ADD CONSTRAINT fk_emailcolle
ALTER TABLE llx_emailcollector_emailcollectorfilter ADD UNIQUE INDEX uk_emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue); ALTER TABLE llx_emailcollector_emailcollectorfilter ADD UNIQUE INDEX uk_emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue);
ALTER TABLE llx_emailcollector_emailcollectoraction ADD UNIQUE INDEX uk_emailcollector_emailcollectoraction (fk_emailcollector, type); ALTER TABLE llx_emailcollector_emailcollectoraction ADD UNIQUE INDEX uk_emailcollector_emailcollectoraction (fk_emailcollector, type);
ALTER TABLE llx_societe_rib ADD COLUMN comment varchar(255);
ALTER TABLE llx_societe_rib ADD COLUMN ipaddress varchar(68);

View File

@ -22,7 +22,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
label varchar(255), label varchar(255),
description text, description text,
host varchar(255), host varchar(255),
user varchar(128), login varchar(128),
password varchar(128), password varchar(128),
source_directory varchar(255) NOT NULL, source_directory varchar(255) NOT NULL,
target_directory varchar(255), target_directory varchar(255),

View File

@ -41,10 +41,12 @@ create table llx_societe_rib
proprio varchar(60), proprio varchar(60),
owner_address varchar(255), owner_address varchar(255),
default_rib smallint NOT NULL DEFAULT 0, default_rib smallint NOT NULL DEFAULT 0,
-- For BAN direct debit feature -- For BAN direct debit feature
rum varchar(32), -- RUM value to use for SEPA generation rum varchar(32), -- RUM value to use for SEPA generation
date_rum date, -- Date of mandate date_rum date, -- Date of mandate
frstrecur varchar(16) default 'FRST', -- 'FRST' or 'RECUR' frstrecur varchar(16) default 'FRST', -- 'FRST' or 'RECUR'
--For credit card --For credit card
last_four varchar(4), -- last 4 last_four varchar(4), -- last 4
card_type varchar(255), -- card type 'VISA', 'MC' , ... card_type varchar(255), -- card type 'VISA', 'MC' , ...
@ -52,6 +54,7 @@ create table llx_societe_rib
exp_date_month INTEGER, exp_date_month INTEGER,
exp_date_year INTEGER, exp_date_year INTEGER,
country_code varchar(10), country_code varchar(10),
--For Paypal --For Paypal
approved INTEGER DEFAULT 0, approved INTEGER DEFAULT 0,
email varchar(255), email varchar(255),
@ -60,9 +63,12 @@ create table llx_societe_rib
preapproval_key varchar(255), preapproval_key varchar(255),
starting_date date, starting_date date,
total_amount_of_all_payments double(24,8), total_amount_of_all_payments double(24,8),
--For Stripe --For Stripe
stripe_card_ref varchar(128), -- 'card_...' stripe_card_ref varchar(128), -- 'card_...'
comment varchar(255),
ipaddress varchar(68),
status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH
import_key varchar(14) -- import key import_key varchar(14) -- import key
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -489,7 +489,6 @@ if (! $error && $db->connected && $action == "set")
'thirdparties' => 'thirdparty', 'thirdparties' => 'thirdparty',
'usergroups' => 'usergroups', 'usergroups' => 'usergroups',
'users' => 'user', 'users' => 'user',
'usergroups' => 'usergroups',
); );
foreach($docs as $cursordir => $cursorfile) foreach($docs as $cursordir => $cursorfile)
{ {

View File

@ -57,6 +57,7 @@ $langs->loadLangs(array("admin", "install"));
$login = GETPOST('login', 'alpha')?GETPOST('login', 'alpha'):(empty($argv[5])?'':$argv[5]); $login = GETPOST('login', 'alpha')?GETPOST('login', 'alpha'):(empty($argv[5])?'':$argv[5]);
$pass = GETPOST('pass', 'alpha')?GETPOST('pass', 'alpha'):(empty($argv[6])?'':$argv[6]); $pass = GETPOST('pass', 'alpha')?GETPOST('pass', 'alpha'):(empty($argv[6])?'':$argv[6]);
$pass_verif = GETPOST('pass_verif', 'alpha')?GETPOST('pass_verif', 'alpha'):(empty($argv[7])?'':$argv[7]); $pass_verif = GETPOST('pass_verif', 'alpha')?GETPOST('pass_verif', 'alpha'):(empty($argv[7])?'':$argv[7]);
$force_install_lockinstall = (int) (! empty($force_install_lockinstall)?$force_install_lockinstall:(GETPOST('installlock','aZ09')?GETPOST('installlock','aZ09'):(empty($argv[8])?'':$argv[8])));
$success=0; $success=0;

View File

@ -446,7 +446,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
$beforeversionarray=explode('.','9.0.9'); $beforeversionarray=explode('.','9.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
//migrate_rename_directories($db,$langs,$conf,'/contracts','/contract'); migrate_user_photospath();
} }
} }
@ -4826,7 +4826,80 @@ function migrate_reload_menu($db,$langs,$conf,$versionto)
} }
} }
/**
* Migrate file from old path to new one for users
*
* @return void
*/
function migrate_user_photospath()
{
global $conf, $db, $langs;
print '<tr><td colspan="4">';
print '<b>'.$langs->trans('MigrationUserPhotoPath')."</b><br>\n";
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$fuser = new User($db);
$sql = "SELECT rowid as uid from ".MAIN_DB_PREFIX."user"; // Get list of all users
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
$fuser->fetch($obj->uid);
//echo '<hr>'.$fuser->id.' -> '.$fuser->entity;
$entity = (!empty($fuser->entity)) ? $fuser->entity : 1;
if ($entity > 1) {
$dir = DOL_DATA_ROOT . '/' . $entity . '/users';
} else {
$dir = $conf->user->multidir_output[$entity]; // $conf->user->multidir_output[] for each entity is construct by the multicompany module
}
$origin = $dir .'/'. get_exdir($fuser->id,2,0,0,$fuser,'user');
$destin = $dir.'/'.$fuser->id;
$error = 0;
$origin_osencoded=dol_osencode($origin);
$destin_osencoded=dol_osencode($destin);
dol_mkdir($destin);
//echo '<hr>'.$origin.' -> '.$destin;
if (dol_is_dir($origin))
{
$handle=opendir($origin_osencoded);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file))
{
$thumbs = opendir($origin_osencoded.'/'.$file);
if (is_resource($thumbs))
{
dol_mkdir($destin.'/'.$file);
while (($thumb = readdir($thumbs)) !== false)
{
dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb);
}
// dol_delete_dir($origin.'/'.$file);
}
}
else
{
if (dol_is_file($origin.'/'.$file) )
{
dol_move($origin.'/'.$file, $destin.'/'.$file);
}
}
}
}
}
}
}
print '</td></tr>';
}
/* A faire egalement: Modif statut paye et fk_facture des factures payes completement /* A faire egalement: Modif statut paye et fk_facture des factures payes completement

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