Merge branch 'develop' into develop_mc

This commit is contained in:
Laurent Destailleur 2018-12-01 15:47:00 +01:00 committed by GitHub
commit 2666a25da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
741 changed files with 63852 additions and 31719 deletions

View File

@ -288,7 +288,8 @@ script:
echo "Checking PHP syntax errors" echo "Checking PHP syntax errors"
# 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/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

106
ChangeLog
View File

@ -5,21 +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
* Change getEntity('invoice') instead getEntity('facture') 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:
@ -28,6 +118,8 @@ Following changes may create regressions for some external modules, but were nec
replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for
modulepart=mycompany that now works like others). modulepart=mycompany that now works like others).
* Hidden option MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT has been renamed into SHIPPING_PDF_DISPLAY_AMOUNT_HT * Hidden option MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT has been renamed into SHIPPING_PDF_DISPLAY_AMOUNT_HT
* Remove the no more used and deprecated dol_print_graph function
***** ChangeLog for 8.0.3 compared to 8.0.2 ***** ***** ChangeLog for 8.0.3 compared to 8.0.2 *****

View File

@ -535,6 +535,8 @@ if ($nboftargetok) {
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
# Removed known external modules to avoid any error when packaging from env where external modules are tested # Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
@ -549,12 +551,14 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nomenclature*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/of/`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
# Removed other test files # Removed other test files

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,6 +171,8 @@ export list="
--ignore-table=$base.llx_abonne_extrafields --ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type --ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement --ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_accountingaccount
--ignore-table=$base.llx_accountingsystem
--ignore-table=$base.llx_advanced_extrafields --ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options --ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values --ignore-table=$base.llx_advanced_extrafields_values

6
htdocs/.gitignore vendored
View File

@ -23,4 +23,8 @@
/cabinetmed* /cabinetmed*
/webmail* /webmail*
/conf/conf.php /conf/conf.php
/subtotal/ /subtotal*
/abricot*
/nomenclature*
/of/
/workstation/

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

@ -266,7 +266,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

@ -78,7 +78,7 @@ class AccountancyCategory // extends CommonObject
public $range_account; public $range_account;
/** /**
* @var mixed Sample property 1 * @var int Sens of the account: 0: credit - debit, 1: debit - credit
*/ */
public $sens; public $sens;
@ -163,16 +163,17 @@ class AccountancyCategory // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid,"; if ($this->rowid > 0) $sql.= "rowid, ";
$sql.= "code,"; $sql.= "code, ";
$sql.= "label,"; $sql.= "label, ";
$sql.= "range_account,"; $sql.= "range_account, ";
$sql.= "sens,"; $sql.= "sens, ";
$sql.= "category_type,"; $sql.= "category_type, ";
$sql.= "formula,"; $sql.= "formula, ";
$sql.= "position,"; $sql.= "position, ";
$sql.= "fk_country,"; $sql.= "fk_country, ";
$sql.= "active"; $sql.= "active, ";
$sql.= "entity";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.","; if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
@ -184,6 +185,7 @@ class AccountancyCategory // extends CommonObject
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).","; $sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).","; $sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active)); $sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ", ".$conf->entity;
$sql.= ")"; $sql.= ")";
$this->db->begin(); $this->db->begin();
@ -237,9 +239,8 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label * @param string $label Label
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$code='',$label='') function fetch($id, $code='', $label='')
{ {
global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.code,"; $sql.= " t.code,";
@ -253,8 +254,12 @@ class AccountancyCategory // extends CommonObject
$sql.= " t.active"; $sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id; if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; else
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'"; {
$sql.= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
if ($code) $sql.= " AND t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " AND t.label = '".$this->db->escape($label)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -480,7 +485,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = = " . $conf->entity . ")"; $sql .= " AND aa.entity = " . $conf->entity . ")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte"; $sql .= " ORDER BY t.numero_compte";
@ -712,49 +717,76 @@ class AccountancyCategory // extends CommonObject
/** /**
* Function to show result of an accounting account from the ledger with a direction and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
* @param int $cpt Id accounting account * @param int|array $cpt Accounting account or array of accounting account
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start * @param string $date_start Date start
* @param string $date_end Date end * @param string $date_end Date end
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @param string $thirdparty_code Thirdparty code * @param string $thirdparty_code Thirdparty code
* @return integer Result in table * @param int $month Specifig month - Can be empty
* @param int $year Specifig year - Can be empty
* @return integer <0 if KO, >= 0 if OK
*/ */
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter') public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code='nofilter', $month=0, $year=0)
{ {
global $conf;
$this->sdc = 0;
$this->sdcpermonth = array();
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) $sql.=", t.numero_compte as accountancy_account";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'"; //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
if (! empty($date_start) && ! empty($date_end)) $sql .= " WHERE t.entity = ".$conf->entity;
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'"; if (is_array($cpt))
if (! empty($month)) { {
$sql .= " AND MONTH(t.doc_date) = " . $month; $listofaccount='';
foreach($cpt as $cptcursor)
{
if ($listofaccount) $listofaccount.=",";
$listofaccount.="'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (" .$listofaccount. ")";
}
else
{
$sql .= " AND t.numero_compte = '" . $this->db->escape($cpt) . "'";
}
if (! empty($date_start) && ! empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')";
if (! empty($month) && ! empty($year)) {
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."')";
} }
if ($thirdparty_code != 'nofilter') if ($thirdparty_code != 'nofilter')
{ {
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'"; $sql .= " AND t.thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
} }
if (is_array($cpt)) $sql.=" GROUP BY t.numero_compte";
//print $sql;
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql)
if ($resql) { {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$this->sdc = 0; if ($num)
if ($num) { {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($sens == 1) { if ($sens == 1) {
$this->sdc = $obj->debit - $obj->credit; $this->sdc = $obj->debit - $obj->credit;
} else { } else {
$this->sdc = $obj->credit - $obj->debit; $this->sdc = $obj->credit - $obj->debit;
} }
if (is_array($cpt))
{
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
}
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
return - 1;
} }
} }
@ -766,7 +798,7 @@ class AccountancyCategory // extends CommonObject
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
global $db, $langs, $user, $mysoc, $conf; global $conf, $mysoc;
if (empty($mysoc->country_id)) { if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
@ -775,7 +807,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 "; $sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity; $sql .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1"; if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
@ -823,7 +855,7 @@ class AccountancyCategory // extends CommonObject
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {
global $mysoc; global $conf, $mysoc;
$sql = ''; $sql = '';
if (empty($mysoc->country_id) && empty($mysoc->country_code)) { if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
@ -836,6 +868,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
else else
@ -843,6 +876,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere; $sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
//echo $sql; //echo $sql;
@ -856,13 +890,12 @@ class AccountancyCategory // extends CommonObject
if ($num) { if ($num) {
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$name_cat = $obj->name_cat;
$data[] = array ( $data[] = array (
'id' => $obj->rowid, 'id' => $obj->rowid,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'account_label' => $obj->account_label, 'account_label' => $obj->account_label,
); );
$i ++; $i++;
} }
} }
return $data; return $data;

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

@ -1142,7 +1142,7 @@ $db->close();
* *
* @param string $val Array of val * @param string $val Array of val
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...) * @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
* @return string|unknown * @return string A string label to describe a record into llx_bank_url
*/ */
function getSourceDocRef($val, $typerecord) function getSourceDocRef($val, $typerecord)
{ {
@ -1250,7 +1250,8 @@ function getSourceDocRef($val, $typerecord)
{ {
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid)
{
while ($objmid = $db->fetch_object($resultmid)) while ($objmid = $db->fetch_object($resultmid))
{ {
$ref.=' '.$objmid->ref; $ref.=' '.$objmid->ref;
@ -1259,6 +1260,6 @@ function getSourceDocRef($val, $typerecord)
else dol_print_error($db); else dol_print_error($db);
} }
$ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 ... i< < than max size of 300 $ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref; return $ref;
} }

View File

@ -2656,7 +2656,7 @@ class Adherent extends CommonObject
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent")); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0; return 0;
} }
$now = dol_now(); $now = dol_now();
$nbok = 0; $nbok = 0;
$nbko = 0; $nbko = 0;
@ -2760,9 +2760,9 @@ class Adherent extends CommonObject
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message); $actionmsg = dol_concatdesc($actionmsg, $message);
} }
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent // Insert record of emails sent
$actioncomm = new ActionComm($this->db); $actioncomm = new ActionComm($this->db);
@ -2787,10 +2787,10 @@ class Adherent extends CommonObject
$actioncomm->email_tobcc = $sendtobcc; $actioncomm->email_tobcc = $sendtobcc;
$actioncomm->email_subject = $subject; $actioncomm->email_subject = $subject;
$actioncomm->errors_to = ''; $actioncomm->errors_to = '';
$actioncomm->fk_element = $adherent->id; $actioncomm->fk_element = $adherent->id;
$actioncomm->elementtype = $adherent->element; $actioncomm->elementtype = $adherent->element;
$actioncomm->extraparams = $extraparams; $actioncomm->extraparams = $extraparams;
$actioncomm->create($user); $actioncomm->create($user);

View File

@ -250,7 +250,7 @@ print '<tr class="liste_titre">';
// Page // Page
$texthelp=$langs->trans("PageUrlForDefaultValues"); $texthelp=$langs->trans("PageUrlForDefaultValues");
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2'); if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2'); else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp); $texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder); print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
// Field // Field
@ -288,8 +288,9 @@ if ($mode != 'focus' && $mode != 'mandatory')
} }
// Entity // Entity
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
else print_liste_field_titre("",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
// Actions // Actions
print '<td align="center"></td>'; print_liste_field_titre("",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";

View File

@ -141,9 +141,11 @@ if (GETPOST('addoperation','alpha'))
{ {
$emailcollectoroperation = new EmailCollectorAction($db); $emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->type = GETPOST('operationtype','az09'); $emailcollectoroperation->type = GETPOST('operationtype','az09');
$emailcollectoroperation->actionparam = GETPOST('actionparam', 'alpha'); $emailcollectoroperation->actionparam = GETPOST('operationparam', 'none');
$emailcollectoroperation->fk_emailcollector = $object->id; $emailcollectoroperation->fk_emailcollector = $object->id;
$emailcollectoroperation->status = 1; $emailcollectoroperation->status = 1;
$emailcollectoroperation->position = 50;
$result = $emailcollectoroperation->create($user); $result = $emailcollectoroperation->create($user);
if ($result > 0) if ($result > 0)
@ -457,9 +459,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div><br>';
// Operations // Operations
print '<table class="border centpercent">'; print '<table id="tablelines" class="noborder noshadow">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td>'; print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td><td></td>';
print '</tr>'; print '</tr>';
// Add operation // Add operation
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -470,15 +472,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td><td>'; print '</td><td>';
print '<input type="text" name="operationparam">'; print '<input type="text" name="operationparam">';
print '</td>'; print '</td>';
print '<td></td>';
print '<td align="right"><input type="submit" name="addoperation" id="addoperation" class="flat button" value="'.$langs->trans("Add").'"></td>'; print '<td align="right"><input type="submit" name="addoperation" id="addoperation" class="flat button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
// List operations // List operations
$nboflines = count($object->actions);
$table_element_line = 'emailcollector_emailcollectoraction';
$fk_element='position';
$i=0;
foreach($object->actions as $ruleaction) foreach($object->actions as $ruleaction)
{ {
$ruleactionobj=new EmailcollectorAction($db); $ruleactionobj=new EmailcollectorAction($db);
$ruleactionobj->fetch($ruleaction['id']); $ruleactionobj->fetch($ruleaction['id']);
print '<tr class="oddeven">'; print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$ruleaction['type']]); print $langs->trans($arrayoftypes[$ruleaction['type']]);
print '</td>'; print '</td>';
@ -487,12 +494,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//print $ruleactionobj->getLibStatut(3); //print $ruleactionobj->getLibStatut(3);
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>'; print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>'; print '</td>';
print '<td class="center linecolmove tdlineupdown">';
if ($i > 0)
{
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=up&amp;rowid='.$ruleaction['id'].'">'.img_up('default', 0, 'imgupforline').'</a>';
}
if ($i < count($object->actions)-1) {
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>';
}
print '</td>';
print '</tr>'; print '</tr>';
$i++;
} }
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
if (! empty($conf->use_javascript_ajax)) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '</form>'; print '</form>';
print '</div>'; print '</div>';

View File

@ -74,7 +74,7 @@ llxHeader('',$langs->trans("Audit"),$wikihelp);
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup'); print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
print $langs->trans("LogEventDesc")."<br>\n"; print $langs->trans("LogEventDesc", $langs->transnoentitiesnoconv("AdminTools"), $langs->transnoentitiesnoconv("Audit"))."<br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -24,6 +24,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
// Security check // Security check
@ -150,6 +151,25 @@ if ($geoip)
if ($result) print $result; if ($result) print $result;
else print $langs->trans("Error"); else print $langs->trans("Error");
*/ */
//var_dump($_SERVER);
$ip = getUserRemoteIP();
//$ip='91.161.249.43';
$isip=is_ip($ip);
if ($isip == 1)
{
print '<br>'.$ip.' -> ';
$result=dol_print_ip($ip,1);
if ($result) print $result;
else print $langs->trans("Error");
}
else
{
print '<br>'.$ip.' -> ';
$result=dol_print_ip($ip,1);
if ($result) print $result;
else print $langs->trans("NotAPublicIp");
}
$geoip->close(); $geoip->close();
} }

View File

@ -421,7 +421,7 @@ if ($action == 'delete')
//var_dump($elementList); //var_dump($elementList);
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active"; $sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql.=" WHERE entity IN (".getEntity('email_template').")"; $sql.=" WHERE entity IN (".getEntity('email_template').")";
if (! $user->admin) if (! $user->admin)
@ -787,8 +787,12 @@ if ($resql)
$i++; $i++;
continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled) continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
} }
// TODO Test on 'enabled' // Test on 'enabled'
if (! dol_eval($obj->enabled, 1))
{
$i++;
continue; // Email template not qualified
}
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';

View File

@ -701,7 +701,10 @@ if ($mode == 'common')
else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1))) else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1)))
{ {
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used");
else print $langs->trans("Required"); else {
print img_picto($langs->trans("Required"),'switch_on');
print $langs->trans("Required");
}
if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
} }
else else

View File

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

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

@ -38,6 +38,7 @@ function blockedlogadmin_prepare_head()
$head[$h][2] = 'blockedlog'; $head[$h][2] = 'blockedlog';
$h++; $h++;
$langs->load("blockedlog");
$head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog_list.php?withtab=1"; $head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog_list.php?withtab=1";
$head[$h][1] = $langs->trans("BrowseBlockedLog"); $head[$h][1] = $langs->trans("BrowseBlockedLog");

View File

@ -69,7 +69,23 @@ if ($id > 0)
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->id) { if ($object->id) {
$object->add_photo($upload_dir, $_FILES['userfile']);
$file = $_FILES['userfile'];
if (is_array($file['name']) && count($file['name']) > 0)
{
foreach ($file['name'] as $i => $name)
{
if(empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]) )
{
setEventMessage($file['name'][$i] .' : '. $langs->trans(empty($file['tmp_name'][$i])? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles' ) );
unset($file['name'][$i],$file['type'][$i],$file['tmp_name'][$i],$file['error'][$i],$file['size'][$i]);
}
}
}
if(!empty($file['tmp_name'])) {
$object->add_photo($upload_dir, $file);
}
} }
} }

View File

@ -1302,7 +1302,6 @@ if ($id > 0)
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td>'; print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td>';
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">'; print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>'; print '</td></tr>';
// Object linked // Object linked
if (! empty($object->fk_element) && ! empty($object->elementtype)) if (! empty($object->fk_element) && ! empty($object->elementtype))
{ {
@ -1610,8 +1609,9 @@ if ($id > 0)
print ($object->priority?$object->priority:''); print ($object->priority?$object->priority:'');
print '</td></tr>'; print '</td></tr>';
// Object linked // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
if (! empty($object->fk_element) && ! empty($object->elementtype)) // for such objects because there is already a dedicated field into table llx_actioncomm.
if (! empty($object->fk_element) && ! empty($object->elementtype) && ! in_array($object->elementtype, array('societe','contact','project')))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("LinkedObject").'</td>'; print '<tr><td>'.$langs->trans("LinkedObject").'</td>';

View File

@ -334,7 +334,16 @@ class ActionComm extends CommonObject
$sql.= "fk_element,"; $sql.= "fk_element,";
$sql.= "elementtype,"; $sql.= "elementtype,";
$sql.= "entity,"; $sql.= "entity,";
$sql.= "extraparams"; $sql.= "extraparams,";
// Fields emails
$sql.= "email_msgid,";
$sql.= "email_from,";
$sql.= "email_sender,";
$sql.= "email_to,";
$sql.= "email_tocc,";
$sql.= "email_tobcc,";
$sql.= "email_subject,";
$sql.= "errors_to";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", "; $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", ";
@ -354,7 +363,16 @@ class ActionComm extends CommonObject
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").", "; $sql.= (! empty($this->fk_element)?$this->fk_element:"null").", ";
$sql.= (! empty($this->elementtype)?"'".$this->db->escape($this->elementtype)."'":"null").", "; $sql.= (! empty($this->elementtype)?"'".$this->db->escape($this->elementtype)."'":"null").", ";
$sql.= $conf->entity.","; $sql.= $conf->entity.",";
$sql.= (! empty($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null"); $sql.= (! empty($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").", ";
// Fields emails
$sql.= (! empty($this->email_msgid)?"'".$this->db->escape($this->email_msgid)."'":"null").", ";
$sql.= (! empty($this->email_from)?"'".$this->db->escape($this->email_from)."'":"null").", ";
$sql.= (! empty($this->email_sender)?"'".$this->db->escape($this->email_sender)."'":"null").", ";
$sql.= (! empty($this->email_to)?"'".$this->db->escape($this->email_to)."'":"null").", ";
$sql.= (! empty($this->email_tocc)?"'".$this->db->escape($this->email_tocc)."'":"null").", ";
$sql.= (! empty($this->email_tobcc)?"'".$this->db->escape($this->email_tobcc)."'":"null").", ";
$sql.= (! empty($this->email_subject)?"'".$this->db->escape($this->email_subject)."'":"null").", ";
$sql.= (! empty($this->errors_to)?"'".$this->db->escape($this->errors_to)."'":"null");
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::add", LOG_DEBUG); dol_syslog(get_class($this)."::add", LOG_DEBUG);
@ -1315,10 +1333,10 @@ class ActionComm extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($option == 'nolink') { if ($option == 'nolink') {
$linkstart = ''; $linkstart = '';
$linkend = ''; $linkend = '';
} }
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto; //print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
if ($withpicto == 2) if ($withpicto == 2)
@ -1691,7 +1709,7 @@ class ActionComm extends CommonObject
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda")); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
return 0; return 0;
} }
$now = dol_now(); $now = dol_now();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -7,6 +7,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * Copyright (C) 2017 Open-DSI <support@open-dsi.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
@ -44,9 +45,9 @@ if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MA
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB; $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
@ -65,7 +66,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec"; if (! $sortfield) $sortfield="a.datec";
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("search_socid","int")?GETPOST("search_socid","int"):GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -79,32 +80,32 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
} }
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); $day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3); $pid=GETPOST("search_projectid","int",3)?GETPOST("search_projectid","int",3):GETPOST("projectid","int",3);
$status=GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo' $status=GETPOST("search_status",'aZ09')?GETPOST("search_status",'aZ09'):GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo'
$type=GETPOST("type",'az09'); $type=GETPOST("search_type",'az09')?GETPOST("search_type",'az09'):GETPOST("type",'az09');
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! GETPOSTISSET('search_status')) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); $defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW); $defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=$defaultview; if (empty($action) && ! GETPOSTISSET('action')) $action=$defaultview;
if ($action == 'default') // When action is default, we want a calendar view and not the list if ($action == 'default') // When action is default, we want a calendar view and not the list
{ {
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month'); $action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
@ -301,21 +302,22 @@ if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param=''; $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".$actioncode; } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($socid) $param.="&socid=".$socid; if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($showbirthday) $param.="&showbirthday=1"; if ($socid) $param.="&search_socid=".urlencode($socid);
if ($pid) $param.="&projectid=".$pid; if ($showbirthday) $param.="&search_showbirthday=1";
if ($type) $param.="&type=".$type; if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') $param.='&action='.$action; if ($type) $param.="&search_type=".urlencode($type);
$param.="&maxprint=".$maxprint; if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') $param.='&action='.urlencode($action);
$param.="&maxprint=".urlencode($maxprint);
// Show navigation bar // Show navigation bar
if (empty($action) || $action=='show_month') if (empty($action) || $action=='show_month')

View File

@ -41,23 +41,23 @@ $langs->loadLangs(array("users","companies","agenda","commercial"));
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
$pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3);
$status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
$type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
$year=GETPOST("year",'int'); $year=GETPOST("year",'int');
$month=GETPOST("month",'int'); $month=GETPOST("month",'int');
$day=GETPOST("day",'int'); $day=GETPOST("day",'int');
$pid=GETPOST("projectid",'int',3);
$status=GETPOST("status",'alpha');
$type=GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$search_id=GETPOST('search_id','alpha'); $search_id=GETPOST('search_id','alpha');
@ -69,10 +69,10 @@ $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth','int'), GETPOST('dateendday'
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?(GETPOST("search_showbirthday","int")?GETPOST("search_showbirthday","int"):GETPOST("showbirthday","int")):1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new ActionComm($db); $object = new ActionComm($db);
@ -108,7 +108,7 @@ if (! $sortfield)
} }
// Security check // Security check
$socid = GETPOST("socid",'int'); $socid = GETPOST("search_socid",'int')?GETPOST("search_socid",'int'):GETPOST("socid",'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -132,14 +132,15 @@ $arrayfields=array(
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1), 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
} }
} }
@ -207,19 +208,18 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($actioncode != '') { if ($actioncode != '') {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".urlencode($str_action); foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".urlencode($actioncode); } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".urlencode($resourceid); if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status != '' && $status > -1) $param.="&status=".urlencode($status); if ($status != '' && $status > -1) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".urlencode($filter); if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".urlencode($filtert); if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($socid) $param.="&socid=".urlencode($socid); if ($socid) $param.="&search_socid=".urlencode($socid);
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&search_showbirthday=1";
if ($pid) $param.="&projectid=".urlencode($pid); if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($type) $param.="&type=".urlencode($type); if ($type) $param.="&search_type=".urlencode($type);
if ($usergroup) $param.="&usergroup=".urlencode($usergroup); if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_id != '') $param.='&search_title='.urlencode($search_id); if ($search_id != '') $param.='&search_title='.urlencode($search_id);
if ($search_title != '') $param.='&search_title='.urlencode($search_title); if ($search_title != '') $param.='&search_title='.urlencode($search_title);
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int'); if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
@ -228,16 +228,17 @@ if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestart
if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int'); if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int');
if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int'); if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int');
if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int'); if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int');
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
$sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " c.code as type_code, c.libelle as type_label,";
$sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; $sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id";
// Add fields from extrafields // Add fields from extrafields
@ -364,10 +365,10 @@ if ($resql)
//if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; //if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
//if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">'; //if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; if ($filter) $nav.='<input type="hidden" name="search_filter" value="'.$filter.'">';
//if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; //if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
//if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; //if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; if ($showbirthday) $nav.='<input type="hidden" name="search_showbirthday" value="1">';
//if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; //if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
//if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; //if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
print $nav; print $nav;
@ -461,8 +462,9 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['a.datec']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) { if (! empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print ajax_combobox('selectstatus'); print ajax_combobox('selectstatus');
@ -494,6 +496,10 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['a.datec']['checked'])) print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"],"a.datec,a.id",$param,"",'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['a.tms']['checked'])) print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"],"a.tms,a.id",$param,"",'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -599,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;';
@ -652,6 +660,15 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['a.datec']['checked'])) {
// Status/Percent
print '<td align="center" class="nowrap">'.dol_print_date($obj->datec, 'dayhour').'</td>';
}
// Date update
if (! empty($arrayfields['a.tms']['checked'])) {
print '<td align="center" class="nowrap">'.dol_print_date($obj->datem, 'dayhour').'</td>';
}
if (! empty($arrayfields['a.percent']['checked'])) { if (! empty($arrayfields['a.percent']['checked'])) {
// Status/Percent // Status/Percent
$datep=$db->jdate($obj->datep); $datep=$db->jdate($obj->datep);

View File

@ -41,9 +41,9 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
$showbirthday = 0; $showbirthday = 0;
@ -64,7 +64,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec"; if (! $sortfield) $sortfield="a.datec";
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("search_socid","int")?GETPOST("search_socid","int"):GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -79,24 +79,24 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
//$action=GETPOST('action','alpha'); //$action=GETPOST('action','alpha');
$action='show_peruser'; //We use 'show_week' mode $action='show_peruser'; //We use 'show_week' mode
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); $day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3); $pid=GETPOST("search_projectid","int",3)?GETPOST("search_projectid","int",3):GETPOST("projectid","int",3);
$status=GETPOST("status",'alpha'); $status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
$type=GETPOST("type",'alpha'); $type=GETPOST("search_type",'alpha')?GETPOST("search_type",'alpha'):GETPOST("type",'alpha');
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
@ -201,25 +201,25 @@ if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param=''; $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".urlencode($str_action); foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".urlencode($actioncode); } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".urlencode($resourceid); if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".urlencode($status); if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".urlencode($filter); if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".urlencode($filtert); if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($usergroup) $param.="&usergroup=".urlencode($usergroup); if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($socid) $param.="&socid=".urlencode($socid); if ($socid) $param.="&search_socid=".urlencode($socid);
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&search_showbirthday=1";
if ($pid) $param.="&projectid=".urlencode($pid); if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($type) $param.="&type=".urlencode($type); if ($type) $param.="&search_type=".urlencode($type);
if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.urlencode($action); if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.urlencode($action);
if ($begin_h != '') $param.='&begin_h='.urlencode($begin_h); if ($begin_h != '') $param.='&begin_h='.urlencode($begin_h);
if ($end_h != '') $param.='&end_h='.urlencode($end_h); if ($end_h != '') $param.='&end_h='.urlencode($end_h);
if ($begin_d != '') $param.='&begin_d='.urlencode($begin_d); if ($begin_d != '') $param.='&begin_d='.urlencode($begin_d);
if ($end_d != '') $param.='&end_d='.urlencode($end_d); if ($end_d != '') $param.='&end_d='.urlencode($end_d);
$param.="&maxprint=".urlencode($maxprint); $param.="&maxprint=".urlencode($maxprint);
@ -358,9 +358,23 @@ if ($conf->use_javascript_ajax)
} }
$newcardbutton='';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
$tmpforcreatebutton=dol_getdate(dol_now(), true);
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$link=''; $link='';
print load_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav, ''); print load_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav.' '.$newcardbutton, '');
// Get event in an array // Get event in an array

View File

@ -346,7 +346,7 @@ if ($object->id > 0)
print '</td><td>'; print '</td><td>';
if ($action == 'editmode') if ($action == 'editmode')
{ {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id', 'CRDT');
} }
else else
{ {

View File

@ -2105,7 +2105,7 @@ if ($action == 'create')
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) { if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
} else { } else {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
} }

View File

@ -2432,7 +2432,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
*/ */
@ -258,7 +255,7 @@ $projectstatic=new Project($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('',$langs->trans('Proposal'),$help_url); //llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -404,6 +401,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$objectstatic=new Propal($db); $objectstatic=new Propal($db);
@ -425,6 +423,18 @@ 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) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id);
exit;
}
llxHeader('',$langs->trans('Proposal'),$help_url);
$param='&viewstatut='.urlencode($viewstatut); $param='&viewstatut='.urlencode($viewstatut);
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
@ -456,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

@ -2191,7 +2191,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editmode') { if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
} else { } else {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
} }

View File

@ -74,6 +74,7 @@ $socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int'); $search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int'); $search_sale=GETPOST('search_sale','int');
$search_total_ht=GETPOST('search_total_ht','alpha'); $search_total_ht=GETPOST('search_total_ht','alpha');
$search_total_ttc=GETPOST('search_total_ttc','alpha');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int')); $search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int'); $billed = GETPOST('billed','int');
@ -232,7 +233,7 @@ $projectstatic=new Project($db);
$title=$langs->trans("Orders"); $title=$langs->trans("Orders");
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
llxHeader('',$title,$help_url); // llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -335,6 +336,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref); if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
@ -399,6 +401,16 @@ 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) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/commande/card.php?id='.$id);
exit;
}
llxHeader('',$title,$help_url);
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
@ -467,8 +479,8 @@ if ($resql)
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";

View File

@ -550,7 +550,7 @@ foreach ($accounts as $key=>$type)
// Balance // Balance
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right">'; print '<td align="right" class="nowraponall">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;

View File

@ -354,7 +354,7 @@ $facturestatic=new Facture($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); // llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -532,15 +532,26 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
} }
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
//print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($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) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->id;
header("Location: ".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id);
exit;
}
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
if ($socid) if ($socid)
{ {
$soc = new Societe($db); $soc = new Societe($db);

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

@ -579,11 +579,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td>'.$arraytitle.'</td>'; print '<td>'.$arraytitle.'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
print '<td align="center">'.$langs->trans('DateMaxPayment').'</td>'; print '<td align="center">'.$langs->trans('DateMaxPayment').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td>'.$langs->trans('Currency').'</td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; print '<td>'.$langs->trans('Currency').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>'; print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>'; print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>'; print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
}
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$alreadypayedlabel.'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$remaindertopay.'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
@ -612,8 +614,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
// Multicurrency Price // Multicurrency Price
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled)) {
{
$multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_payment = $invoice->getSommePaiement(1);
$multicurrency_creditnotes=$invoice->getSumCreditNotesUsed(1); $multicurrency_creditnotes=$invoice->getSumCreditNotesUsed(1);
$multicurrency_deposits=$invoice->getSumDepositsUsed(1); $multicurrency_deposits=$invoice->getSumDepositsUsed(1);
@ -760,11 +761,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Print total // Print total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>'; print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>'; print '<td></td>';
print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
}
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>'; print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($sign * $totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);

View File

@ -107,7 +107,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
$db->begin(); $db->begin();
$object->fetch($id); $object->fetch($id);
if ($object->valide() > 0) if ($object->valide($user) > 0)
{ {
$db->commit(); $db->commit();
@ -157,7 +157,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
if ($action == 'setdatep' && ! empty($_POST['datepday'])) if ($action == 'setdatep' && ! empty($_POST['datepday']))
{ {
$object->fetch($id); $object->fetch($id);
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']); $datepaye = dol_mktime(GETPOST('datephour','int'), GETPOST('datepmin','int'), GETPOST('datepsec','int'), GETPOST('datepmonth','int'), GETPOST('datepday','int'), GETPOST('datepyear','int'));
$res = $object->update_date($datepaye); $res = $object->update_date($datepaye);
if ($res === 0) if ($res === 0)
{ {
@ -191,17 +191,13 @@ $head = payment_prepare_head($object);
dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment'); dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment');
/* // Confirmation de la suppression du paiement
* Confirmation de la suppression du paiement
*/
if ($action == 'delete') if ($action == 'delete')
{ {
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
} }
/* // Confirmation de la validation du paiement
* Confirmation de la validation du paiement
*/
if ($action == 'valide') if ($action == 'valide')
{ {
$facid = $_GET['facid']; $facid = $_GET['facid'];
@ -220,7 +216,7 @@ print '<table class="border centpercent">'."\n";
// Date payment // Date payment
print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td>'; print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td>';
print $form->editfieldval("Date",'datep',$object->date,$object,$user->rights->facture->paiement,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded')); print $form->editfieldval("Date", 'datep', $object->date, $object,$user->rights->facture->paiement, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>'; print '</td></tr>';
// Payment type (VIR, LIQ, ...) // Payment type (VIR, LIQ, ...)

View File

@ -862,9 +862,10 @@ class Paiement extends CommonObject
/** /**
* Validate payment * Validate payment
* *
* @return int <0 if KO, >0 if OK * @param User $user User making validation
* @return int <0 if KO, >0 if OK
*/ */
function valide() function valide(User $user=null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id;
@ -885,9 +886,10 @@ class Paiement extends CommonObject
/** /**
* Reject payment * Reject payment
* *
* @return int <0 if KO, >0 if OK * @param User $user User making reject
* @return int <0 if KO, >0 if OK
*/ */
function reject() function reject(User $user=null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id;

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('bills', 'compta')); $langs->loadLangs(array('bills', 'compta', 'companies'));
// Security check // Security check
$facid = GETPOST('facid','int'); $facid = GETPOST('facid','int');
@ -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,23 +298,28 @@ 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>';
// Date // Date
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>'; $dateformatforpayment = 'day';
if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour';
print '<td align="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>';
// 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

@ -303,7 +303,7 @@ if ($modecompta == 'BOOKKEEPING')
foreach($cpts as $i => $cpt) foreach($cpts as $i => $cpt)
{ {
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']); $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']);
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors'); setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0; $resultN=0;

View File

@ -78,7 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{ {
// We define date_start and date_end // We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1); $year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); $month_start=GETPOST("month",'int')?GETPOST("month",'int'):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$date_startmonth = $month_start; $date_startmonth = $month_start;
if (! GETPOST('month')) if (! GETPOST('month'))
{ {
@ -108,8 +108,10 @@ if (($date_start < dol_time_plus_duree($date_end, -1, 'y')) || ($date_start > $d
// $date_start and $date_end are defined. We force $start_year and $nbofyear // $date_start and $date_end are defined. We force $start_year and $nbofyear
$tmps=dol_getdate($date_start); $tmps=dol_getdate($date_start);
$start_year = $tmps['year']; $start_year = $tmps['year'];
$start_month = $tmps['mon'];
$tmpe=dol_getdate($date_end); $tmpe=dol_getdate($date_end);
$year_end = $tmpe['year']; $year_end = $tmpe['year'];
$month_end = $tmpe['mon'];
$nbofyear = ($year_end - $start_year) + 1; $nbofyear = ($year_end - $start_year) + 1;
$date_start_previous = dol_time_plus_duree($date_start, -1, 'y'); $date_start_previous = dol_time_plus_duree($date_start, -1, 'y');
@ -231,13 +233,13 @@ print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'
foreach($months as $k => $v){ foreach($months as $k => $v){
if (($k+1) >= $date_startmonth) if (($k+1) >= $date_startmonth)
{ {
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>'; print '<th class="liste_titre width50" align="right" >'.$langs->trans('MonthShort'.sprintf("%02s",($k+1))).'</th>';
} }
} }
foreach($months as $k => $v){ foreach($months as $k => $v){
if (($k+1) < $date_startmonth) if (($k+1) < $date_startmonth)
{ {
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>'; print '<th class="liste_titre width50" align="right" >'.$langs->trans('MonthShort'.sprintf("%02s",($k+1))).'</th>';
} }
} }
print '</tr>'; print '</tr>';
@ -374,13 +376,14 @@ elseif ($modecompta=="BOOKKEEPING")
} }
} }
print "</tr>\n"; print "</tr>\n";
//var_dump($sommes); //var_dump($sommes);
} }
else // normal category else // normal category
{ {
$code = $cat['code']; // Category code we process
$totCat = array(); $totCat = array();
$totCat['NP'] = 0; $totCat['NP'] = 0;
$totCat['N'] = 0; $totCat['N'] = 0;
@ -390,9 +393,73 @@ elseif ($modecompta=="BOOKKEEPING")
$totCat['M'][$k] = 0; $totCat['M'][$k] = 0;
} }
// Set $cpts of with array of accounts in the category/group // Set $cpts with array of accounts in the category/group
$cpts = $AccCat->getCptsCat($cat['rowid']); $cpts = $AccCat->getCptsCat($cat['rowid']);
$arrayofaccountforfilter=array();
foreach($cpts as $i => $cpt) // Loop on each account.
{
$arrayofaccountforfilter[]=$cpt['account_number'];
}
// N-1
if (! empty($arrayofaccountforfilter))
{
$return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cpt['dc']?$cpt['dc']:0);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
foreach($cpts as $i => $cpt) // Loop on each account.
{
$resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']])?0:$AccCat->sdcperaccount[$cpt['account_number']];
$totCat['NP'] += $resultNP;
$sommes[$code]['NP'] += $resultNP;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
}
}
}
// Set value into column N and month M ($totCat)
// This make 12 calls for each accountancy account (12 monthes M)
foreach($cpts as $i => $cpt) // Loop on each account.
{
// We make 1 loop for each account because we may want detail per account.
// @TODO Optimize to ask a 'group by' account and a filter with account in (..., ...) in request
// Each month
$resultN = 0;
foreach($months as $k => $v)
{
$monthtoprocess = $k+1; // ($k+1) is month 1, 2, ..., 12
$yeartoprocess = $start_year;
if (($k+1) < $start_month) $yeartoprocess++;
//var_dump($monthtoprocess.'_'.$yeartoprocess);
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']?$cpt['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
$resultN += $resultM;
}
$totCat['N'] += $resultN;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print "<tr>"; print "<tr>";
// Column group // Column group
@ -426,54 +493,6 @@ elseif ($modecompta=="BOOKKEEPING")
} }
print '</td>'; print '</td>';
$code = $cat['code'];
// Set value into column NPrevious, N and each month M ($totCat)
// This make 14 calls for each detail of account (NP, N and month m)
foreach($cpts as $i => $cpt)
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
}
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print '<td align="right">' . price($totCat['NP']) . '</td>'; print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>'; print '<td align="right">' . price($totCat['N']) . '</td>';
@ -487,8 +506,7 @@ elseif ($modecompta=="BOOKKEEPING")
print "</tr>\n"; print "</tr>\n";
// Loop on detail of all accounts // Loop on detail of all accounts to output the detail
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no') if ($showaccountdetail != 'no')
{ {
foreach($cpts as $i => $cpt) foreach($cpts as $i => $cpt)
@ -525,7 +543,6 @@ elseif ($modecompta=="BOOKKEEPING")
print '<td align="right">' . price($resultM) . '</td>'; print '<td align="right">' . price($resultM) . '</td>';
} }
} }
print "</tr>\n"; print "</tr>\n";
} }
} }

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

@ -187,7 +187,7 @@ $head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear'; $head[$h][2] = 'byyear';
$h++; $h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats'); complete_head_from_modules($conf,$langs,null,$head,$h,'salaries_stats');
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
@ -197,7 +197,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box // Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="border" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// User // User
print '<tr><td>'.$langs->trans("User").'</td><td>'; print '<tr><td>'.$langs->trans("User").'</td><td>';
@ -215,8 +215,8 @@ print '</form>';
print '<br><br>'; print '<br><br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="border" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr>'; print '<tr class="liste_titre" height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="right">'.$langs->trans("Number").'</td>'; print '<td align="right">'.$langs->trans("Number").'</td>';
print '<td align="right">'.$langs->trans("AmountTotal").'</td>'; print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
@ -231,14 +231,16 @@ foreach ($data as $val)
{ {
// If we have empty year // If we have empty year
$oldyear--; $oldyear--;
print '<tr height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@ -132,16 +132,13 @@ if (empty($reshook))
* View * View
*/ */
$form = new Form($db);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname; if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname;
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$form = new Form($db);
$formcompany = new FormCompany($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($socid > 0) if ($socid > 0)
{ {
@ -259,20 +256,16 @@ else
//print '<div class="tabsAction">'; //print '<div class="tabsAction">';
//print '</div>'; //print '</div>';
$newcardbutton='';
$morehtmlcenter=''; if (! empty($conf->agenda->enabled))
if (! empty($conf->agenda->enabled)) {
{ if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) {
{ $newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$morehtmlcenter.= '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>'; $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
} $newcardbutton.= '</a>';
else }
{ }
$morehtmlcenter.= '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{ {
@ -282,7 +275,8 @@ else
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); print load_fiche_titre($langs->trans("ActionsOnContact"), $newcardbutton, '');
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
// List of all actions // List of all actions
$filters=array(); $filters=array();

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

@ -217,7 +217,7 @@ if (! $error && $massaction == 'confirm_presend')
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
continue; continue;
} }
if ($objectclass == 'Facture' && $objectobj->statut != Facture::STATUS_VALIDATED) if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT)
{ {
$langs->load("errors"); $langs->load("errors");
$nbignored++; $nbignored++;

View File

@ -42,8 +42,8 @@ top_httphead();
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n"; print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// Registering the location of boxes // Registering the location of boxes
if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST['table_element_line']) && ! empty($_POST['table_element_line'])) if ((! empty($_POST['roworder'])) && (! empty($_POST['table_element_line']))
&& (isset($_POST['fk_element']) && ! empty($_POST['fk_element'])) && (isset($_POST['element_id']) && ! empty($_POST['element_id'])) ) && (! empty($_POST['fk_element'])) && (! empty($_POST['element_id'])))
{ {
$roworder=GETPOST('roworder','alpha',2); $roworder=GETPOST('roworder','alpha',2);
$table_element_line=GETPOST('table_element_line','alpha',2); $table_element_line=GETPOST('table_element_line','alpha',2);
@ -53,6 +53,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG); dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
$rowordertab = explode(',',$roworder); $rowordertab = explode(',',$roworder);
$newrowordertab = array();
foreach($rowordertab as $value) foreach($rowordertab as $value)
{ {
if (! empty($value)) $newrowordertab[] = $value; if (! empty($value)) $newrowordertab[] = $value;
@ -62,6 +63,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
$row->table_element_line = $table_element_line; $row->table_element_line = $table_element_line;
$row->fk_element = $fk_element; $row->fk_element = $fk_element;
$row->id = $element_id; $row->id = $element_id;
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line $row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
// Reorder line to have position of children lines sharing same counter than parent lines // Reorder line to have position of children lines sharing same counter than parent lines

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

@ -68,8 +68,10 @@ class CMailFile
var $smtps; // Contains SMTPs object (if this method is used) var $smtps; // Contains SMTPs object (if this method is used)
var $phpmailer; // Contains PHPMailer object (if this method is used) var $phpmailer; // Contains PHPMailer object (if this method is used)
//CSS /**
var $css; * @var string CSS
*/
public $css;
//! Defined css style for body background //! Defined css style for body background
var $styleCSS; var $styleCSS;
//! Defined background directly in body tag //! Defined background directly in body tag
@ -381,7 +383,7 @@ class CMailFile
//$this->message = new Swift_SignedMessage(); //$this->message = new Swift_SignedMessage();
// Adding a trackid header to a message // Adding a trackid header to a message
$headers = $this->message->getHeaders(); $headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host);
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
$msgid = $headers->get('Message-ID'); $msgid = $headers->get('Message-ID');
$msgid->setId($headerID); $msgid->setId($headerID);
@ -475,7 +477,7 @@ class CMailFile
if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to); //if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from)); if (isset($deliveryreceipt) && $deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
} }
else else
{ {
@ -944,7 +946,7 @@ class CMailFile
/** /**
* Build a css style (mode = all) into this->styleCSS and this->bodyCSS * Build a css style (mode = all) into this->styleCSS and this->bodyCSS
* *
* @return css * @return string
*/ */
function buildCSS() function buildCSS()
{ {
@ -1011,9 +1013,9 @@ class CMailFile
if ($trackid) if ($trackid)
{ {
// References is kept in response and Message-ID is returned into In-Reply-To: // References is kept in response and Message-ID is returned into In-Reply-To:
$out.= 'Message-ID: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2; // Uppercase seems replaced by phpmail $out.= 'Message-ID: <' . time() . '.phpmail-dolibarr-'. $trackid . '@' . $host . ">" . $this->eol2; // Uppercase seems replaced by phpmail
$out.= 'References: <' . time() . '.phpmail-dolibarr-'.$trackid.'@' . $host . ">" . $this->eol2; $out.= 'References: <' . time() . '.phpmail-dolibarr-'. $trackid . '@' . $host . ">" . $this->eol2;
$out.= 'X-Dolibarr-TRACKID: '.$trackid. $this->eol2; $out.= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host. $this->eol2;
} }
else else
{ {
@ -1232,7 +1234,7 @@ class CMailFile
{ {
foreach ($images_list as $img) foreach ($images_list as $img)
{ {
dol_syslog("CMailFile::write_images: i=$i"); dol_syslog("CMailFile::write_images: ".$img["name"]);
$out.= "--" . $this->related_boundary . $this->eol; // always related for an inline image $out.= "--" . $this->related_boundary . $this->eol; // always related for an inline image
$out.= "Content-Type: " . $img["content_type"] . "; name=\"".$img["name"]."\"".$this->eol; $out.= "Content-Type: " . $img["content_type"] . "; name=\"".$img["name"]."\"".$this->eol;

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

@ -2379,7 +2379,7 @@ abstract class CommonObject
function updateRangOfLine($rowid,$rang) function updateRangOfLine($rowid,$rang)
{ {
$fieldposition = 'rang'; $fieldposition = 'rang';
if ($this->table_element_line == 'ecm_files') $fieldposition = 'position'; if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
@ -2417,14 +2417,17 @@ abstract class CommonObject
*/ */
function updateLineUp($rowid,$rang) function updateLineUp($rowid,$rang)
{ {
if ($rang > 1 ) if ($rang > 1)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang ; $fieldposition = 'rang';
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang ;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND rang = '.($rang - 1); $sql.= ' AND rang = '.($rang - 1);
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.($rang - 1); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang - 1);
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
@ -2450,12 +2453,15 @@ abstract class CommonObject
{ {
if ($rang < $max) if ($rang < $max)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang; $fieldposition = 'rang';
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND rang = '.($rang+1); $sql.= ' AND rang = '.($rang+1);
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.($rang+1); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang+1);
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
@ -5139,7 +5145,7 @@ abstract class CommonObject
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
* @see setValueFrom, insertExtraFields * @see setValueFrom, insertExtraFields
*/ */
function updateExtraField($key, $trigger, $userused) function updateExtraField($key, $trigger=null, $userused=null)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@ -6285,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) {
@ -7268,16 +7273,45 @@ abstract class CommonObject
/** /**
* Delete object in database * Delete object in database
* *
* @param User $user User that deletes * @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK * @param int $forcechilddeletion 0=no, 1=Force deletion of children
* @return int <=0 if KO, >0 if OK
*/ */
public function deleteCommon(User $user, $notrigger = false) public function deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
{ {
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
if ($forcechilddeletion)
{
foreach($this->childtables as $table)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->error;
$this->db->rollback();
return -1;
}
}
}
elseif (! empty($this->fk_element) && ! empty($this->childtables)) // If object has childs linked with a foreign key field, we check all child tables.
{
$objectisused = $this->isObjectUsed($this->id);
if (! empty($objectisused))
{
dol_syslog(get_class($this)."::deleteCommon Can't delete record as it has some child", LOG_WARNING);
$this->error='ErrorRecordHasChildren';
$this->errors[]=$this->error;
$this->db->rollback();
return 0;
}
}
if (! $error) { if (! $error) {
if (! $notrigger) { if (! $notrigger) {
// Call triggers // Call triggers

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

@ -137,6 +137,7 @@ class Events // extends CommonObject
// Clean parameters // Clean parameters
$this->description=trim($this->description); $this->description=trim($this->description);
if (empty($this->user_agent) && !empty($_SERVER['HTTP_USER_AGENT'])) $this->user_agent=$_SERVER['HTTP_USER_AGENT'];
// Check parameters // Check parameters
if (empty($this->description)) { $this->error='ErrorBadValueForParameterCreateEventDesc'; return -1; } if (empty($this->description)) { $this->error='ErrorBadValueForParameterCreateEventDesc'; return -1; }
@ -153,8 +154,8 @@ class Events // extends CommonObject
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->db->escape($this->type)."',"; $sql.= " '".$this->db->escape($this->type)."',";
$sql.= " ".$conf->entity.","; $sql.= " ".$conf->entity.",";
$sql.= " '".$this->db->escape($_SERVER['REMOTE_ADDR'])."',"; $sql.= " '".$this->db->escape(getUserRemoteIP())."',";
$sql.= " ".($_SERVER['HTTP_USER_AGENT']?"'".$this->db->escape(dol_trunc($_SERVER['HTTP_USER_AGENT'],250))."'":'NULL').","; $sql.= " ".($this->user_agent ? "'".$this->db->escape(dol_trunc($this->user_agent,250))."'" : 'NULL').",";
$sql.= " '".$this->db->idate($this->dateevent)."',"; $sql.= " '".$this->db->idate($this->dateevent)."',";
$sql.= " ".($user->id?"'".$this->db->escape($user->id)."'":'NULL').","; $sql.= " ".($user->id?"'".$this->db->escape($user->id)."'":'NULL').",";
$sql.= " '".$this->db->escape(dol_trunc($this->description,250))."'"; $sql.= " '".$this->db->escape(dol_trunc($this->description,250))."'";

View File

@ -6739,6 +6739,7 @@ class Form
} }
else if ($object->element == 'member') else if ($object->element == 'member')
{ {
$ret.=$object->ref.'<br>';
$fullname=$object->getFullName($langs); $fullname=$object->getFullName($langs);
if ($object->morphy == 'mor' && $object->societe) { if ($object->morphy == 'mor' && $object->societe) {
$ret.= dol_htmlentities($object->societe) . ((! empty($fullname) && $object->societe != $fullname)?' ('.dol_htmlentities($fullname).')':''); $ret.= dol_htmlentities($object->societe) . ((! empty($fullname) && $object->societe != $fullname)?' ('.dol_htmlentities($fullname).')':'');

View File

@ -1637,7 +1637,7 @@ class FormFile
*/ */
private function _formAjaxFileUpload($object) private function _formAjaxFileUpload($object)
{ {
global $langs; global $langs, $conf;
// PHP post_max_size // PHP post_max_size
$post_max_size = ini_get('post_max_size'); $post_max_size = ini_get('post_max_size');

View File

@ -1420,8 +1420,6 @@ class FormMail extends Form
} }
} }
$tmparray['__(AnyTranslationKey)__']="Translation";
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
{ {
if (empty($val)) $tmparray[$key]=$key; if (empty($val)) $tmparray[$key]=$key;

View File

@ -1310,7 +1310,7 @@ class SMTPs
// References is kept in response and Message-ID is returned into In-Reply-To: // References is kept in response and Message-ID is returned into In-Reply-To:
$_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; $_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
$_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n"; $_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
$_header .= 'X-Dolibarr-TRACKID: ' . $trackid . "\r\n"; $_header .= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host . "\r\n";
} }
else else
{ {

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

@ -213,7 +213,7 @@ class Utils
if ($file == 'auto') if ($file == 'auto')
{ {
$prefix='dump'; $prefix='dump';
$ext='.sql'; $ext='sql';
if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; }
//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } //if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; }
if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; } if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; }

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

@ -724,15 +724,18 @@ function defaultvalues_prepare_head()
$head[$h][2] = 'sortorder'; $head[$h][2] = 'sortorder';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus"; if (! empty($conf->use_javascript_ajax))
$head[$h][1] = $langs->trans("DefaultFocus"); {
$head[$h][2] = 'focus'; $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus";
$h++; $head[$h][1] = $langs->trans("DefaultFocus");
$head[$h][2] = 'focus';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory"; $head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory";
$head[$h][1] = $langs->trans("DefaultMandatory"); $head[$h][1] = $langs->trans("DefaultMandatory");
$head[$h][2] = 'mandatory'; $head[$h][2] = 'mandatory';
$h++; $h++;
}
/*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey"; /*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey";
$head[$h][1] = $langs->trans("TranslationKeySearch"); $head[$h][1] = $langs->trans("TranslationKeySearch");

View File

@ -64,7 +64,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<input type="hidden" name="month" value="' . $month . '">'; print '<input type="hidden" name="month" value="' . $month . '">';
print '<input type="hidden" name="day" value="' . $day . '">'; print '<input type="hidden" name="day" value="' . $day . '">';
print '<input type="hidden" name="action" value="' . $action . '">'; print '<input type="hidden" name="action" value="' . $action . '">';
print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">'; print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">';
print '<div class="fichecenter">'; print '<div class="fichecenter">';
@ -79,7 +79,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("ActionsToDoBy").' &nbsp; '; print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td style="padding-bottom: 2px; padding-right: 4px;">'; print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; '; if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
print '</td></tr>'; print '</td></tr>';
@ -94,7 +94,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Resource"); print $langs->trans("Resource");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
print $formresource->select_resource_list($resourceid, "resourceid", '', 1, 0, 0, null, '', 2); print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2);
print '</td></tr>'; print '</td></tr>';
} }
@ -108,7 +108,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{ {
$multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE)); $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
} }
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect); print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
print '</td></tr>'; print '</td></tr>';
} }
@ -118,7 +118,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("ThirdParty").' &nbsp; '; print $langs->trans("ThirdParty").' &nbsp; ';
print '</td><td class="nowrap" style="padding-bottom: 2px;">'; print '</td><td class="nowrap" style="padding-bottom: 2px;">';
print $form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0); print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0);
print '</td></tr>'; print '</td></tr>';
} }
@ -131,7 +131,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px;">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap" style="padding-bottom: 2px;">'; print '</td><td class="nowrap" style="padding-bottom: 2px;">';
print $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500'); print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>'; print '</td></tr>';
} }
@ -142,7 +142,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Status"); print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'; print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100'); $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -1344,7 +1344,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')
{ {
@ -1386,6 +1386,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);
@ -1517,7 +1519,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; $out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
if ($objcon && get_class($objcon) == 'Contact' && $filterobj && get_class($filterobj) == 'Societe') if ($objcon && get_class($objcon) == 'Contact' &&
(is_null($filterobj) || get_class($filterobj) == 'Societe'))
{ {
$out.='<input type="hidden" name="id" value="'.$objcon->id.'" />'; $out.='<input type="hidden" name="id" value="'.$objcon->id.'" />';
} }

View File

@ -610,9 +610,9 @@ if (! function_exists('dol_getprefix'))
{ {
/** /**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* This prefix is valid in a web context only and is unique for instance and avoid conflict * The prefix for session is unique in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances * between multi-instances, even when having two instances with one root dir or two instances in virtual servers.
* in virtual servers. * The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance.
* *
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix * @return string A calculated prefix
@ -621,11 +621,15 @@ if (! function_exists('dol_getprefix'))
{ {
global $conf; global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email // If prefix is for email
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) if ($mode == 'email')
{ {
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"]; {
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
}
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
} }
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
@ -634,7 +638,7 @@ if (! function_exists('dol_getprefix'))
// Use this for a "readable" cookie name // Use this for a "readable" cookie name
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
} }
else return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
} }
} }
@ -2661,6 +2665,20 @@ function dol_print_ip($ip,$mode=0)
return $ret; return $ret;
} }
/**
* Return the IP of remote user.
* Take HTTP_X_FORWARDED_FOR (defined when using proxy)
* Then HTTP_CLIENT_IP if defined (rare)
* Then REMOTE_ADDR (not way to be modified by user but may be wrong if using proxy)
*
* @return string Ip of remote user.
*/
function getUserRemoteIP()
{
$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 a country code from IP. Empty string if not found. * Return a country code from IP. Empty string if not found.
* *
@ -2704,7 +2722,7 @@ function dol_user_country()
$ret=''; $ret='';
if (! empty($conf->geoipmaxmind->enabled)) if (! empty($conf->geoipmaxmind->enabled))
{ {
$ip=$_SERVER["REMOTE_ADDR"]; $ip=getUserRemoteIP();
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE; $datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
//$ip='24.24.24.24'; //$ip='24.24.24.24';
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat';
@ -2886,188 +2904,6 @@ function dol_substr($string, $start, $length, $stringencoding='', $trunconbytes=
} }
/**
* Show a javascript graph.
* Do not use this function anymore. Use DolGraph class instead.
*
* @param string $htmlid Html id name
* @param int $width Width in pixel
* @param int $height Height in pixel
* @param array $data Data array
* @param int $showlegend 1 to show legend, 0 otherwise
* @param string $type Type of graph ('pie', 'barline')
* @param int $showpercent Show percent (with type='pie' only)
* @param string $url Param to add an url to click values
* @param int $combineother 0=No combine, 0.05=Combine if lower than 5%
* @param int $shownographyet Show graph to say there is not enough data
* @return void
* @deprecated
* @see DolGraph
*/
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05,$shownographyet=0)
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
global $conf,$langs;
global $theme_datacolor; // To have var kept when function is called several times
if ($shownographyet)
{
print '<div class="nographyet" style="width:'.$width.'px;height:'.$height.'px;"></div>';
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
return;
}
if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot';
$datacolor=array();
// Load colors of theme into $datacolor array
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
if (is_readable($color_file))
{
include_once $color_file;
if (isset($theme_datacolor))
{
$datacolor=array();
foreach($theme_datacolor as $val)
{
$datacolor[]="#".sprintf("%02x",$val[0]).sprintf("%02x",$val[1]).sprintf("%02x",$val[2]);
}
}
}
print '<div id="'.$htmlid.'" style="width:'.$width.'px;height:'.$height.'px;"></div>';
// We use Flot js lib
if ($jsgraphlib == 'flot')
{
if ($type == 'pie')
{
// data is array('series'=>array(serie1,serie2,...),
// 'seriestype'=>array('bar','line',...),
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
// serieX is array('label'=>'label', data=>val)
print '
<script type="text/javascript">
$(function () {
var data = '.json_encode($data['series']).';
function plotWithOptions() {
$.plot($("#'.$htmlid.'"), data,
{
series: {
pie: {
show: true,
radius: 0.8,';
if ($combineother)
{
print '
combine: {
threshold: '.$combineother.'
},';
}
print '
label: {
show: true,
radius: 0.9,
formatter: function(label, series) {
var percent=Math.round(series.percent);
var number=series.data[0][1];
return \'';
print '<div style="font-size:8pt;text-align:center;padding:2px;color:black;">';
if ($url) print '<a style="color: #FFFFFF;" border="0" href="'.$url.'">';
print '\'+'.($showlegend?'number':'label+\' \'+number');
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
print '+\'';
if ($url) print '</a>';
print '</div>\';
},
background: {
opacity: 0.0,
color: \'#000000\'
},
}
}
},
zoom: {
interactive: true
},
pan: {
interactive: true
},';
if (count($datacolor))
{
print 'colors: '.(! empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
}
print 'legend: {show: '.($showlegend?'true':'false').', position: \'ne\' }
});
}
plotWithOptions();
});
</script>';
}
else if ($type == 'barline')
{
// data is array('series'=>array(serie1,serie2,...),
// 'seriestype'=>array('bar','line',...),
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
// serieX is array('label'=>'label', data=>array(0=>y1,1=>y2,...)) with same nb of value than into xlabel
print '
<script type="text/javascript">
$(function () {
var data = [';
$i=0; $outputserie=0;
foreach($data['series'] as $serie)
{
if ($data['seriestype'][$i]=='line') { $i++; continue; };
if ($outputserie > 0) print ',';
print '{ bars: { stack: 0, show: true, barWidth: 0.9, align: \'center\' }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
$outputserie++; $i++;
}
if ($outputserie) print ', ';
//print '];
//var datalines = [';
$i=0; $outputserie=0;
foreach($data['series'] as $serie)
{
if (empty($data['seriestype'][$i]) || $data['seriestype'][$i]=='bar') { $i++; continue; };
if ($outputserie > 0) print ',';
print '{ lines: { show: true }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
$outputserie++; $i++;
}
print '];
var dataticks = '.json_encode($data['xlabel']).'
function plotWithOptions() {
$.plot(jQuery("#'.$htmlid.'"), data,
{
series: {
stack: 0
},
zoom: {
interactive: true
},
pan: {
interactive: true
},';
if (count($datacolor))
{
print 'colors: '.json_encode($datacolor).',';
}
print 'legend: {show: '.($showlegend?'true':'false').'},
xaxis: {ticks: dataticks}
});
}
plotWithOptions();
});
</script>';
}
else print 'BadValueForParameterType';
}
}
/** /**
* Truncate a string to a particular length adding '...' if string larger than length. * Truncate a string to a particular length adding '...' if string larger than length.
* If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'. * If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'.
@ -4218,10 +4054,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
if ($picto == 'setup') $picto='title_generic.png'; if ($picto == 'setup') $picto='title_generic.png';
$return.= "\n"; $return.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>'; $return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>'; if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
$return.= '<td class="nobordernopadding" valign="middle">'; $return.= '<td class="nobordernopadding valignmiddle">';
$return.= '<div class="titre">'.$titre.'</div>'; $return.= '<div class="titre inline-block">'.$titre.'</div>';
$return.= '</td>'; $return.= '</td>';
if (dol_strlen($morehtmlcenter)) if (dol_strlen($morehtmlcenter))
{ {
@ -4280,7 +4116,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
print "\n"; print "\n";
print "<!-- Begin title '".$titre."' -->\n"; print "<!-- Begin title '".$titre."' -->\n";
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>'; print '<table border="0" class="centpercent notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire
// Left // Left
//if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>'; //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
@ -5909,7 +5745,7 @@ function dol_textishtml($msg,$option=0)
* *
* @param string $text1 Text 1 * @param string $text1 Text 1
* @param string $text2 Text 2 * @param string $text2 Text 2
* @param bool $forxml false=Use <br>, true=Use <br /> * @param bool $forxml false=Use <br> instead of \n if html content detected, true=Use <br /> instead of \n if html content detected
* @return string Text 1 + new line + Text2 * @return string Text 1 + new line + Text2
* @see dol_textishtml * @see dol_textishtml
*/ */
@ -5961,7 +5797,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__USER_FIRSTNAME__' => (string) $user->firstname, '__USER_FIRSTNAME__' => (string) $user->firstname,
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs), '__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'), '__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
'__USER_REMOTE_IP__' => (string) $_SERVER['REMOTE_ADDR'] '__USER_REMOTE_IP__' => (string) getUserRemoteIP()
) )
); );
} }
@ -6026,6 +5862,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice'; $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice';
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service'; $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service';
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal';
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order';
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = 'Direct download url of an invoice';
if (is_object($object) && $object->element == 'shipping') if (is_object($object) && $object->element == 'shipping')
{ {
$substitutionarray['__SHIPPINGTRACKNUM__']='Shipping tacking number'; $substitutionarray['__SHIPPINGTRACKNUM__']='Shipping tacking number';
@ -6039,7 +5879,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '')); $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : ''); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
// TODO Use this ? // TODO Remove this
$msgishtml = 0; $msgishtml = 0;
$birthday = dol_print_date($object->birth,'day'); $birthday = dol_print_date($object->birth,'day');
@ -6150,6 +5990,22 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):''); $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl; $substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal')
{
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element);
}
else $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = '';
if (! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'commande')
{
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = $object->getLastMainDocLink($object->element);
}
else $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = '';
if (! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'facture')
{
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element);
}
else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
} }
} }
if (empty($exclude) || ! in_array('objectamount', $exclude)) if (empty($exclude) || ! in_array('objectamount', $exclude))
@ -6210,16 +6066,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
)); ));
} }
if (empty($exclude) || ! in_array('system', $exclude))
{
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant');
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
}
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
$substitutionarray=array_merge($substitutionarray, array('__ENTITY_ID__' => $conf->entity)); $substitutionarray=array_merge($substitutionarray, array('__ENTITY_ID__' => $conf->entity));
} }
if (empty($exclude) || ! in_array('system', $exclude))
{
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstantKey');
}
return $substitutionarray; return $substitutionarray;
} }
@ -6928,6 +6784,215 @@ function picto_from_langcode($codelang, $moreatt = '')
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt); return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
} }
/**
* Return default language from country code
*
* @param string $countrycode Country code like 'US', 'FR', 'CA', ...
* @return string Value of locale like 'en_US', 'fr_FR', ...
*/
function getLanguageCodeFromCountryCode($countrycode)
{
global $mysoc;
if (strtoupper($countrycode) == 'MQ') return 'fr_CA';
if (strtoupper($countrycode) == 'SE') return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country
if (strtoupper($countrycode) == 'CH')
{
if ($mysoc->country_code == 'FR') return 'fr_CH';
if ($mysoc->country_code == 'DE') return 'de_CH';
}
// Locale list taken from:
// http://stackoverflow.com/questions/3191664/
// list-of-all-locales-and-their-short-codes
$locales = array(
'af-ZA',
'am-ET',
'ar-AE',
'ar-BH',
'ar-DZ',
'ar-EG',
'ar-IQ',
'ar-JO',
'ar-KW',
'ar-LB',
'ar-LY',
'ar-MA',
'ar-OM',
'ar-QA',
'ar-SA',
'ar-SY',
'ar-TN',
'ar-YE',
'as-IN',
'ba-RU',
'be-BY',
'bg-BG',
'bn-BD',
'bn-IN',
'bo-CN',
'br-FR',
'ca-ES',
'co-FR',
'cs-CZ',
'cy-GB',
'da-DK',
'de-AT',
'de-CH',
'de-DE',
'de-LI',
'de-LU',
'dv-MV',
'el-GR',
'en-AU',
'en-BZ',
'en-CA',
'en-GB',
'en-IE',
'en-IN',
'en-JM',
'en-MY',
'en-NZ',
'en-PH',
'en-SG',
'en-TT',
'en-US',
'en-ZA',
'en-ZW',
'es-AR',
'es-BO',
'es-CL',
'es-CO',
'es-CR',
'es-DO',
'es-EC',
'es-ES',
'es-GT',
'es-HN',
'es-MX',
'es-NI',
'es-PA',
'es-PE',
'es-PR',
'es-PY',
'es-SV',
'es-US',
'es-UY',
'es-VE',
'et-EE',
'eu-ES',
'fa-IR',
'fi-FI',
'fo-FO',
'fr-BE',
'fr-CA',
'fr-CH',
'fr-FR',
'fr-LU',
'fr-MC',
'fy-NL',
'ga-IE',
'gd-GB',
'gl-ES',
'gu-IN',
'he-IL',
'hi-IN',
'hr-BA',
'hr-HR',
'hu-HU',
'hy-AM',
'id-ID',
'ig-NG',
'ii-CN',
'is-IS',
'it-CH',
'it-IT',
'ja-JP',
'ka-GE',
'kk-KZ',
'kl-GL',
'km-KH',
'kn-IN',
'ko-KR',
'ky-KG',
'lb-LU',
'lo-LA',
'lt-LT',
'lv-LV',
'mi-NZ',
'mk-MK',
'ml-IN',
'mn-MN',
'mr-IN',
'ms-BN',
'ms-MY',
'mt-MT',
'nb-NO',
'ne-NP',
'nl-BE',
'nl-NL',
'nn-NO',
'oc-FR',
'or-IN',
'pa-IN',
'pl-PL',
'ps-AF',
'pt-BR',
'pt-PT',
'rm-CH',
'ro-RO',
'ru-RU',
'rw-RW',
'sa-IN',
'se-FI',
'se-NO',
'se-SE',
'si-LK',
'sk-SK',
'sl-SI',
'sq-AL',
'sv-FI',
'sv-SE',
'sw-KE',
'ta-IN',
'te-IN',
'th-TH',
'tk-TM',
'tn-ZA',
'tr-TR',
'tt-RU',
'ug-CN',
'uk-UA',
'ur-PK',
'vi-VN',
'wo-SN',
'xh-ZA',
'yo-NG',
'zh-CN',
'zh-HK',
'zh-MO',
'zh-SG',
'zh-TW',
'zu-ZA',
);
$buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode);
if (in_array($buildprimarykeytotest, $locales)) return strtolower($countrycode).'_'.strtoupper($countrycode);
foreach ($locales as $locale)
{
$locale_language = locale_get_primary_language($locale);
$locale_region = locale_get_region($locale);
if (strtoupper($countrycode) == $locale_region)
{
//var_dump($locale.'-'.$locale_language.'-'.$locale_region);
return strtolower($locale_language).'_'.strtoupper($locale_region);
}
}
return null;
}
/** /**
* Complete or removed entries into a head array (used to build tabs). * Complete or removed entries into a head array (used to build tabs).
* For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab']. * For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab'].

View File

@ -757,7 +757,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$content = $account->number; $content = $account->number;
} elseif ($val == 'BankAccountNumberKey') { } elseif ($val == 'BankAccountNumberKey') {
// Key // Key
$tmplength = 13; $tmplength = 15;
$content = $account->cle_rib; $content = $account->cle_rib;
}elseif ($val == 'IBAN' || $val == 'BIC') { }elseif ($val == 'IBAN' || $val == 'BIC') {
// Key // Key
@ -1514,7 +1514,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return string * @return string
*/ */
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
{ {
global $conf, $hookmanager, $mysoc; global $conf, $hookmanager, $mysoc;
@ -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

@ -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

@ -1087,7 +1087,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($nature) if ($nature)
{ {
$langs->load('accountancy'); $langs->load('accountancy');
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $langs->trans($objp->label), 2, $user->rights->accounting->comptarapport->lire); $journallabel=$langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
} }
$i++; $i++;
} }

View File

@ -1352,19 +1352,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if (! $err) { if (! $err) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,";
if(is_int($frequency)) { $sql.= ' frequency,'; if (is_int($frequency)) { $sql.= ' frequency,'; }
} if (is_int($unitfrequency)) { $sql.= ' unitfrequency,'; }
if(is_int($unitfrequency)) { $sql.= ' unitfrequency,'; if (is_int($priority)) { $sql.= ' priority,'; }
} if (is_int($status)) { $sql.= ' status,'; }
if(is_int($priority)) { $sql.= ' priority,';
}
if(is_int($status)) { $sql.= ' status,';
}
$sql.= " entity, test)"; $sql.= " entity, test)";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= "'".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."', "; $sql.= "'".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "NULL").", "; $sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "'".$this->db->idate($now)."'").", ";
$sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", "; $sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", ";
$sql.= "'".$this->db->escape($label)."', "; $sql.= "'".$this->db->escape($label)."', ";
$sql.= "'".$this->db->escape($jobtype)."', "; $sql.= "'".$this->db->escape($jobtype)."', ";

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2016-2018 Philippe Grand <philippe.grand@atoo-net.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
@ -150,7 +151,7 @@ class pdf_standard extends ModeleExpenseReport
$this->option_freetext = 1; // Support add of a personalised text $this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts $this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise=!$mysoc->tva_assuj; $this->franchise = !$mysoc->tva_assuj;
// Get source company // Get source company
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
@ -159,19 +160,19 @@ class pdf_standard extends ModeleExpenseReport
// Define position of columns // Define position of columns
$this->posxpiece=$this->marge_gauche+1; $this->posxpiece=$this->marge_gauche+1;
$this->posxcomment=$this->marge_gauche+10; $this->posxcomment=$this->marge_gauche+10;
$this->posxdate=88; //$this->posxdate=88;
$this->posxtype=107; //$this->posxtype=107;
$this->posxprojet=120; //$this->posxprojet=120;
$this->posxtva=138; $this->posxtva=130;
$this->posxup=154; $this->posxup=145;
$this->posxqty=168; $this->posxqty=168;
$this->postotalttc=178; $this->postotalttc=178;
if (empty($conf->projet->enabled)) { // if (empty($conf->projet->enabled)) {
$this->posxtva-=20; // $this->posxtva-=20;
$this->posxup-=20; // $this->posxup-=20;
$this->posxqty-=20; // $this->posxqty-=20;
$this->postotalttc-=20; // $this->postotalttc-=20;
} // }
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxdate-=20; $this->posxdate-=20;
@ -202,10 +203,10 @@ class pdf_standard extends ModeleExpenseReport
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return int 1=OK, 0=KO * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user, $langs, $conf, $mysoc, $db, $hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -216,11 +217,9 @@ class pdf_standard extends ModeleExpenseReport
$nblignes = count($object->lines); $nblignes = count($object->lines);
if ($conf->expensereport->dir_output) if ($conf->expensereport->dir_output) {
{
// Definition of $dir and $file // Definition of $dir and $file
if ($object->specimen) if ($object->specimen) {
{
$dir = $conf->expensereport->dir_output; $dir = $conf->expensereport->dir_output;
$file = $dir . "/SPECIMEN.pdf"; $file = $dir . "/SPECIMEN.pdf";
} }
@ -258,7 +257,7 @@ class pdf_standard extends ModeleExpenseReport
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 40; // Height reserved to output the info and total part $heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 12; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
@ -344,82 +343,47 @@ class pdf_standard extends ModeleExpenseReport
$nexY = $tab_top + 7; $nexY = $tab_top + 7;
// Loop on each lines // Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++) {
{
$piece_comptable = $i +1;
$pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage $pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage(); $pageposbefore = $pdf->getPage();
$curY = $nexY; $curY = $nexY;
$pdf->startTransaction();
$pdf->SetFont('','', $default_font_size - 1); $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails);
$pageposafter=$pdf->getPage();
// Accountancy piece if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxpiece, $curY); // There is a pagebreak
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); $pdf->rollbackTransaction(true);
$curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY; $pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
// Comments $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->SetXY($this->posxcomment, $curY ); $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails);
$pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1); $pageposafter = $pdf->getPage();
$curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY; $posyafter = $pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
// Date if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) {
$pdf->SetXY($this->posxdate -1, $curY); // There is no space left for total+free text
$pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4, dol_print_date($object->lines[$i]->date,"day",false,$outputlangs), 0, 'C'); if ($i == ($nblignes-1)) {
// No more lines, and no space left to show total, so we create a new page
// Type $pdf->AddPage('', '', true);
$pdf->SetXY($this->posxtype -1, $curY); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$nextColumnPosX = $this->posxup; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->setPage($pageposafter+1);
$nextColumnPosX = $this->posxtva; }
} }
if (!empty($conf->projet->enabled)) { else
$nextColumnPosX = $this->posxprojet; {
} // We found a page break
$showpricebeforepagebreak=0;
$expensereporttypecode = $object->lines[$i]->type_fees_code; }
$expensereporttypecodetoshow = $outputlangs->transnoentities($expensereporttypecode); }
if ($expensereporttypecodetoshow == $expensereporttypecode) else // No pagebreak
{
$expensereporttypecodetoshow = preg_replace('/^(EX_|TF_)/', '', $expensereporttypecodetoshow);
}
$expensereporttypecodetoshow = dol_trunc($expensereporttypecodetoshow, 9); // 10 is too much
$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C');
// Project
if (! empty($conf->projet->enabled))
{ {
$pdf->SetFont('','', $default_font_size - 1); $pdf->commitTransaction();
$pdf->SetXY($this->posxprojet, $curY); }
$pdf->MultiCell($this->posxtva-$this->posxprojet-0.8, 4, $object->lines[$i]->projet_ref, 0, 'C');
}
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C');
}
// Unit price
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R');
// Quantity
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'R');
// Total with all taxes
$pdf->SetXY($this->postotalttc-1, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
//nexY //nexY
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
@ -427,22 +391,23 @@ class pdf_standard extends ModeleExpenseReport
$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.
$nblineFollowComment = 1; //$nblineFollowComment = 1;
// Cherche nombre de lignes a venir pour savoir si place suffisante // Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line // if ($i < ($nblignes - 1)) // If it's not last line
{ // {
//Fetch current description to know on which line the next one should be placed // //Fetch current description to know on which line the next one should be placed
$follow_comment = $object->lines[$i]->comments; // $follow_comment = $object->lines[$i]->comments;
$follow_type = $object->lines[$i]->type_fees_code; // $follow_type = $object->lines[$i]->type_fees_code;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) // //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nbLineCommentNeed = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output); // $nbLineCommentNeed = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output);
$nbLineTypeNeed = dol_nboflines_bis($follow_type,4,$outputlangs->charset_output); // $nbLineTypeNeed = dol_nboflines_bis($follow_type,4,$outputlangs->charset_output);
$nblineFollowComment = max($nbLineCommentNeed, $nbLineTypeNeed); // $nblineFollowComment = max($nbLineCommentNeed, $nbLineTypeNeed);
} // }
$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Passe espace entre les lignes //$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Passe espace entre les lignes
$nexY += ($pdf->getFontSize()*1.3); // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages // Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) while ($pagenb < $pageposafter)
@ -524,7 +489,7 @@ class pdf_standard extends ModeleExpenseReport
// Pied de page // Pied de page
$this->_pagefoot($pdf,$object,$outputlangs); $this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPage();
$pdf->Close(); $pdf->Close();
@ -556,7 +521,87 @@ class pdf_standard extends ModeleExpenseReport
} }
} }
/** /**
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $linenumber line number
* @param int $curY current y position
* @param int $default_font_size default siez of font
* @param Translate $outputlangs Object lang for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
*/
private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails=0)
{
global $conf;
$pdf->SetFont('','', $default_font_size - 1);
// Accountancy piece
$pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $linenumber + 1, 0, 1);
// Date
//$pdf->SetXY($this->posxdate -1, $curY);
//$pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4, dol_print_date($object->lines[$linenumber]->date,"day",false,$outputlangs), 0, 'C');
// Type
$pdf->SetXY($this->posxtype -1, $curY);
$nextColumnPosX = $this->posxup;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$nextColumnPosX = $this->posxtva;
}
if (!empty($conf->projet->enabled)) {
$nextColumnPosX = $this->posxprojet;
}
$expensereporttypecode = $object->lines[$linenumber]->type_fees_code;
$expensereporttypecodetoshow = $outputlangs->trans($expensereporttypecode);
if ($expensereporttypecodetoshow == $expensereporttypecode) {
$expensereporttypecodetoshow = preg_replace('/^(EX_|TF_)/', '', $expensereporttypecodetoshow);
}
//$expensereporttypecodetoshow = dol_trunc($expensereporttypecodetoshow, 9);
//$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C');
// Project
//if (! empty($conf->projet->enabled))
//{
// $pdf->SetFont('','', $default_font_size - 1);
// $pdf->SetXY($this->posxprojet, $curY);
// $pdf->MultiCell($this->posxtva-$this->posxprojet-0.8, 4, $object->lines[$linenumber]->projet_ref, 0, 'C');
//}
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$vat_rate = pdf_getlinevatrate($object, $linenumber, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'R');
}
// Unit price
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$linenumber]->value_unit), 0, 'R');
// Quantity
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$linenumber]->qty, 0, 'R');
// Total with all taxes
$pdf->SetXY($this->postotalttc-1, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
// Comments
$pdf->SetXY($this->posxcomment, $curY );
$comment = $outputlangs->trans("Date").':'. dol_print_date($object->lines[$linenumber]->date,"day",false,$outputlangs).' ';
$comment .= $outputlangs->trans("Type").':'. $expensereporttypecodetoshow.'<br>';
if (! empty($object->lines[$linenumber]->projet_ref)) {
$comment .= $outputlangs->trans("Project").':'. $object->lines[$linenumber]->projet_ref.'<br>';
}
$comment .= $object->lines[$linenumber]->comments;
$pdf->writeHTMLCell($this->posxtva-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $comment, 0, 1);
}
/**
* Show top header of page. * Show top header of page.
* *
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
@ -583,13 +628,12 @@ class pdf_standard extends ModeleExpenseReport
*/ */
// Draft watermark // Draft watermark
if ($object->fk_statut == 0 && ! empty($conf->global->EXPENSEREPORT_DRAFT_WATERMARK)) if ($object->fk_statut == 0 && ! empty($conf->global->EXPENSEREPORT_DRAFT_WATERMARK)) {
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_DRAFT_WATERMARK); pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_DRAFT_WATERMARK);
} }
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);
$posy=$this->marge_haute; $posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-100; $posx=$this->page_largeur-$this->marge_droite-100;
@ -597,16 +641,12 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
// Logo // Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo) if ($this->emetteur->logo) {
{ if (is_readable($logo)) {
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo); $height=pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} } else {
else
{
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size -2); $pdf->SetFont('','B', $default_font_size -2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
@ -651,8 +691,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(111,81,124); $pdf->SetTextColor(111,81,124);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
if ($showaddress) if ($showaddress) {
{
// Sender properties // Sender properties
$carac_emetteur = ''; $carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
@ -674,14 +713,14 @@ class pdf_standard extends ModeleExpenseReport
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
// Show sender frame // Show sender frame
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5); $pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L'); $pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0, 0, 60);
// Show sender name // Show sender name
$pdf->SetXY($posx+2,$posy+3); $pdf->SetXY($posx+2,$posy+3);
@ -690,7 +729,7 @@ class pdf_standard extends ModeleExpenseReport
// Show sender information // Show sender information
$pdf->SetXY($posx+2,$posy+8); $pdf->SetXY($posx+2,$posy+8);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Show recipient // Show recipient
@ -698,15 +737,14 @@ class pdf_standard extends ModeleExpenseReport
$posx=100; $posx=100;
// Show recipient frame // Show recipient frame
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('','B',8); $pdf->SetFont('', 'B', 8);
$pdf->SetXY($posx,$posy-5); $pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L'); $pdf->MultiCell(80, 5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre); $pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
// Informations for trip (dates and users workflow) // Informations for trip (dates and users workflow)
if ($object->fk_user_author > 0) if ($object->fk_user_author > 0) {
{
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_author); $posy+=3; $userfee->fetch($object->fk_user_author); $posy+=3;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
@ -719,8 +757,7 @@ class pdf_standard extends ModeleExpenseReport
if ($object->fk_statut==99) if ($object->fk_statut==99)
{ {
if ($object->fk_user_refuse > 0) if ($object->fk_user_refuse > 0) {
{
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_refuse); $posy+=6; $userfee->fetch($object->fk_user_refuse); $posy+=6;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
@ -735,8 +772,7 @@ class pdf_standard extends ModeleExpenseReport
} }
else if($object->fk_statut==4) else if($object->fk_statut==4)
{ {
if ($object->fk_user_cancel > 0) if ($object->fk_user_cancel > 0) {
{
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_cancel); $posy+=6; $userfee->fetch($object->fk_user_cancel); $posy+=6;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
@ -751,8 +787,7 @@ class pdf_standard extends ModeleExpenseReport
} }
else else
{ {
if ($object->fk_user_approve > 0) if ($object->fk_user_approve > 0) {
{
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_approve); $posy+=6; $userfee->fetch($object->fk_user_approve); $posy+=6;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
@ -763,10 +798,8 @@ class pdf_standard extends ModeleExpenseReport
} }
} }
if($object->fk_statut==6) if($object->fk_statut==6) {
{ if ($object->fk_user_paid > 0) {
if ($object->fk_user_paid > 0)
{
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_paid); $posy+=6; $userfee->fetch($object->fk_user_paid); $posy+=6;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
@ -805,8 +838,8 @@ class pdf_standard extends ModeleExpenseReport
// Amount in (at tab_top - 1) // Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('', '', $default_font_size - 2);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
@ -815,61 +848,55 @@ class pdf_standard extends ModeleExpenseReport
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param // line prend une position y en 3eme param
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
} }
$pdf->SetFont('','',8); $pdf->SetFont('','',8);
// Accountancy piece // Accountancy piece
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->posxpiece-1, $tab_top+1); $pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxcomment-$this->posxpiece-1,1,'','','R'); $pdf->MultiCell($this->posxcomment-$this->posxpiece-1, 1, '', '', 'R');
} }
// Comments // Comments
$pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height); $pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->posxcomment-1, $tab_top+1); $pdf->SetXY($this->posxcomment-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxcomment-1,1,$outputlangs->transnoentities("Description"),'','L'); $pdf->MultiCell($this->posxdate-$this->posxcomment-1, 1, $outputlangs->transnoentities("Description"),'','L');
} }
// Date // Date
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height); //$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
if (empty($hidetop)) //if (empty($hidetop))
{ //{
$pdf->SetXY($this->posxdate-1, $tab_top+1); // $pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C'); // $pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
} //}
// Type // Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height); //$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
if (empty($hidetop)) //if (empty($hidetop))
{ //{
$pdf->SetXY($this->posxtype-1, $tab_top+1); // $pdf->SetXY($this->posxtype-1, $tab_top+1);
$pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C'); // $pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
} //}
if (!empty($conf->projet->enabled)) //if (!empty($conf->projet->enabled))
{ //{
// Project // // Project
$pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height); // $pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
if (empty($hidetop)) // if (empty($hidetop)) {
{ // $pdf->SetXY($this->posxprojet - 1, $tab_top + 1);
$pdf->SetXY($this->posxprojet - 1, $tab_top + 1); // $pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C');
$pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C'); // }
} //}
}
// VAT // VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->posxtva-1, $tab_top+1); $pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C'); $pdf->MultiCell($this->posxup-$this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
} }
@ -877,24 +904,21 @@ class pdf_standard extends ModeleExpenseReport
// Unit price // Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C'); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
} }
// Quantity // Quantity
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty - 1,2, $outputlangs->transnoentities("Qty"),'','R'); $pdf->MultiCell($this->postotalttc-$this->posxqty - 1,2, $outputlangs->transnoentities("Qty"),'','R');
} }
// Total with all taxes // Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop)) {
{
$pdf->SetXY($this->postotalttc-1, $tab_top+1); $pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
} }
@ -914,7 +938,7 @@ class pdf_standard extends ModeleExpenseReport
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{ {
global $conf; global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'EXPENSEREPORT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

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

@ -49,7 +49,7 @@ class modAdherent extends DolibarrModules
$this->numero = 310; $this->numero = 310;
$this->family = "hr"; $this->family = "hr";
$this->module_position = '20'; $this->module_position = '55';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Management of members of a foundation or association"; $this->description = "Management of members of a foundation or association";

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

@ -46,7 +46,7 @@ class modEmailCollector extends DolibarrModules
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50320; $this->numero = 50320;
// Key text used to identify module (for permissions, menus, etc...) // Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'dav'; $this->rights_class = 'emailcollector';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page // It is used to group modules by family in module setup page
@ -64,7 +64,7 @@ class modEmailCollector extends DolibarrModules
$this->descriptionlong = "EmailCollectorDescription"; $this->descriptionlong = "EmailCollectorDescription";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'development'; $this->version = 'experimental';
// Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module. // Name of image file used for this module.

View File

@ -225,8 +225,13 @@ class modPropale extends DolibarrModules
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$keyforselect='societe'; $keyforelement='societe'; $keyforaliasextra='extra4';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s ';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object';
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c';

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

@ -107,7 +107,7 @@ class modWebsite extends DolibarrModules
$r=0; $r=0;
$this->menu[$r]=array( 'fk_menu'=>'0', // 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'=>'0', // 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 Left menu entry 'type'=>'top', // This is a Left menu entry
'titre'=>'Websites', 'titre'=>'WebSites',
'mainmenu'=>'website', 'mainmenu'=>'website',
'url'=>'/website/index.php', 'url'=>'/website/index.php',
'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
@ -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

@ -164,7 +164,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $codetouse=preg_replace('/([^a-z0-9])/i','',$codetouse); if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $codetouse=preg_replace('/([^a-z0-9])/i','',$codetouse);
// Remove special alpha if COMPANY_AQUARIUM_REMOVE_ALPHA is set to 1 // Remove special alpha if COMPANY_AQUARIUM_REMOVE_ALPHA is set to 1
if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $codetouse=preg_replace('/([a-z])/i','',$codetouse); if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $codetouse=preg_replace('/([a-z])/i','',$codetouse);
// Apply a regex replacement pattern if COMPANY_AQUARIUM_REMOVE_ALPHA is set to 1 // Apply a regex replacement pattern on code if COMPANY_AQUARIUM_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) // Example: $conf->global->COMPANY_AQUARIUM_CLEAN_REGEX='^..(..)..'; if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) // Example: $conf->global->COMPANY_AQUARIUM_CLEAN_REGEX='^..(..)..';
{ {
$codetouse=preg_replace('/'.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX.'/','\1\2\3',$codetouse); $codetouse=preg_replace('/'.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX.'/','\1\2\3',$codetouse);

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

@ -16,8 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* Javascript code to activate drag and drop on lines * Javascript code to activate drag and drop on lines
* You can use this if you want to be abale to drag and drop rows of a table. * You can use this if you want to be able to drag and drop rows of a table.
* You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0) * You must add id="tablelines" on table level tag
* and $object and $object->id is defined
* and $object->fk_element or $fk_element is defined
* and have ($nboflines or count($object->lines) or count($taskarray) > 0)
* and have $table_element_line = 'tablename' or $object->table_element_line with line to move
*
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
@ -32,7 +37,7 @@ if (empty($object) || ! is_object($object))
<!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on lines of a table --> <!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on lines of a table -->
<?php <?php
$id=$object->id; $id=$object->id;
$fk_element=$object->fk_element; $fk_element=empty($object->fk_element)?$fk_element:$object->fk_element;
$table_element_line=(empty($table_element_line)?$object->table_element_line:$table_element_line); $table_element_line=(empty($table_element_line)?$object->table_element_line:$table_element_line);
$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):(empty($nboflines)?0:$nboflines))); $nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):(empty($nboflines)?0:$nboflines)));
$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;

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

@ -769,7 +769,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0; $object->sendtoid=0;
} }
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg;
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -841,8 +841,13 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->email_subject = $object->email_subject; $actioncomm->email_subject = $object->email_subject;
$actioncomm->errors_to = $object->errors_to; $actioncomm->errors_to = $object->errors_to;
$actioncomm->fk_element = $elementid; // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
$actioncomm->elementtype = $elementtype; // for such objects because there is already a dedicated field into table llx_actioncomm.
if (! in_array($elementtype, array('societe','contact','project')))
{
$actioncomm->fk_element = $elementid;
$actioncomm->elementtype = $elementtype;
}
if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) { if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) {
$actioncomm->attachedfiles=$object->attachedfiles; $actioncomm->attachedfiles=$object->attachedfiles;

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

@ -653,7 +653,7 @@ class Don extends CommonObject
} }
else if (! empty($ref)) else if (! empty($ref))
{ {
$sql.= " AND ref='".$this->db->escape($ref)."'"; $sql.= " AND d.ref='".$this->db->escape($ref)."'";
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -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

@ -55,6 +55,16 @@ class EmailCollector extends CommonObject
*/ */
public $picto = 'generic'; public $picto = 'generic';
/**
* @var int Field with ID of parent key if this field has a parent
*/
public $fk_element = 'fk_emailcollector';
/**
* @var array Array of child tables (child tables to delete before deleting a record)
*/
protected $childtables=array('emailcollector_emailcollectorfilter', 'emailcollector_emailcollectoraction');
/** /**
* 'type' if the field format. * 'type' if the field format.
@ -382,7 +392,7 @@ class EmailCollector extends CommonObject
*/ */
public function delete(User $user, $notrigger = false) public function delete(User $user, $notrigger = false)
{ {
return $this->deleteCommon($user, $notrigger); return $this->deleteCommon($user, $notrigger, 1);
} }
/** /**
@ -602,7 +612,10 @@ class EmailCollector extends CommonObject
{ {
$this->filters = array(); $this->filters = array();
$sql='SELECT rowid, type, rulevalue, status FROM '.MAIN_DB_PREFIX.'emailcollector_emailcollectorfilter WHERE fk_emailcollector = '.$this->id; $sql = 'SELECT rowid, type, rulevalue, status';
$sql.= ' FROM '.MAIN_DB_PREFIX.'emailcollector_emailcollectorfilter';
$sql.= ' WHERE fk_emailcollector = '.$this->id;
//$sql.= ' ORDER BY position';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -631,7 +644,10 @@ class EmailCollector extends CommonObject
{ {
$this->actions = array(); $this->actions = array();
$sql='SELECT rowid, type, actionparam, status FROM '.MAIN_DB_PREFIX.'emailcollector_emailcollectoraction WHERE fk_emailcollector = '.$this->id; $sql = 'SELECT rowid, type, actionparam, status';
$sql.= ' FROM '.MAIN_DB_PREFIX.'emailcollector_emailcollectoraction';
$sql.= ' WHERE fk_emailcollector = '.$this->id;
$sql.= ' ORDER BY position';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -691,7 +707,7 @@ class EmailCollector extends CommonObject
$this->error.='EmailCollector ID '.$emailcollector->id.':'.$emailcollector->error.'<br>'; $this->error.='EmailCollector ID '.$emailcollector->id.':'.$emailcollector->error.'<br>';
if (! empty($emailcollector->errors)) $this->error.=join('<br>', $emailcollector->errors); if (! empty($emailcollector->errors)) $this->error.=join('<br>', $emailcollector->errors);
$this->output.='EmailCollector ID '.$emailcollector->id.': '.$emailcollector->output.'<br>'; $this->output.='EmailCollector ID '.$emailcollector->id.': '.$emailcollector->lastresult.'<br>';
} }
return $nberror; return $nberror;
@ -739,21 +755,21 @@ class EmailCollector extends CommonObject
$sourcestring=''; $sourcestring='';
$sourcefield=''; $sourcefield='';
$regexstring=''; $regexstring='';
$transformationstring=''; //$transformationstring='';
$regforregex=array(); $regforregex=array();
if (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*):([^:])$/', $valueforproperty, $regforregex)) if (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*):([^:])$/', $valueforproperty, $regforregex))
{ {
$sourcefield=$regforregex[0]; $sourcefield=$regforregex[1];
$regexstring=$regforregex[1]; $regexstring=$regforregex[2];
$transofrmationstring=$regforregex[2]; //$transofrmationstring=$regforregex[3];
} }
elseif (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex)) elseif (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
{ {
$sourcefield=$regforregex[0]; $sourcefield=$regforregex[1];
$regexstring=$regforregex[1]; $regexstring=$regforregex[2];
} }
if (! empty($sourcestring) && ! empty($regexstring)) if (! empty($sourcefield) && ! empty($regexstring))
{ {
if (strtolower($sourcefield) == 'body') $sourcestring=$messagetext; if (strtolower($sourcefield) == 'body') $sourcestring=$messagetext;
elseif (strtolower($sourcefield) == 'subject') $sourcestring=$subject; elseif (strtolower($sourcefield) == 'subject') $sourcestring=$subject;
@ -762,7 +778,7 @@ class EmailCollector extends CommonObject
if (preg_match('/'.preg_quote($regexstring, '/').'/', $sourcestring, $regforval)) if (preg_match('/'.preg_quote($regexstring, '/').'/', $sourcestring, $regforval))
{ {
// Overwrite param $tmpproperty // Overwrite param $tmpproperty
$object->$tmpproperty = $regforval[0]; $object->$tmpproperty = $regforval[1];
} }
else else
{ {
@ -771,7 +787,7 @@ class EmailCollector extends CommonObject
} }
elseif (preg_match('/^VALUE:(.*)$/', $valueforproperty, $reg)) elseif (preg_match('/^VALUE:(.*)$/', $valueforproperty, $reg))
{ {
$object->$tmpproperty = $reg[0]; $object->$tmpproperty = $reg[1];
} }
else else
{ {
@ -800,7 +816,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG); dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "errors")); $langs->loadLangs(array("project", "companies", "mails", "errors"));
$error = 0; $error = 0;
$this->output = ''; $this->output = '';
@ -848,6 +864,8 @@ class EmailCollector extends CommonObject
//$search='ALL'; //$search='ALL';
$search='UNDELETED'; $search='UNDELETED';
$searchfilterdoltrackid=0;
$searchfilternodoltrackid=0;
foreach($this->filters as $rule) foreach($this->filters as $rule)
{ {
if (empty($rule['status'])) continue; if (empty($rule['status'])) continue;
@ -860,6 +878,8 @@ class EmailCollector extends CommonObject
if ($rule['type'] == 'body') $search.=($search?' ':'').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; if ($rule['type'] == 'body') $search.=($search?' ':'').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"';
if ($rule['type'] == 'seen') $search.=($search?' ':'').'SEEN'; if ($rule['type'] == 'seen') $search.=($search?' ':'').'SEEN';
if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN'; if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN';
if ($rule['type'] == 'withtrackingid') $searchfilterdoltrackid++;
if ($rule['type'] == 'withouttrackingid') $searchfilternodoltrackid++;
} }
if (empty($targetdir)) // Use last date as filter if there is no targetdir defined. if (empty($targetdir)) // Use last date as filter if there is no targetdir defined.
@ -886,6 +906,36 @@ class EmailCollector extends CommonObject
{ {
if ($nbemailprocessed > 100) break; // Do not process more than 100 email per launch if ($nbemailprocessed > 100) break; // Do not process more than 100 email per launch
$header = imap_fetchheader($connection, $imapemail, 0);
$matches=array();
preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches);
$headers = array_combine($matches[1], $matches[2]);
//var_dump($headers);
// $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined
$host=dol_getprefix('email');
// If there is a filter on trackid
//var_dump($host);exit;
if ($searchfilterdoltrackid > 0)
{
//if (empty($headers['X-Dolibarr-TRACKID'])) continue;
if (empty($headers['References']) || ! preg_match('/@'.preg_quote($host,'/').'/', $headers['References']))
{
$nbemailprocessed++;
continue;
}
}
if ($searchfilternodoltrackid > 0)
{
if (! empty($headers['References']) && preg_match('/@'.preg_quote($host,'/').'/', $headers['References']))
{
$nbemailprocessed++;
continue;
}
//if (! empty($headers['X-Dolibarr-TRACKID']) continue;
}
$thirdpartystatic=new Societe($this->db); $thirdpartystatic=new Societe($this->db);
$contactstatic=new Contact($this->db); $contactstatic=new Contact($this->db);
$projectstatic=new Project($this->db); $projectstatic=new Project($this->db);
@ -899,29 +949,129 @@ class EmailCollector extends CommonObject
$this->db->begin(); $this->db->begin();
$overview = imap_fetch_overview($connection, $imapemail, 0);
$header = imap_fetchheader($connection, $imapemail, 0);
//$message = imap_body($connection, $imapemail, 0); //$message = imap_body($connection, $imapemail, 0);
$overview = imap_fetch_overview($connection, $imapemail, 0);
$structure = imap_fetchstructure($connection, $imapemail, 0); $structure = imap_fetchstructure($connection, $imapemail, 0);
$partplain = $parthtml = -1; $partplain = $parthtml = -1;
// Loop to get part html and plain // Loop to get part html and plain
foreach($structure->parts as $key => $part) /*
0 multipart/mixed
1 multipart/alternative
1.1 text/plain
1.2 text/html
2 message/rfc822
2 multipart/mixed
2.1 multipart/alternative
2.1.1 text/plain
2.1.2 text/html
2.2 message/rfc822
2.2 multipart/alternative
2.2.1 text/plain
2.2.2 text/html
*/
/**
* create_part_array
*
* @param Object $structure Structure
* @param string $prefix prefix
* @return array Array with number and object
*/
function createPartArray($structure, $prefix="")
{ {
if ($part->subtype == 'HTML') $parthtml=$key; //print_r($structure);
if ($part->subtype == 'PLAIN') $partplain=$key; if (count($structure->parts) > 0) { // There some sub parts
foreach ($structure->parts as $count => $part) {
add_part_to_array($part, $prefix.($count+1), $part_array);
}
}else{ // Email does not have a seperate mime attachment for text
$part_array[] = array('part_number' => $prefix.'1', 'part_object' => $obj);
}
return $part_array;
} }
$matches=array(); /**
preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); * Sub function for createPartArray(). Only called by createPartArray() and itself.
$headers = array_combine($matches[1], $matches[2]); *
//var_dump($headers); * @param Object $obj Structure
* @param string $partno Part no
* @param array $part_array array
* @return void
*/
function addPartToArray($obj, $partno, &$part_array)
{
$part_array[] = array('part_number' => $partno, 'part_object' => $obj);
if ($obj->type == 2) { // Check to see if the part is an attached email message, as in the RFC-822 type
//print_r($obj);
if (array_key_exists('parts',$obj)) { // Check to see if the email has parts
foreach ($obj->parts as $count => $part) {
// Iterate here again to compensate for the broken way that imap_fetchbody() handles attachments
if (count($part->parts) > 0) {
foreach ($part->parts as $count2 => $part2) {
addPartToArray($part2, $partno.".".($count2+1), $part_array);
}
}else{ // Attached email does not have a seperate mime attachment for text
$part_array[] = array('part_number' => $partno.'.'.($count+1), 'part_object' => $obj);
}
}
}else{ // Not sure if this is possible
$part_array[] = array('part_number' => $partno.'.1', 'part_object' => $obj);
}
}else{ // If there are more sub-parts, expand them out.
if (array_key_exists('parts',$obj)) {
foreach ($obj->parts as $count => $p) {
addPartToArray($p, $partno.".".($count+1), $part_array);
}
}
}
}
$messagetext = imap_fetchbody($connection, $imapemail, ($parthtml >= 0 ? $parthtml : ($partplain >= 0 ? $partplain : 0))); $result = createPartArray($structure, '');
//var_dump($result);exit;
foreach($result as $part)
{
if ($part['part_object']->subtype == 'HTML') $parthtml=$part['part_number'];
if ($part['part_object']->subtype == 'PLAIN') $partplain=$part['part_number'];
}
/* OLD CODE to get parthtml and partplain
if (count($structure->parts) > 0) { // There some sub parts
foreach($structure->parts as $key => $part)
{
if ($part->subtype == 'HTML') $parthtml=($key+1); // For example: $parthtml = 1 or 2
if ($part->subtype == 'PLAIN') $partplain=($key+1);
if ($part->subtype == 'ALTERNATIVE')
{
if (count($part->parts) > 0)
{
foreach($part->parts as $key2 => $part2)
{
if ($part2->subtype == 'HTML') $parthtml=($key+1).'.'.($key2+1); // For example: $parthtml = 1.1 or 1.2
if ($part2->subtype == 'PLAIN') $partplain=($key+1).'.'.($key2+1);
}
}
else
{
$partplain=($key+1).'.1';
}
}
}
}
else
{
$partplain=1;
}*/
//var_dump($structure);
//var_dump($parthtml);var_dump($partplain);
$messagetext = imap_fetchbody($connection, $imapemail, ($parthtml != '-1' ? $parthtml : ($partplain != '-1' ? $partplain : 0)), FT_PEEK);
//var_dump($overview); //var_dump($overview);
//var_dump($header); //var_dump($header);
//var_dump($message); //var_dump($message);
//var_dump($messagetext); //var_dump($structure->parts[0]->parts);
//var_dump($messagetext);exit;
$fromstring=$overview[0]->from; $fromstring=$overview[0]->from;
$sender=$overview[0]->sender; $sender=$overview[0]->sender;
$to=$overview[0]->to; $to=$overview[0]->to;
@ -935,8 +1085,8 @@ class EmailCollector extends CommonObject
$reg=array(); $reg=array();
if (preg_match('/^(.*)<(.*)>$/', $fromstring, $reg)) if (preg_match('/^(.*)<(.*)>$/', $fromstring, $reg))
{ {
$from=$reg[1]; $from=$reg[2];
$fromtext=$reg[0]; $fromtext=$reg[1];
} }
else else
{ {
@ -947,12 +1097,13 @@ class EmailCollector extends CommonObject
$contactid = 0; $thirdpartyid = 0; $projectid = 0; $contactid = 0; $thirdpartyid = 0; $projectid = 0;
// Analyze TrackId // Analyze TrackId in field References
// For example: References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e>
$trackid = ''; $trackid = '';
$reg=array(); $reg=array();
if (! empty($headers['X-Dolibarr-TrackId']) && preg_match('/:\s*([a-z]+)([0-9]+)$/', $headers['X-Dolibarr-TrackId'], $reg)) if (! empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host,'/').'/', $headers['References'], $reg))
{ {
$trackid = $reg[0].$reg[1]; $trackid = $reg[1].$reg[2];
$objectid = 0; $objectid = 0;
$objectemail = null; $objectemail = null;
@ -982,17 +1133,20 @@ class EmailCollector extends CommonObject
$objectemail = new User($this->db); $objectemail = new User($this->db);
} }
$result = $objectemail->fetch($objectid); if (is_object($objectemail))
if ($result > 0)
{ {
$fk_element_id = $objectemail->id; $result = $objectemail->fetch($objectid);
$fk_element_type = $objectemail->element; if ($result > 0)
// Fix fk_element_type {
if ($fk_element_type == 'facture') $fk_element_type = 'invoice'; $fk_element_id = $objectemail->id;
$fk_element_type = $objectemail->element;
// Fix fk_element_type
if ($fk_element_type == 'facture') $fk_element_type = 'invoice';
$thirdpartyid = $objectemail->fk_soc; $thirdpartyid = $objectemail->fk_soc;
$contactid = $objectemail->fk_socpeople; $contactid = $objectemail->fk_socpeople;
$projectid = isset($objectemail->fk_project)?$objectemail->fk_project:$objectemail->fk_projet; $projectid = isset($objectemail->fk_project)?$objectemail->fk_project:$objectemail->fk_projet;
}
} }
// Project // Project
@ -1067,14 +1221,113 @@ class EmailCollector extends CommonObject
if (empty($operation['status'])) continue; if (empty($operation['status'])) continue;
// Make Operation // Make Operation
dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
// Search and create thirdparty // Search and create thirdparty
if ($operation['type'] == 'searchandcreatethirdparty') if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty')
{ {
if (empty($operation['actionparam']))
{
$errorforactions++;
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'VALUE:xxx' or 'REGEX:(body|subject):regex' to define how to extract data";
$this->errors[] = $this->error;
}
else
{
$actionparam = $operation['actionparam'];
$nametouseforthirdparty='';
// $this->actionparam = 'VALUE:aaa' or 'REGEX:BODY:....'
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
{
$sourcestring='';
$sourcefield='';
$regexstring='';
$regforregex=array();
if (preg_match('/^REGEX:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex))
{
$sourcefield=$regforregex[1];
$regexstring=$regforregex[2];
}
if (! empty($sourcefield) && ! empty($regexstring))
{
if (strtolower($sourcefield) == 'body') $sourcestring=$messagetext;
elseif (strtolower($sourcefield) == 'subject') $sourcestring=$subject;
$regforval=array();
if (preg_match('/'.$regexstring.'/', $sourcestring, $regforval)) // Do not use preg_quote here, string is already a regex syntax, for example string is 'Name:\s([^\s]*)'
{
// Overwrite param $tmpproperty
$nametouseforthirdparty = $regforval[1];
}
else
{
// Nothing can be done for this param
}
//var_dump($sourcestring); var_dump($regexstring);var_dump($nametouseforthirdparty);exit;
}
elseif (preg_match('/^VALUE:(.*)$/', $valueforproperty, $reg))
{
$nametouseforthirdparty = $reg[1];
}
else
{
$errorforactions++;
$this->error = 'Bad syntax for description of action parameters: '.$actionparam;
$this->errors[] = $this->error;
break;
}
}
if (! $errorforactions && $nametouseforthirdparty)
{
$result = $thirdpartystatic->fetch(0, $nametouseforthirdparty);
if ($result < 0)
{
$errorforactions++;
$this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)';
$this->errors[] = $this->error;
break;
}
elseif ($result == 0)
{
if ($operation['type'] == 'loadandcreatethirdparty')
{
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found. We try to create it.");
// Create thirdparty
$thirdpartystatic->name = $nametouseforthirdparty;
if ($fromtext != $nametouseforthirdparty) $thirdpartystatic->name_alias = $fromtext;
$thirdpartystatic->email = $from;
// Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject);
if ($errorforthisaction)
{
$errorforactions++;
}
else
{
$result = $thirdpartystatic->create($user);
if ($result <= 0)
{
$errorforactions++;
$this->error = $thirdpartystatic->error;
$this->errors = $thirdpartystatic->errors;
}
}
}
else
{
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found");
}
}
}
}
} }
// Create event // Create event
elseif ($operation['type'] == 'recordevent') elseif ($operation['type'] == 'recordevent')
@ -1086,7 +1339,7 @@ class EmailCollector extends CommonObject
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode; $actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $langs->trans("EmailReceived").' - '.$langs->trans("From").' '.$from; $actioncomm->label = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("MailFrom").' '.$from;
$actioncomm->note = $messagetext; $actioncomm->note = $messagetext;
$actioncomm->fk_project = $projectstatic->id; $actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date; $actioncomm->datep = $date;
@ -1106,12 +1359,14 @@ class EmailCollector extends CommonObject
$actioncomm->email_subject = $subject; $actioncomm->email_subject = $subject;
$actioncomm->errors_to = ''; $actioncomm->errors_to = '';
$actioncomm->fk_element = $fk_element_id; if (! in_array($fk_element_type, array('societe','contact','project','user')))
$actioncomm->elementtype = $fk_element_type; {
$actioncomm->fk_element = $fk_element_id;
$actioncomm->elementtype = $fk_element_type;
}
//$actioncomm->extraparams = $extraparams; //$actioncomm->extraparams = $extraparams;
// Overwrite values with values extracted from source email // Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncommn, $operation['actionparam'], $messagetext, $subject); $errorforthisaction = $this->overwritePropertiesOfObject($actioncommn, $operation['actionparam'], $messagetext, $subject);
@ -1136,7 +1391,7 @@ class EmailCollector extends CommonObject
$projecttocreate = new Project($this->db); $projecttocreate = new Project($this->db);
if ($thirdpartystatic->id > 0) if ($thirdpartystatic->id > 0)
{ {
$projecttocreate->fk_soc = $thirdpartystatic->id; $projecttocreate->socid = $thirdpartystatic->id;
if ($thirdpartyfoundby) $note_private .= ' - Third party found from '.$thirdpartyfoundby; if ($thirdpartyfoundby) $note_private .= ' - Third party found from '.$thirdpartyfoundby;
} }
if ($contactstatic->id > 0) if ($contactstatic->id > 0)
@ -1150,9 +1405,10 @@ class EmailCollector extends CommonObject
$projecttocreate->title = $subject; $projecttocreate->title = $subject;
$projecttocreate->date_start = $now; $projecttocreate->date_start = $now;
$projecttocreate->date_end = '';
$projecttocreate->opp_status = $id_opp_status; $projecttocreate->opp_status = $id_opp_status;
$projecttocreate->opp_percent = $percent_opp_status; $projecttocreate->opp_percent = $percent_opp_status;
$projecttocreate->description = ($note_private?$note_private."\n":'').$messagetext; $projecttocreate->description = ($note_private?$note_private."\n":'').dol_string_nohtmltag($messagetext, 2);
$projecttocreate->note_private = $note_private; $projecttocreate->note_private = $note_private;
$projecttocreate->entity = $conf->entity; $projecttocreate->entity = $conf->entity;
@ -1161,7 +1417,7 @@ class EmailCollector extends CommonObject
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
// Search template files // Search template files
$file=''; $classname=''; $filefound=0; $file=''; $classname=''; $filefound=0; $reldir='';
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir) foreach($dirmodels as $reldir)
{ {
@ -1277,6 +1533,7 @@ class EmailCollector extends CommonObject
$this->datelastresult = $now; $this->datelastresult = $now;
$this->lastresult = $output; $this->lastresult = $output;
if (! empty($this->errors)) $this->lastresult.= " - ".join(" - ", $this->errors); if (! empty($this->errors)) $this->lastresult.= " - ".join(" - ", $this->errors);
$this->codelastresult = ($error ? 'KO' : 'OK'); $this->codelastresult = ($error ? 'KO' : 'OK');
$this->update($user); $this->update($user);

View File

@ -83,13 +83,14 @@ 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,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'position' => array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>1, 'position'=>600, 'default'=>'0',),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')),
); );
@ -101,6 +102,7 @@ class EmailCollectorAction extends CommonObject
public $tms; public $tms;
public $fk_user_creat; public $fk_user_creat;
public $fk_user_modif; public $fk_user_modif;
public $position;
public $import_key; public $import_key;
public $status; public $status;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES

View File

@ -159,7 +159,7 @@ class EmailCollectorFilter extends CommonObject
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); $this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
return -1; return -1;
} }
if (! in_array($this->type, array('seen','unseen')) && empty($this->rulevalue)) if (! in_array($this->type, array('seen','unseen','withtrackingid','withouttrackingid')) && empty($this->rulevalue))
{ {
$langs->load("errors"); $langs->load("errors");
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StringToFilter")); $this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StringToFilter"));

View File

@ -213,7 +213,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
$h=0; $h=0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php?mode='.$mode; $head[$h][0] = DOL_URL_ROOT . '/expedition/stats/index.php?mode='.$mode;
$head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear'; $head[$h][2] = 'byyear';
$h++; $h++;

View File

@ -1925,7 +1925,7 @@ else
print $paymentexpensereportstatic->getNomUrl(1); print $paymentexpensereportstatic->getNomUrl(1);
print '</td>'; print '</td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n"; print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
$labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->fk_typepayment; $labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->payment_type;
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n"; print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {

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