Merge remote-tracking branch 'upstream/develop' into 9.0_accountancy

This commit is contained in:
Alexandre SPANGARO 2018-10-20 06:35:39 +02:00
commit d3856d9289
58 changed files with 6727 additions and 442 deletions

View File

@ -1,6 +1,7 @@
# DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|6|7|8|develop|
|----------|----------|----------|----------|

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy", "bills", "compta"));
@ -49,12 +50,21 @@ if ($user->societe_id > 0) {
$mesg = '';
$account_number = GETPOST('account_number','alphanohtml');
$accountingaccount = new AccountingAccount($db);
$accountingjournal = new AccountingJournal($db);
$accountingaccount_number = GETPOST('accountingaccount_number','alphanohtml');
$accountingaccount->fetch(null, $accountingaccount_number, true);
$accountingaccount_label = $accountingaccount->label;
$journal_code = GETPOST('code_journal','alpha');
$accountingjournal->fetch(null, $journal_code);
$journal_label = $accountingjournal->label;
$subledger_account = GETPOST('subledger_account','alphanohtml');
if ($subledger_account == - 1) {
$subledger_account = null;
}
$label_compte = GETPOST('label_compte','alphanohtml');
$label_operation= GETPOST('label_operation','alphanohtml');
$debit = price2num(GETPOST('debit','alpha'));
$credit = price2num(GETPOST('credit','alpha'));
@ -80,7 +90,7 @@ if ($action == "confirm_update") {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action='update';
}
if (empty($account_number) || $account_number == '-1')
if (empty($accountingaccount_number) || $accountingaccount_number == '-1')
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
@ -96,9 +106,9 @@ if ($action == "confirm_update") {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
} else {
$object->numero_compte = $account_number;
$object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account;
$object->label_compte = $label_compte;
$object->label_compte = $accountingaccount_label;
$object->label_operation= $label_operation;
$object->debit = $debit;
$object->credit = $credit;
@ -139,7 +149,7 @@ else if ($action == "add") {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action='';
}
if (empty($account_number) || $account_number == '-1')
if (empty($accountingaccount_number) || $accountingaccount_number == '-1')
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
@ -149,9 +159,9 @@ else if ($action == "add") {
if (! $error) {
$object = new BookKeeping($db);
$object->numero_compte = $account_number;
$object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account;
$object->label_compte = $label_compte;
$object->label_compte = $accountingaccount_label;
$object->label_operation= $label_operation;
$object->debit = $debit;
$object->credit = $credit;
@ -159,7 +169,8 @@ else if ($action == "add") {
$object->doc_type = GETPOST('doc_type','alpha');
$object->piece_num = $piece_num;
$object->doc_ref = GETPOST('doc_ref','alpha');
$object->code_journal = GETPOST('code_journal','alpha');
$object->code_journal = $journal_code;
$object->journal_label = $journal_label;
$object->fk_doc = GETPOST('fk_doc','alpha');
$object->fk_docdet = GETPOST('fk_docdet','alpha');
@ -212,7 +223,7 @@ else if ($action == "confirm_create") {
$object = new BookKeeping($db);
if (! GETPOST('code_journal','alpha') || GETPOST('code_journal','alpha') == '-1') {
if (! $journal_code || $journal_code == '-1') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
$action='create';
$error++;
@ -232,7 +243,8 @@ else if ($action == "confirm_create") {
$object->doc_type = GETPOST('doc_type','alpha');
$object->piece_num = GETPOST('next_num_mvt','alpha');
$object->doc_ref = GETPOST('doc_ref','alpha');
$object->code_journal = GETPOST('code_journal','alpha');
$object->code_journal = $journal_code;
$object->journal_label = $journal_label;
$object->fk_doc = 0;
$object->fk_docdet = 0;
$object->montant = 0;
@ -267,8 +279,8 @@ if ($action == 'setdate') {
}
if ($action == 'setjournal') {
$journaldoc = trim(GETPOST('code_journal','alpha'));
$result = $object->updateByMvt($piece_num, 'code_journal', $journaldoc, $mode);
$result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode);
$result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
@ -312,7 +324,6 @@ if ($action == 'valid') {
$html = new Form($db);
$formaccounting = new FormAccounting($db);
$accountjournal = new AccountingJournal($db);
llxHeader('', $langs->trans("CreateMvts"));
@ -357,7 +368,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal', 'alpha'),'code_journal',0,1,array(),1,1) . '</td>';
print '<td>' . $formaccounting->select_journal($journal_code,'code_journal',0,0,1,1) . '</td>';
print '</tr>';
print '<tr>';
@ -460,7 +471,7 @@ if ($action == 'create')
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $object->code_journal ;
print $object->code_journal ;
}
print '</td>';
print '</tr>';
@ -590,7 +601,6 @@ if ($action == 'create')
print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("LabelAccount");
print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
@ -605,7 +615,7 @@ if ($action == 'create')
if ($action == 'update' && $line->id == $id) {
print '<td>';
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
print $formaccounting->select_account($line->numero_compte, 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
@ -619,7 +629,6 @@ if ($action == 'create')
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
}
print '</td>';
print '<td><input type="text" class="minwidth100" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $line->label_operation. '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
@ -628,9 +637,9 @@ if ($action == 'create')
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
print '</td>';
} else {
print '<td>' . length_accountg($line->numero_compte) . '</td>';
$accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>' . $accountingaccount->getNomUrl(0,1,1,'',0) . '</td>';
print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->label_operation. '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
@ -663,7 +672,7 @@ if ($action == 'create')
if ($action == "" || $action == 'add') {
print '<tr class="oddeven">';
print '<td>';
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, '');
print $formaccounting->select_account($accountingaccount_number, 'accountingaccount_number', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
@ -677,7 +686,6 @@ if ($action == 'create')
print '<input type="text" name="subledger_account" value="">';
}
print '</td>';
print '<td><input type="text" class="minwidth100" name="label_compte" value=""/></td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value=""/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -816,9 +817,9 @@ class AccountancyCategory // extends CommonObject
* Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter)
*
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array|int Array of accounting accounts or -1 if error
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array|int Array of accounting accounts or -1 if error
*/
public function getCptsCat($cat_id, $predefinedgroupwhere='')
{

View File

@ -380,6 +380,66 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of civility.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $module To filter on module events
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types
*
* @url GET dictionary/civility
*
* @throws RestException
*/
function getListOfCivility($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $sqlfilters = '')
{
$list = array();
$sql = "SELECT rowid, code, label, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_civility as t";
$sql.= " WHERE t.active = 1";
if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'";
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of civility : '.$this->db->lasterror());
}
return $list;
}
/**
* Get the list of extra fields.

View File

@ -10,6 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -805,7 +806,7 @@ class Categorie extends CommonObject
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @return array Array of categories
* @return array|int Array of categories, 0 if no cat, -1 on error
*/
function getListForItem($id, $type='customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
@ -974,7 +975,7 @@ class Categorie extends CommonObject
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/
function get_full_arbo($type, $markafterid=0)
{
@ -1126,7 +1127,7 @@ class Categorie extends CommonObject
*
* @param int $type Type of category (0, 1, ...)
* @param boolean $parent Just parent categories if true
* @return array Table of Object Category
* @return array|int Table of Object Category, -1 on error
*/
function get_all_categories($type=null, $parent=false)
{
@ -1441,7 +1442,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false)
* @return array Array of category id
* @return array|int Array of category id, -1 if error
*/
function rechercher($id, $nom, $type, $exact = false, $case = false)
{

View File

@ -155,7 +155,7 @@ class Commande extends CommonOrder
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
public $demand_reason_code;
public $date; // Date commande
/**
* @deprecated
* @see date
@ -1620,7 +1620,7 @@ class Commande extends CommonOrder
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql.= ', c.fk_account';
$sql.= ', c.date_commande';
$sql.= ', c.date_commande, c.date_valid, c.tms';
$sql.= ', c.date_livraison';
$sql.= ', c.fk_shipping_method';
$sql.= ', c.fk_warehouse';
@ -1673,6 +1673,9 @@ class Commande extends CommonOrder
$this->total_ttc = $obj->total_ttc;
$this->date = $this->db->jdate($obj->date_commande);
$this->date_commande = $this->db->jdate($obj->date_commande);
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_validation = $this->db->jdate($obj->date_valid);
$this->date_modification = $this->db->jdate($obj->tms);
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;

View File

@ -695,6 +695,9 @@ if (empty($reshook))
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc;
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i ++;
}
}
@ -750,6 +753,9 @@ if (empty($reshook))
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create($user);

View File

@ -110,8 +110,6 @@ class Facture extends CommonInvoice
public $fk_user_valid;
public $date; // Date invoice
public $date_creation; // Creation date
public $date_validation; // Validation date
public $datem;
public $ref_client;
public $ref_int;
@ -1361,6 +1359,7 @@ class Facture extends CommonInvoice
$this->date_pointoftax = $this->db->jdate($obj->date_pointoftax);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = $this->db->jdate($obj->datem);
$this->datem = $this->db->jdate($obj->datem);
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
@ -1771,9 +1770,9 @@ class Facture extends CommonInvoice
$facligne->total_ttc = -$remise->amount_ttc;
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht;
$facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva;
$facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc;
$facligne->multicurrency_total_ht = -$remise->multicurrency_amount_ht;
$facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva;
$facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc;
$lineid=$facligne->insert();
if ($lineid > 0)

View File

@ -422,7 +422,7 @@ if ($filtre)
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town);

View File

@ -152,6 +152,8 @@ class RemiseCheque extends CommonObject
$now=dol_now();
dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
@ -178,7 +180,6 @@ class RemiseCheque extends CommonObject
$sql.= ", ''";
$sql.= ")";
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
$resql = $this->db->query($sql);
if ( $resql )
{
@ -195,7 +196,6 @@ class RemiseCheque extends CommonObject
$sql.= " SET ref='(PROV".$this->id.")'";
$sql.= " WHERE rowid=".$this->id."";
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
@ -242,13 +242,12 @@ class RemiseCheque extends CommonObject
if($linetoremise==$lineid) $checkremise=true;
}
if($checkremise==true)
if ($checkremise)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
$sql.= " SET fk_bordereau = ".$this->id;
$sql.= " WHERE rowid = ".$lineid;
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
@ -284,11 +283,13 @@ class RemiseCheque extends CommonObject
if (! $this->errno)
{
$this->db->commit();
dol_syslog("RemiseCheque::Create end", LOG_DEBUG);
return $this->id;
}
else
{
$this->db->rollback();
dol_syslog("RemiseCheque::Create end", LOG_DEBUG);
return $this->errno;
}
}

View File

@ -76,8 +76,8 @@ class Paiement extends CommonObject
//paiement de llx_c_paiement
public $num_paiement; // Numero du CHQ, VIR, etc...
public $num_payment; // Numero du CHQ, VIR, etc...
public $payment_id; // Id of external modepayment
public $payment_site; // name of external modepayment
public $payment_id; // Id of external modepayment
public $payment_site; // name of external modepayment
public $bank_account; // Id compte bancaire du paiement
public $bank_line; // Id de la ligne d'ecriture bancaire
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
@ -138,8 +138,8 @@ class Paiement extends CommonObject
$this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->payment_id = $obj->ext_payment_id;
$this->payment_site = $obj->ext_payment_site;
$this->payment_id = $obj->ext_payment_id;
$this->payment_site = $obj->ext_payment_site;
$this->bank_account = $obj->fk_account; // deprecated
$this->fk_account = $obj->fk_account;
@ -233,11 +233,9 @@ class Paiement extends CommonObject
$mtotal = $totalamount;
}
$note = ($this->note_public?$this->note_public:$this->note);
$payment_id = $this->payment_id ? $this->payment_id : null;
$payment_site = $this->payment_site ? $this->payment_site : null;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat)";
$sql.= " VALUES (".$conf->entity.", '".$this->ref."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($note)."', '".$this->payment_id."', '".$this->payment_site."', ".$user->id.")";
$sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($note)."', ".($this->payment_id?"'".$this->db->escape($this->payment_id)."'":"null").", ".($this->payment_site?"'".$this->db->escape($this->payment_site)."'":"null").", ".$user->id.")";
dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -10,6 +10,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -2887,9 +2888,9 @@ class ContratLigne extends CommonObjectLine
$error=0;
// Clean parameters
$this->fk_contrat=trim($this->fk_contrat);
$this->fk_product=trim($this->fk_product);
$this->statut=(int) $this->statut;
$this->fk_contrat = (int) $this->fk_contrat;
$this->fk_product = (int) $this->fk_product;
$this->statut = (int) $this->statut;
$this->label=trim($this->label);
$this->description=trim($this->description);
$this->vat_src_code=trim($this->vat_src_code);
@ -2899,7 +2900,7 @@ class ContratLigne extends CommonObjectLine
$this->qty=trim($this->qty);
$this->remise_percent=trim($this->remise_percent);
$this->remise=trim($this->remise);
$this->fk_remise_except=trim($this->fk_remise_except);
$this->fk_remise_except = (int) $this->fk_remise_except;
$this->subprice=price2num($this->subprice);
$this->price_ht=price2num($this->price_ht);
$this->total_ht=trim($this->total_ht);
@ -2908,9 +2909,9 @@ class ContratLigne extends CommonObjectLine
$this->total_localtax2=trim($this->total_localtax2);
$this->total_ttc=trim($this->total_ttc);
$this->info_bits=trim($this->info_bits);
$this->fk_user_author=trim($this->fk_user_author);
$this->fk_user_ouverture=trim($this->fk_user_ouverture);
$this->fk_user_cloture=trim($this->fk_user_cloture);
$this->fk_user_author = (int) $this->fk_user_author;
$this->fk_user_ouverture = (int) $this->fk_user_ouverture;
$this->fk_user_cloture = (int) $this->fk_user_cloture;
$this->commentaire=trim($this->commentaire);
//if (empty($this->subprice)) $this->subprice = 0;
if (empty($this->price_ht)) $this->price_ht = 0;

View File

@ -50,13 +50,17 @@ if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (! $error)
{
// Define if we have to generate thumbs or not
$generatethumbs = 1;
if (GETPOST('section_dir')) $generatethumbs=0;
if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
}
elseif (! empty($upload_dir))
{
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
}
}
}
@ -69,7 +73,7 @@ elseif (GETPOST('linkit','none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') {
$link = 'http://' . $link;
}
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link);
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);
}
}
@ -77,20 +81,23 @@ elseif (GETPOST('linkit','none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete file/link
if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
$urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if (GETPOST('section', 'alpha')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir
else // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
$urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if (GETPOST('section', 'alpha')) // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir
{
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
}
else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
{
$urlfile=basename($urlfile);
$file = $upload_dir . "/" . $urlfile;
$file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile;
if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile;
}
$linkid = GETPOST('linkid', 'int'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$linkid = GETPOST('linkid', 'int');
if ($urlfile)
if ($urlfile) // delete of a file
{
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image)
$ret = dol_delete_file($file, 0, 0, 0, (is_object($object)?$object:null));
if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object)?$object:null)); // Delete file using old path
@ -114,7 +121,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
}
elseif ($linkid)
elseif ($linkid) // delete of external link
{
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($db);
@ -143,7 +150,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
}
else
{
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':''));
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir','alpha')?'&section_dir='.urlencode(GETPOST('section_dir','alpha')):'').(!empty($withproject)?'&withproject=1':''));
exit;
}
}
@ -208,13 +215,20 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
$result = dol_move($srcpath, $destpath);
if ($result)
{
if ($object->id)
{
$object->addThumbs($destpath);
}
// Define if we have to generate thumbs or not
$generatethumbs = 1;
if (GETPOST('section_dir')) $generatethumbs=0;
// TODO Add revert function of addThumbs to remove for old name
//$object->delThumbs($srcpath);
if ($generatethumbs)
{
if ($object->id)
{
$object->addThumbs($destpath);
}
// TODO Add revert function of addThumbs to remove thumbs with old name
//$object->delThumbs($srcpath);
}
setEventMessages($langs->trans("FileRenamed"), null);
}

View File

@ -1098,6 +1098,18 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
continue;
}
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
$res = $db->query($sql);
if (!$res)
{
setEventMessage('ErrorRecordParentingNotModified', 'errors');
$error++;
}
}
if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
else $result = $objecttmp->delete($user);

View File

@ -82,9 +82,16 @@ else // For no ajax call
dol_print_error($db,$ecmdir->error);
exit;
}
$relativepath=$ecmdir->getRelativePath(); // Example 'mydir/'
}
$relativepath=$ecmdir->getRelativePath();
$upload_dir = $rootdirfordoc.'/'.$relativepath;
elseif (GETPOST('section_dir'))
{
$relativepath=GETPOST('section_dir');
}
//var_dump($section.'-'.GETPOST('section_dir').'-'.$relativepath);
$upload_dir = $rootdirfordoc.'/'.$relativepath;
}
if (empty($url))
@ -226,7 +233,18 @@ if ($type == 'directory')
{
if ($module == 'medias')
{
$relativepath=GETPOST('file','alpha');
/*
$_POST is array like
'token' => string '062380e11b7dcd009d07318b57b71750' (length=32)
'action' => string 'file_manager' (length=12)
'website' => string 'template' (length=8)
'pageid' => string '124' (length=3)
'section_dir' => string 'mydir/' (length=3)
'section_id' => string '0' (length=1)
'max_file_size' => string '2097152' (length=7)
'sendit' => string 'Envoyer fichier' (length=15)
*/
$relativepath=GETPOST('file','alpha')?GETPOST('file','alpha'):GETPOST('section_dir','alpha');
if ($relativepath && $relativepath!= '/') $relativepath.='/';
$upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
if (GETPOSTISSET('website') || GETPOSTISSET('file_manager'))

View File

@ -30,6 +30,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! isset($mode) || $mode != 'noajax') // For ajax call
{
$res=@include '../../main.inc.php';
@ -39,16 +40,26 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
//if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = '/bbb/'; }
$openeddir = GETPOST('openeddir');
$modulepart= GETPOST('modulepart');
$selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape()
$preopened = GETPOST('preopened');
if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); // We removed last '/' except if it is '/'
}
else // For no ajax call
{
//if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = GETPOST('preopened'); }
$openeddir = GETPOST('openeddir');
$modulepart= GETPOST('modulepart');
$selecteddir = GETPOST('dir');
$preopened = GETPOST('preopened');
if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); // We removed last '/' except if it is '/'
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
}
@ -58,8 +69,16 @@ $langs->load("ecm");
// Define fullpathselecteddir.
$fullpathselecteddir='<none>';
if ($modulepart == 'ecm') $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
if ($modulepart == 'medias') $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
if ($modulepart == 'ecm')
{
$fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
$fullpathpreopened=$conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
}
if ($modulepart == 'medias')
{
$fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
$fullpathpreopened=$dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : '');
}
// Security:
@ -87,20 +106,20 @@ if ($modulepart == 'medias')
* View
*/
if (! isset($mode) || $mode != 'noajax')
if (! isset($mode) || $mode != 'noajax') // if ajax mode
{
top_httphead();
}
//print '<!-- selecteddir = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.' -->'."\n";
//print '<!-- selecteddir (relative dir we click on) = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.', preopened='.$preopened.' -->'."\n";
$userstatic=new User($db);
$form=new Form($db);
$ecmdirstatic = new EcmDirectory($db);
// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
// Load full tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0);
// Try to find key into $sqltree
// Try to find selected dir id into $sqltree and save it into $current_ecmdir_id
$current_ecmdir_id=-1;
foreach($sqltree as $keycursor => $val)
{
@ -113,131 +132,13 @@ foreach($sqltree as $keycursor => $val)
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
{
if (file_exists($fullpathselecteddir))
{
$files = @scandir($fullpathselecteddir);
treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened);
if ($files)
{
natcasesort($files);
if (count($files) > 2) /* The 2 accounts for . and .. */
{
echo '<ul class="ecmjqft" style="display: none;">'."\n";
// All dirs
foreach ($files as $file) // $file can be '.', '..', or 'My dir' or 'My file'
{
if ($file == 'temp') continue;
$nbofsubdir=0;
$nboffilesinsubdir=0;
$val=array();
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
foreach($sqltree as $key => $tmpval)
{
//print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
{
$val=$tmpval;
$resarray=tree_showpad($sqltree,$key,1);
// Refresh cache for this subdir
if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t
{
$result=$ecmdirstatic->fetch($val['id']);
$ecmdirstatic->ref=$ecmdirstatic->label;
$result=$ecmdirstatic->refreshcachenboffile(0);
$val['cachenbofdoc']=$result;
}
$a=$resarray[0];
$nbofsubdir=$resarray[1];
$nboffilesinsubdir=$resarray[2];
break;
}
}
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file)))
{
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
{
$val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file;
$val['id']=0;
$val['label']=$file;
$val['description']='';
$nboffilesinsubdir=$langs->trans("Unknown");
}
print '<li class="directory collapsed">';
print "<a class=\"fmdirlia jqft ecmjqft\" href=\"";
print "#";
print "\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
print "\">";
print dol_escape_htmltag($file);
print "</a>";
print '<div class="ecmjqft">';
print '<table class="nobordernopadding"><tr>';
/*print '<td align="left">';
print dol_escape_htmltag($file);
print '</td>';*/
// Nb of docs
print '<td align="right">';
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:'&nbsp;';
print '</td>';
print '<td align="left">';
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
print '</td>';
// Edit link
print '<td align="right" width="18"><a href="';
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'&section='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
// Add link
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
//print '<td align="right" width="14">&nbsp;</td>';
// Info
if ($modulepart == 'ecm')
{
print '<td align="right" width="18">';
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
print $form->textwithpicto('',$htmltooltip,1,"info");
print "</td>";
}
print "</tr></table>\n";
print '</div>';
//print '<div>&nbsp;</div>';
print "</li>\n";
}
}
// Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
// Because the content is reloaded by ajax call, we must also reenable some jquery hooks
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
print '<script type="text/javascript">
// TODO Find a solution to not output this code for each leaf we open
// Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
// Because the content is reloaded by ajax call, we must also reenable some jquery hooks
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
@ -250,13 +151,6 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
});
</script>';
echo "</ul>\n";
}
}
else print "PermissionDenied";
}
// This ajax service is called only when a directory $selecteddir is opened but not when closed.
//print '<script language="javascript">';
//print "loadandshowpreview('".dol_escape_js($selecteddir)."');";
@ -426,3 +320,175 @@ if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE
// Close db if mode is not noajax
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
/**
* treeOutputForAbsoluteDir
*
* @param array $sqltree Sqltree
* @param string $selecteddir Selected dir
* @param string $fullpathselecteddir Full path of selected dir
* @param string $modulepart Modulepart
* @param string $websitekey Website key
* @param int $pageid Page id
* @param string $preopened Current open dir
* @param string $fullpathpreopened Full path of current open dir
* @param int $depth Depth
* @return void
*/
function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth=0)
{
global $conf, $db, $langs, $form;
global $dolibarr_main_data_root;
$ecmdirstatic = new EcmDirectory($db);
$userstatic = new User($db);
if (file_exists($fullpathselecteddir))
{
$files = @scandir($fullpathselecteddir);
if ($files)
{
natcasesort($files);
if (count($files) > 2) /* The 2 accounts for . and .. */
{
echo '<ul class="ecmjqft" style="display: none;">'."\n";
// All dirs
foreach ($files as $file) // $file can be '.', '..', or 'My dir' or 'My file'
{
if ($file == 'temp') continue;
$nbofsubdir=0;
$nboffilesinsubdir=0;
$val=array();
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
foreach($sqltree as $key => $tmpval)
{
//print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
{
$val=$tmpval;
$resarray=tree_showpad($sqltree,$key,1);
// Refresh cache for this subdir
if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t
{
$result=$ecmdirstatic->fetch($val['id']);
$ecmdirstatic->ref=$ecmdirstatic->label;
$result=$ecmdirstatic->refreshcachenboffile(0);
$val['cachenbofdoc']=$result;
}
$a=$resarray[0];
$nbofsubdir=$resarray[1];
$nboffilesinsubdir=$resarray[2];
break;
}
}
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file)))
{
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
{
$val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file;
$val['id']=0;
$val['label']=$file;
$val['description']='';
$nboffilesinsubdir=$langs->trans("Unknown");
}
$collapsedorexpanded='collapsed';
if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) $collapsedorexpanded='expanded';
print '<li class="directory '.$collapsedorexpanded.'">'; // collapsed is opposite if expanded
print "<a class=\"fmdirlia jqft ecmjqft\" href=\"";
print "#";
print "\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
print "\">";
print dol_escape_htmltag($file);
print "</a>";
print '<div class="ecmjqft">';
print '<table class="nobordernopadding"><tr>';
/*print '<td align="left">';
print dol_escape_htmltag($file);
print '</td>';*/
// Nb of docs
print '<td align="right">';
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:'&nbsp;';
print '</td>';
print '<td align="left">';
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
print '</td>';
// Edit link
print '<td align="right" width="18"><a href="';
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'&section='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
// Add link
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
//print '<td align="right" width="14">&nbsp;</td>';
// Info
if ($modulepart == 'ecm')
{
print '<td align="right" width="18">';
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
print $form->textwithpicto('',$htmltooltip,1,"info");
print "</td>";
}
print "</tr></table>\n";
print '</div>';
//print 'selecteddir='.$selecteddir.' preopened='.$preopened.' $val[\'fullrelativename\']='.$val['fullrelativename']."<br>\n";
if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened))
{
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
$newselecteddir = $val['fullrelativename'];
if ($modulepart == 'ecm')
{
$newfullpathselecteddir=$conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
}
if ($modulepart == 'medias')
{
$newfullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
}
treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth+1);
}
print "</li>\n";
}
}
echo "</ul>\n";
}
}
else print "PermissionDenied";
}
}

View File

@ -569,7 +569,8 @@ class CMailFile
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
}
if(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
@ -1349,10 +1350,10 @@ class CMailFile
// Build the list of image extensions
$extensions = array_keys($this->image_types);
$matches = array();
preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found
if ($matches)
if (! empty($matches))
{
$i=0;
foreach ($matches[1] as $full)

View File

@ -38,6 +38,11 @@ abstract class CommonDocGenerator
*/
public $error='';
/**
* @var string[] Array of error strings
*/
public $errors = array();
/**
* @var DoliDB Database handler.
*/
@ -818,4 +823,229 @@ abstract class CommonDocGenerator
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
$pdf->line($x, $y+$h, $x, $y);
}
/**
* uasort callback function to Sort colums fields
*
* @param array $a PDF lines array fields configs
* @param array $b PDF lines array fields configs
* @return int Return compare result
*/
function columnSort($a, $b) {
if(empty($a['rank'])){ $a['rank'] = 0; }
if(empty($b['rank'])){ $b['rank'] = 0; }
if ($a['rank'] == $b['rank']) {
return 0;
}
return ($a['rank'] > $b['rank']) ? -1 : 1;
}
/**
* Prepare Array Column Field
*
* @param object $object common object
* @param outputlangs $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
function prepareArrayColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){
global $conf;
$this->defineColumnField($object,$outputlangs,$hidedetails,$hidedesc,$hideref);
// Sorting
uasort ( $this->cols, array( $this, 'columnSort' ) );
// Positionning
$curX = $this->page_largeur-$this->marge_droite; // start from right
// Array witdh
$arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche;
// Count flexible column
$totalDefinedColWidth = 0;
$countFlexCol = 0;
foreach ($this->cols as $colKey =>& $colDef)
{
if(!$this->getColumnStatus($colKey)) continue; // continue if desable
if(!empty($colDef['scale'])){
// In case of column widht is defined by percentage
$colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100 );
}
if(empty($colDef['width'])){
$countFlexCol++;
}
else{
$totalDefinedColWidth += $colDef['width'];
}
}
foreach ($this->cols as $colKey =>& $colDef)
{
// setting empty conf with default
if(!empty($colDef['title'])){
$colDef['title'] = array_replace($this->defaultTitlesFieldsStyle, $colDef['title']);
}
else{
$colDef['title'] = $this->defaultTitlesFieldsStyle;
}
// setting empty conf with default
if(!empty($colDef['content'])){
$colDef['content'] = array_replace($this->defaultContentsFieldsStyle, $colDef['content']);
}
else{
$colDef['content'] = $this->defaultContentsFieldsStyle;
}
if($this->getColumnStatus($colKey))
{
// In case of flexible column
if(empty($colDef['width'])){
$colDef['width'] = abs(($arrayWidth - $totalDefinedColWidth)) / $countFlexCol;
}
// Set positions
$lastX = $curX;
$curX = $lastX - $colDef['width'];
$colDef['xStartPos'] = $curX;
$colDef['xEndPos'] = $lastX;
}
}
}
/**
* get column content width from column key
*
* @param string $colKey the column key
* @return float width in mm
*/
function getColumnContentWidth($colKey)
{
$colDef = $this->cols[$colKey];
return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1];
}
/**
* get column content X (abscissa) left position from column key
*
* @param string $colKey the column key
* @return float X position in mm
*/
function getColumnContentXStart($colKey)
{
$colDef = $this->cols[$colKey];
return $colDef['xStartPos'] + $colDef['content']['padding'][3];
}
/**
* get column position rank from column key
*
* @param string $colKey the column key
* @return int rank on success and -1 on error
*/
function getColumnRank($colKey)
{
if(!isset($this->cols[$colKey]['rank'])) return -1;
return $this->cols[$colKey]['rank'];
}
/**
* get column position rank from column key
*
* @param string $newColKey the new column key
* @param array $defArray a single column definition array
* @param string $targetCol target column used to place the new column beside
* @param bool $insertAfterTarget insert before or after target column ?
* @return int new rank on success and -1 on error
*/
function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false)
{
// prepare wanted rank
$rank = -1;
// try to get rank from target column
if(!empty($targetCol)){
$rank = $this->getColumnRank($targetCol);
if($rank>=0 && $insertAfterTarget){ $rank++; }
}
// get rank from new column definition
if($rank<0 && !empty($defArray['rank'])){
$rank = $defArray['rank'];
}
// error: no rank
if($rank<0){ return -1; }
foreach ($this->cols as $colKey =>& $colDef)
{
if( $rank <= $colDef['rank'])
{
$colDef['rank'] = $colDef['rank'] + 1;
}
}
$defArray['rank'] = $rank;
$this->cols[$newColKey] = $defArray; // array_replace is used to preserve keys
return $rank;
}
/**
* print standard column content
*
* @param PDF $pdf pdf object
* @param float $curY curent Y position
* @param string $colKey the column key
* @param string $columnText column text
* @return int new rank on success and -1 on error
*/
function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
{
global $hookmanager;
$parameters=array(
'object' => $object,
'curY' =>& $curY,
'columnText' => $columnText,
'colKey' => $colKey
);
$reshook=$hookmanager->executeHooks('printStdColumnContent',$parameters,$this); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error,$hookmanager->errors,'errors');
if (!$reshook)
{
if(empty($columnText)) return;
$pdf->SetXY($this->getColumnContentXStart($colKey),$curY); // Set curent position
$colDef = $this->cols[$colKey];
$pdf->MultiCell( $this->getColumnContentWidth($colKey),2, $columnText,'',$colDef['content']['align']);
}
}
/**
* get column status from column key
*
* @param string $colKey the column key
* @return float width in mm
*/
function getColumnStatus($colKey)
{
if( !empty($this->cols[$colKey]['status'])){
return true;
}
else return false;
}
}

View File

@ -399,6 +399,12 @@ abstract class CommonObject
public $firstname;
public $civility_id;
// Dates
public $date_creation; // Date creation
public $date_validation; // Date validation
public $date_modification; // Date last change (tms field)
// No constructor as it is an abstract class
@ -4810,6 +4816,7 @@ abstract class CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$this->array_options = array();
$numrows=$this->db->num_rows($resql);
if ($numrows)
{

View File

@ -151,7 +151,7 @@ class DiscountAbsolute
$this->amount_tva = $obj->amount_tva;
$this->amount_ttc = $obj->amount_ttc;
$this->multicurrency_amount_ht = $obj->multicurrency_amount_ht;
$this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
$this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
$this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
@ -199,8 +199,17 @@ class DiscountAbsolute
$this->amount_ht=price2num($this->amount_ht);
$this->amount_tva=price2num($this->amount_tva);
$this->amount_ttc=price2num($this->amount_ttc);
$this->tva_tx=price2num($this->tva_tx);
$this->multicurrency_amount_ht=price2num($this->multicurrency_amount_ht);
$this->multicurrency_amount_tva=price2num($this->multicurrency_amount_tva);
$this->multicurrency_amount_ttc=price2num($this->multicurrency_amount_ttc);
if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht=0;
if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva=0;
if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc=0;
// Check parameters
if (empty($this->description))
{
@ -213,10 +222,12 @@ class DiscountAbsolute
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
$sql.= " (entity, datec, fk_soc, discount_type, fk_user, description,";
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,";
$sql.= " fk_facture_source, fk_invoice_supplier_source";
$sql.= ")";
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", ";
$sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").",";
$sql.= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'":"null");
$sql.= ")";

View File

@ -58,6 +58,11 @@ class Form
*/
public $error='';
/**
* @var string[] Array of error strings
*/
public $errors = array();
public $num;
// Cache arrays

View File

@ -1139,7 +1139,6 @@ class FormFile
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
{
//var_dump($sortfield);
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
}
}
@ -1162,7 +1161,7 @@ class FormFile
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
// Do we have entry into database ?
print '<!-- In database: position='.$filearray[$key]['position'].' -->'."\n";
print '<tr id="row-'.($filearray[$key]['rowid']>0?$filearray[$key]['rowid']:'-AFTER'.$lastrowid.'POS'.($i+1)).'">';
print '<tr class="oddeven" id="row-'.($filearray[$key]['rowid']>0?$filearray[$key]['rowid']:'AFTER'.$lastrowid.'POS'.($i+1)).'">';
// File name
print '<td class="minwith200">';
@ -1258,12 +1257,9 @@ class FormFile
if ($forcedownload) $paramlink.=($paramlink?'&':'').'attachment=1';
$fulllink=$urlwithroot.'/document.php'.($paramlink?'?'.$paramlink:'');
//if (! empty($object->ref)) $fulllink.='&hashn='.$object->ref; // Hash of file path
//elseif (! empty($object->label)) $fulllink.='&hashc='.$object->label; // Hash of file content
print img_picto($langs->trans("FileSharedViaALink"),'object_globe.png').' ';
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
//print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
}
else
{
@ -1299,17 +1295,12 @@ class FormFile
if ($permtoeditline)
{
print '<a href="'.(($useinecm == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
$paramsectiondir=(in_array($modulepart, array('medias','ecm'))?'&section_dir='.urlencode($relativepath):'');
print '<a href="'.(($useinecm == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
}
}
if ($permonobject)
{
/*
if ($file['level1name'] <> $object->id)
$filepath=$file['level1name'].'/'.$file['name'];
else
$filepath=$file['name'];
*/
$useajax=1;
if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $useajax=0;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2017 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,7 +45,28 @@ class FormMail extends Form
public $fromname;
public $frommail;
public $replytoname;
/**
* @var string user, company, robot
*/
public $fromtype;
/**
* @var int ID
*/
public $fromid;
/**
* @var string thirdparty etc
*/
public $totype;
/**
* @var int ID
*/
public $toid;
public $replytoname;
public $replytomail;
public $toname;
public $tomail;
@ -91,11 +113,6 @@ class FormMail extends Form
public $withtouser=array();
public $withtoccuser=array();
/**
* @var string Error code (or message)
*/
public $error='';
public $lines_model;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -59,15 +60,18 @@ class Menubase
public $fk_menu;
/**
* @var int ID
* @var string fk_mainmenu
*/
public $fk_mainmenu;
/**
* @var int ID
* @var string fk_leftmenu
*/
public $fk_leftmenu;
/**
* @var int position
*/
public $position;
public $url;
public $target;
@ -111,10 +115,10 @@ class Menubase
$this->type=trim($this->type);
$this->mainmenu=trim($this->mainmenu);
$this->leftmenu=trim($this->leftmenu);
$this->fk_menu=trim($this->fk_menu); // If -1, fk_mainmenu and fk_leftmenu must be defined
$this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
$this->fk_mainmenu=trim($this->fk_mainmenu);
$this->fk_leftmenu=trim($this->fk_leftmenu);
$this->position=trim($this->position);
$this->position = (int) $this->position;
$this->url=trim($this->url);
$this->target=trim($this->target);
$this->titre=trim($this->titre);
@ -155,7 +159,7 @@ class Menubase
$sql = "SELECT count(*)";
$sql.= " FROM ".MAIN_DB_PREFIX."menu";
$sql.= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
$sql.= " AND fk_menu = ".((int) $this->db->escape($this->fk_menu));
$sql.= " AND fk_menu = ".((int) $this->fk_menu);
$sql.= " AND position = ".((int) $this->position);
$sql.= " AND url = '".$this->db->escape($this->url)."'";
$sql.= " AND entity = ".$conf->entity;
@ -252,10 +256,10 @@ class Menubase
$this->type=trim($this->type);
$this->mainmenu=trim($this->mainmenu);
$this->leftmenu=trim($this->leftmenu);
$this->fk_menu=trim($this->fk_menu);
$this->fk_menu = (int) $this->fk_menu;
$this->fk_mainmenu=trim($this->fk_mainmenu);
$this->fk_leftmenu=trim($this->fk_leftmenu);
$this->position=trim($this->position);
$this->position = (int) $this->position;
$this->url=trim($this->url);
$this->target=trim($this->target);
$this->titre=trim($this->titre);
@ -274,7 +278,7 @@ class Menubase
$sql.= " type='".$this->db->escape($this->type)."',";
$sql.= " mainmenu='".$this->db->escape($this->mainmenu)."',";
$sql.= " leftmenu='".$this->db->escape($this->leftmenu)."',";
$sql.= " fk_menu='".$this->db->escape($this->fk_menu)."',";
$sql.= " fk_menu=".$this->fk_menu.",";
$sql.= " fk_mainmenu=".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
$sql.= " fk_leftmenu=".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
$sql.= " position=".($this->position > 0 ? $this->position : 0).",";

View File

@ -13,6 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -7025,11 +7026,12 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
// No need to make a return $head. Var is modified as a reference
if (! empty($hookmanager))
{
$parameters=array('object' => $object, 'mode' => $mode, 'head'=>$head);
$reshook=$hookmanager->executeHooks('completeTabsHead',$parameters);
$parameters=array('object' => $object, 'mode' => $mode, 'head' => $head);
$reshook=$hookmanager->executeHooks('completeTabsHead', $parameters);
if ($reshook > 0)
{
$head = $hookmanager->resArray;
$h = count($head);
}
}
}

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,10 +21,9 @@
*/
/**
* \file htdocs/core/lib/order.lib.php
* \brief Ensemble de fonctions de base pour le module commande
* \ingroup commande
*/
* \file htdocs/core/lib/import.lib.php
* \brief Ensemble de fonctions de base pour le module import
* \ingroup import
/**
* Function to return list of tabs for import pages

View File

@ -1,6 +1,7 @@
<?php
/**
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -164,7 +165,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
}
}
if ($type == 'order')
elseif ($type == 'order')
{
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='order_ref';
@ -182,7 +183,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
}
}
}
if ($type == 'invoice')
elseif ($type == 'invoice')
{
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='invoice_ref';
@ -200,7 +201,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
}
}
}
if ($type == 'contractline')
elseif ($type == 'contractline')
{
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='contractline_ref';
@ -218,7 +219,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
}
}
}
if ($type == 'member' || $type == 'membersubscription')
elseif ($type == 'member' || $type == 'membersubscription')
{
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='member_ref';
@ -335,14 +336,14 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
// Add other message if VAT exists
if ($object->total_vat != 0 || $object->total_tva != 0)
{
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
}
}

View File

@ -70,7 +70,7 @@ function check_user_password_openid($usertotest,$passwordtotest,$entitytotest)
$openid = new SimpleOpenID();
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true)
if ($openid_validation_result === true)
{
// OK HERE KEY IS VALID
@ -90,7 +90,7 @@ function check_user_password_openid($usertotest,$passwordtotest,$entitytotest)
}
}
}
else if($openid->IsError() == true)
else if($openid->IsError() === true)
{
// ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();

View File

@ -4,21 +4,22 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@ -46,7 +47,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@ -351,6 +352,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
catch(Exception $e)
{
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
// After construction $odfHandler->contentXml contains content and
@ -366,6 +368,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
// Define substitution array
@ -402,6 +405,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Replace tags of lines
@ -434,9 +438,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
catch(SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listlines->merge();
@ -460,6 +466,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
@ -473,7 +480,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
try {
$odfHandler->exportAsAttachedPDF($file);
}catch (Exception $e){
$this->error=$e->getMessage();
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
@ -481,7 +489,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
try {
$odfHandler->saveToDisk($file);
}catch (Exception $e){
$this->error=$e->getMessage();
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
*/
abstract class ModelePDFCommandes extends CommonDocGenerator
{
/**
* @var string Error code (or message)
*/
public $error='';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ if (empty($conf) || ! is_object($conf))
?>
<!-- BEGIN PHP TEMPLATE core/tpl/filemanager.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree -->
<?php
@ -111,7 +111,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL
<?php
}
$sectiondir=GETPOST('file','alpha');
$sectiondir=GETPOST('file','alpha')?GETPOST('file','alpha'):GETPOST('section_dir','alpha');
print '<!-- Start form to attach new file in filemanager.tpl.php sectionid='.$section.' sectiondir='.$sectiondir.' -->'."\n";
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile=new FormFile($db);
@ -168,14 +168,14 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
print '<tr><td>';
// Show filemanager tree (will be filled by call of ajax /ecm/tpl/enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
// Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php)
print '<div id="filetree" class="ecmfiletree"></div>';
if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
print '</td></tr>';
}
else
else // Show filtree when ajax is disabled (rare)
{
print '<tr><td style="padding-left: 20px">';
@ -186,6 +186,9 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
// Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show)
print '<div id="filetree" class="ecmfiletree">';
// Variables that may be defined:
// $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder']
// $_POST['dir']
$mode='noajax';
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
@ -211,7 +214,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
$mode='noajax';
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // Show content of a directory on right side
// End right panel
@ -224,7 +227,15 @@ include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
<?php
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) // Show filtree when ajax is enabled
{
//var_dump($modulepart);
// Variables that may be defined:
// $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder']
// $_POST['dir']
// $_POST['section_dir'], $_POST['section_id'], $_POST['token'], $_POST['max_file_size'], $_POST['sendit']
if (GETPOST('section_dir','alpha')) { $preopened=GETPOST('section_dir','alpha'); }
include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
}

View File

@ -28,7 +28,7 @@ $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_typ
$out .= '<div class="tagtd">'.$langs->trans("SelectResource").'</div>';
$out .= '<div class="tagtd">';
$events=array();
$out .= $formresources->select_resource_list('','fk_resource','',1,1,0,$events,'',2);
$out .= $formresources->select_resource_list('','fk_resource','',1,1,0,$events,'',2,null);
$out .= '</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',(isset($_POST['busy'])?$_POST['busy']:1),1).'</div>';

View File

@ -77,6 +77,10 @@ $error=0;
* Actions
*/
// TODO Replace sendit and confirm_deletefile with
//$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid; // used after a confirm_deletefile into actions_linkedfiles.inc.php
//include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
// Upload file (code similar but different than actions_linkedfiles.inc.php)
if (GETPOST("sendit",'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
@ -105,7 +109,8 @@ if (GETPOST("sendit",'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (! $error)
{
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', '', '', 0);
$generatethumbs = 0;
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs);
if ($res > 0)
{
$result=$ecmdir->changeNbOfFiles('+');
@ -113,6 +118,33 @@ if (GETPOST("sendit",'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
}
}
// Remove file (code similar but different than actions_linkedfiles.inc.php)
if ($action == 'confirm_deletefile')
{
if (GETPOST('confirm') == 'yes')
{
// GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections.
//var_dump(GETPOST('urlfile'));exit;
$upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:'');
$file = $upload_dir . "/" . GETPOST('urlfile','alpha');
$ret=dol_delete_file($file); // This include also the delete from file index in database.
if ($ret)
{
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile','alpha')), null, 'mesgs');
$result=$ecmdir->changeNbOfFiles('-');
}
else
{
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile','alpha')), null, 'errors');
}
clearstatcache();
}
$action='file_manager';
}
// Add directory
if ($action == 'add' && $user->rights->ecm->setup)
{
@ -135,33 +167,6 @@ if ($action == 'add' && $user->rights->ecm->setup)
clearstatcache();
}
// Remove file (code similar but different than actions_linkedfiles.inc.php)
if ($action == 'confirm_deletefile')
{
if (GETPOST('confirm') == 'yes')
{
// GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections.
//var_dump(GETPOST('urlfile'));exit;
$upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:'');
$file = $upload_dir . "/" . GETPOST('urlfile','alpha'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
$ret=dol_delete_file($file); // This include also the delete from file index in database.
if ($ret)
{
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile','alpha')), null, 'mesgs');
$result=$ecmdir->changeNbOfFiles('-');
}
else
{
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile','alpha')), null, 'errors');
}
clearstatcache();
}
$action='file_manager';
}
// Remove directory
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
{

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,7 +28,7 @@ if (empty($conf) || ! is_object($conf))
?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree: http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree -->
<script type="text/javascript">
@ -35,7 +36,9 @@ if (empty($conf) || ! is_object($conf))
if (empty($module)) $module='ecm';
$paramwithoutsection=preg_replace('/&?section=(\d+)/', '', $param);
$openeddir='/';
$openeddir='/'; // The root directory shown
// $preopened // The dir to have preopened
?>
$(document).ready(function() {
@ -43,7 +46,7 @@ $(document).ready(function() {
$('#filetree').fileTree({
root: '<?php print dol_escape_js($openeddir); ?>',
// Ajax called if we click to expand a dir (not a file). Parameter 'dir' is provided as a POST parameter by fileTree code to this following URL.
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart='.$module.'&openeddir='.urlencode($openeddir).(empty($paramwithoutsection)?'':$paramwithoutsection); ?>',
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart='.$module.(empty($preopened)?'':'&preopened='.urlencode($preopened)).'&openeddir='.urlencode($openeddir).(empty($paramwithoutsection)?'':$paramwithoutsection); ?>',
folderEvent: 'click', // 'dblclick'
multiFolder: false },
// Called if we click on a file (not a dir)

View File

@ -620,7 +620,7 @@ Module50000Name=PayBox
Module50000Desc=Offer customers a PayBox online payment page (credit/debit cards). This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...)
Module50100Name=Point of sales
Module50100Desc=Point of sales module (POS).
Module50150Name=Point of salesaa
Module50150Name=Point of sales
Module50150Desc=Point of sales module (Touch screen POS).
Module50200Name=Paypal
Module50200Desc=Offer customers a PayPal online payment page (PayPal account or credit/debit cards). This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...)
@ -925,7 +925,7 @@ BackToModuleList=Back to modules list
BackToDictionaryList=Back to list of Dictionaries
TypeOfRevenueStamp=Type of tax stamp
VATManagement=VAT Management
VATIsUsedDesc=By default when creating prospects, invoices, orders etc. the VAT rate follows the active standard rule:<br>If the seller is not subject to VAT, then VAT defaults to 0. End of rule.<br><p>If the (seller's country = buyer's country), then the VAT by default equals the VAT of the product in the seller's country. End of rule.</p><p>If the seller and buyer are both in the European Community and goods are transport-related products (haulage, shipping, airline), the default VAT is 0. This rule is dependant on the seller's country - please consult with your accountant. The VAT should be paid by the buyer to their customs office in their country and not to the seller. End of rule.</p><p>If the seller and buyer are both in the European Community and the buyer is not a company (with a registered intra-Community VAT number) then the VAT by defaults to the VAT of the seller's country. End of rule.</p><p>If the seller and buyer are both in the European Community and the buyer is a company (with a registered intra-Community VAT number), then the VAT is 0 by default. End of rule.</p><p>In any other case the proposed default is VAT=0. End of rule.</p>
VATIsUsedDesc=By default when creating prospects, invoices, orders etc. the VAT rate follows the active standard rule:<br>If the seller is not subject to VAT, then VAT defaults to 0. End of rule.<br>If the (seller's country = buyer's country), then the VAT by default equals the VAT of the product in the seller's country. End of rule.<br>If the seller and buyer are both in the European Community and goods are transport-related products (haulage, shipping, airline), the default VAT is 0. This rule is dependant on the seller's country - please consult with your accountant. The VAT should be paid by the buyer to their customs office in their country and not to the seller. End of rule.<br>If the seller and buyer are both in the European Community and the buyer is not a company (with a registered intra-Community VAT number) then the VAT by defaults to the VAT of the seller's country. End of rule.<br>If the seller and buyer are both in the European Community and the buyer is a company (with a registered intra-Community VAT number), then the VAT is 0 by default. End of rule.<br>In any other case the proposed default is VAT=0. End of rule.
VATIsNotUsedDesc=By default the proposed VAT is 0 which can be used for cases like associations, individuals or small companies.
VATIsUsedExampleFR=In France, it means companies or organizations having a real fiscal system (Simplified real or normal real). A system in which VAT is declared.
VATIsNotUsedExampleFR=In France, it means associations that are non VAT declared or companies, organizations or liberal professions that have chosen the micro enterprise fiscal system (VAT in franchise) and paid a franchise VAT without any VAT declaration. This choice will display the reference "Non applicable VAT - art-293B of CGI" on invoices.
@ -943,16 +943,16 @@ LocalTax2IsNotUsedDesc=Do not use other type of tax (other than VAT)
LocalTax2Management=Third type of tax
LocalTax2IsUsedExample=
LocalTax2IsNotUsedExample=
LocalTax1ManagementES= RE Management
LocalTax1IsUsedDescES= The RE rate by default when creating prospects, invoices, orders etc. follow the active standard rule:<br>If the buyer is not subjected to RE, RE by default=0. End of rule.<br>If the buyer is subjected to RE then the RE by default. End of rule.<br>
LocalTax1IsNotUsedDescES= By default the proposed RE is 0. End of rule.
LocalTax1IsUsedExampleES= In Spain they are professionals subject to some specific sections of the Spanish IAE.
LocalTax1IsNotUsedExampleES= In Spain they are professional and societies and subject to certain sections of the Spanish IAE.
LocalTax2ManagementES= IRPF Management
LocalTax2IsUsedDescES= The RE rate by default when creating prospects, invoices, orders etc. follow the active standard rule:<br>If the seller is not subjected to IRPF, then IRPF by default=0. End of rule.<br>If the seller is subjected to IRPF then the IRPF by default. End of rule.<br>
LocalTax2IsNotUsedDescES= By default the proposed IRPF is 0. End of rule.
LocalTax2IsUsedExampleES= In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules.
LocalTax2IsNotUsedExampleES= In Spain they are businesses not subject to tax system of modules.
LocalTax1ManagementES=RE Management
LocalTax1IsUsedDescES=The RE rate by default when creating prospects, invoices, orders etc. follow the active standard rule:<br>If the buyer is not subjected to RE, RE by default=0. End of rule.<br>If the buyer is subjected to RE then the RE by default. End of rule.<br>
LocalTax1IsNotUsedDescES=By default the proposed RE is 0. End of rule.
LocalTax1IsUsedExampleES=In Spain they are professionals subject to some specific sections of the Spanish IAE.
LocalTax1IsNotUsedExampleES=In Spain they are professional and societies and subject to certain sections of the Spanish IAE.
LocalTax2ManagementES=IRPF Management
LocalTax2IsUsedDescES=The IRPF rate by default when creating prospects, invoices, orders etc. follow the active standard rule:<br>If the seller is not subjected to IRPF, then IRPF by default=0. End of rule.<br>If the seller is subjected to IRPF then the IRPF by default. End of rule.<br>
LocalTax2IsNotUsedDescES=By default the proposed IRPF is 0. End of rule.
LocalTax2IsUsedExampleES=In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules.
LocalTax2IsNotUsedExampleES=In Spain they are businesses not subject to tax system of modules.
CalcLocaltax=Reports on local taxes
CalcLocaltax1=Sales - Purchases
CalcLocaltax1Desc=Local Taxes reports are calculated with the difference between localtaxes sales and localtaxes purchases
@ -1007,7 +1007,7 @@ MessageLogin=Login page message
LoginPage=Login page
BackgroundImageLogin=Background image
PermanentLeftSearchForm=Permanent search form on left menu
DefaultLanguage=Default language to use (variant)
DefaultLanguage=Default language to use (language code)
EnableMultilangInterface=Enable multilingual interface
EnableShowLogo=Show logo on left menu
CompanyInfo=Company/Organization
@ -1821,3 +1821,4 @@ DisabledResourceLinkUser=Disable feature to link a resource to users
DisabledResourceLinkContact=Disable feature to link a resource to contacts
ConfirmUnactivation=Confirm module reset
OnMobileOnly=On small screen (smartphone) only
DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both)

View File

@ -491,6 +491,7 @@ YouMustCreateInvoiceFromThird=This option is only available when creating invoic
YouMustCreateInvoiceFromSupplierThird=This option is only available when creating invoices from tab "supplier" of third party
YouMustCreateStandardInvoiceFirstDesc=You have to create a standard invoice first and convert it to "template" to create a new template invoice
PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template)
PDFSpongeDescription=Invoice PDF template Sponge. A complete invoice template
PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice template for situation invoices
TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for down payment invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0

View File

@ -141,6 +141,7 @@ OrderByWWW=Online
OrderByPhone=Phone
# Documents models
PDFEinsteinDescription=A complete order model (logo...)
PDFEratostheneDescription=A complete order model (logo...)
PDFEdisonDescription=A simple order model
PDFProformaDescription=A complete proforma invoice (logo…)
CreateInvoiceForThisCustomer=Bill orders

View File

@ -78,6 +78,7 @@ TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal
TypeContact_propal_external_SHIPPING=Customer contact for delivery
# Document models
DocModelAzurDescription=A complete proposal model (logo...)
DocModelCyanDescription=A complete proposal model (logo...)
DefaultModelPropalCreate=Default model creation
DefaultModelPropalToBill=Default template when closing a business proposal (to be invoiced)
DefaultModelPropalClosed=Default template when closing a business proposal (unbilled)

View File

@ -93,7 +93,7 @@ class MyObject extends CommonObject
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
//'date_validation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),

View File

@ -12,7 +12,7 @@
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Gustavo Novaro
*
* This program is free software; you can redistribute it and/or modify
@ -1097,7 +1097,7 @@ class Product extends CommonObject
$sql.= " WHERE fk_product_stock IN (";
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
$sql.= " WHERE fk_product = ".$id.")";
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
@ -1116,7 +1116,7 @@ class Product extends CommonObject
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE fk_product = ".$id;
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
@ -1147,12 +1147,25 @@ class Product extends CommonObject
}
}
// Delete from product_association
if (!$error){
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association";
$sql.= " WHERE fk_product_pere = ".$id." OR fk_product_fils = ".$id;
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Delete product
if (! $error)
{
$sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
$sqlz.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$resultz = $this->db->query($sqlz);
if ( ! $resultz )
{

View File

@ -54,6 +54,7 @@ $fourn_id = GETPOST("fourn_id",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page < 0) $page = 0;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
@ -92,11 +93,15 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
$catid='';
$toolowstock='';
$fourn_id='';
$sbarcode='';
}
@ -188,6 +193,20 @@ if ($resql)
}
$texte.=' ('.$langs->trans("Stocks").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($catid) $param.="&catid=".$catid;
llxHeader("", $texte, $helpurl);
@ -198,14 +217,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"").(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{

View File

@ -58,6 +58,7 @@ $fourn_id = GETPOST("fourn_id",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page < 0) $page = 0;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
@ -89,6 +90,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
@ -96,6 +99,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$toolowstock='';
$search_batch='';
$search_warehouse='';
$fourn_id='';
$sbarcode='';
}
@ -199,6 +204,24 @@ if ($resql)
}
$texte.=' ('.$langs->trans("StocksByLotSerial").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse;
if ($catid) $param.="&catid=".$catid;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
llxHeader("",$title,$helpurl,$texte);
@ -209,14 +232,8 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{
@ -250,17 +267,6 @@ if ($resql)
}
$param='';
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
@ -342,6 +348,7 @@ if ($resql)
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
$product_static->status_batch=$objp->tobatch;
$product_lot_static->batch=$objp->batch;
$product_lot_static->product_id=$objp->rowid;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -115,19 +115,19 @@ class Productlot extends CommonObject
// Clean parameters
if (isset($this->entity)) {
$this->entity = trim($this->entity);
$this->entity = (int) $this->entity;
}
if (isset($this->fk_product)) {
$this->fk_product = trim($this->fk_product);
$this->fk_product = (int) $this->fk_product;
}
if (isset($this->batch)) {
$this->batch = trim($this->batch);
}
if (isset($this->fk_user_creat)) {
$this->fk_user_creat = trim($this->fk_user_creat);
$this->fk_user_creat = (int) $this->fk_user_creat;
}
if (isset($this->fk_user_modif)) {
$this->fk_user_modif = trim($this->fk_user_modif);
$this->fk_user_modif = (int) $this->fk_user_modif;
}
if (isset($this->import_key)) {
$this->import_key = trim($this->import_key);
@ -296,19 +296,19 @@ class Productlot extends CommonObject
// Clean parameters
if (isset($this->entity)) {
$this->entity = trim($this->entity);
$this->entity = (int) $this->entity;
}
if (isset($this->fk_product)) {
$this->fk_product = trim($this->fk_product);
$this->fk_product = (int) $this->fk_product;
}
if (isset($this->batch)) {
$this->batch = trim($this->batch);
}
if (isset($this->fk_user_creat)) {
$this->fk_user_creat = trim($this->fk_user_creat);
$this->fk_user_creat = (int) $this->fk_user_creat;
}
if (isset($this->fk_user_modif)) {
$this->fk_user_modif = trim($this->fk_user_modif);
$this->fk_user_modif = (int) $this->fk_user_modif;
}
if (isset($this->import_key)) {
$this->import_key = trim($this->import_key);
@ -358,9 +358,6 @@ class Productlot extends CommonObject
}
if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// Call triggers
$result=$this->call_trigger('PRODUCTLOT_MODIFY',$user);
if ($result < 0) { $error++; }
@ -395,8 +392,8 @@ class Productlot extends CommonObject
$this->db->begin();
if (!$error) {
if (!$notrigger) {
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -404,8 +401,8 @@ class Productlot extends CommonObject
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
//}
//}
if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
@ -587,15 +584,15 @@ class Productlot extends CommonObject
{
$this->id = 0;
$this->entity = '';
$this->fk_product = '';
$this->entity = null;
$this->fk_product = null;
$this->batch = '';
$this->eatby = '';
$this->sellby = '';
$this->datec = '';
$this->tms = '';
$this->fk_user_creat = '';
$this->fk_user_modif = '';
$this->fk_user_creat = null;
$this->fk_user_modif = null;
$this->import_key = '';
}
}

View File

@ -93,8 +93,8 @@ class ProductStockEntrepot extends CommonObject
// Clean parameters
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->fk_product)) $this->fk_product = (int) $this->fk_product;
if (isset($this->fk_entrepot)) $this->fk_entrepot = (int) $this->fk_entrepot;
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
@ -317,8 +317,8 @@ class ProductStockEntrepot extends CommonObject
// Clean parameters
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
if (isset($this->fk_product)) $this->fk_product = (int) $this->fk_product;
if (isset($this->fk_entrepot)) $this->fk_entrepot = (int) $this->fk_entrepot;
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
@ -575,8 +575,8 @@ class ProductStockEntrepot extends CommonObject
$this->id = 0;
$this->tms = '';
$this->fk_product = '';
$this->fk_entrepot = '';
$this->fk_product = null;
$this->fk_entrepot = null;
$this->seuil_stock_alerte = '';
$this->desiredstock = '';
$this->import_key = '';

View File

@ -38,6 +38,7 @@ $id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$backtopage = GETPOST('backtopage','alpha');
$myparam = GETPOST('myparam','alpha');
$toselect = GETPOST('toselect', 'array');
$search_entity=GETPOST('search_entity','int');
@ -143,7 +144,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_import_key='';
$search_date_creation='';
$search_date_update='';
$toselect='';
$toselect=array();
$search_array_options=array();
}
@ -207,7 +208,8 @@ $sql.= " t.fk_user_modif,";
$sql.= " t.import_key,";
$sql.= " p.fk_product_type as product_type,";
$sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label";
$sql.= " p.label as product_label,";
$sql.= " p.tobatch";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
@ -424,6 +426,7 @@ if ($resql)
$productstatic->type=$obj->product_type;
$productstatic->ref=$obj->product_ref;
$productstatic->label=$obj->product_label;
$productstatic->status_batch = $obj->tobatch;
print '<td>'.$productstatic->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -340,7 +341,7 @@ class Task extends CommonObject
// Clean parameters
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
if (isset($this->ref)) $this->ref=trim($this->ref);
if (isset($this->fk_task_parent)) $this->fk_task_parent=trim($this->fk_task_parent);
if (isset($this->fk_task_parent)) $this->fk_task_parent = (int) $this->fk_task_parent;
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->description)) $this->description=trim($this->description);
if (isset($this->duration_effective)) $this->duration_effective=trim($this->duration_effective);
@ -705,12 +706,12 @@ class Task extends CommonObject
$this->fk_projet='';
$this->ref='TK01';
$this->fk_task_parent='';
$this->fk_task_parent=null;
$this->label='Specimen task TK01';
$this->duration_effective='';
$this->fk_user_creat='';
$this->fk_user_creat=null;
$this->progress='25';
$this->fk_statut='';
$this->fk_statut=null;
$this->note='This is a specimen task not';
}
@ -1999,4 +2000,4 @@ class Task extends CommonObject
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
}
}
}

View File

@ -618,6 +618,10 @@ foreach ($listofreferent as $key => $value)
{
if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total
}
if ($key == 'propal')
{
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total
}
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;

View File

@ -211,6 +211,21 @@ if ($action=="setaskforshippingmet") {
}
}
//Activate "Disable prospect/customer type"
if ($action=="setdisableprospectcustomer") {
$setdisableprospectcustomer = GETPOST('value','int');
$res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer,'yesno',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
//Activate ProfId unique
if ($action == 'setprofid')
{
@ -821,6 +836,25 @@ else
print '</a></td>';
print '</tr>';
// Disable Prospect/Customer thirdparty type
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("DisableProspectCustomerType").'</td>';
print '<td>&nbsp</td>';
print '<td align="center">';
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
}
print '</a></td>';
print '</tr>';
/*print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("OnSearchAndListGoOnCustomerOrSupplierCard").'</td>';
print '<td>&nbsp</td>';

View File

@ -1727,10 +1727,13 @@ class Societe extends CommonObject
$discount = new DiscountAbsolute($this->db);
$discount->fk_soc=$this->id;
$discount->discount_type=$discount_type;
$discount->amount_ht=price2num($remise,'MT');
$discount->amount_tva=price2num($remise*$tva_tx/100,'MT');
$discount->amount_ttc=price2num($discount->amount_ht+$discount->amount_tva,'MT');
$discount->amount_ht=$discount->multicurrency_amount_ht=price2num($remise,'MT');
$discount->amount_tva=$discount->multicurrency_amount_tva=price2num($remise*$tva_tx/100,'MT');
$discount->amount_ttc=$discount->multicurrency_amount_ttc=price2num($discount->amount_ht+$discount->amount_tva,'MT');
$discount->tva_tx=price2num($tva_tx,'MT');
$discount->description=$desc;
@ -3344,6 +3347,7 @@ class Societe extends CommonObject
$this->town=empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN;
$this->state_id=empty($conf->global->MAIN_INFO_SOCIETE_STATE)?'':$conf->global->MAIN_INFO_SOCIETE_STATE;
$this->region_code=empty($conf->global->MAIN_INFO_SOCIETE_REGION)?'':$conf->global->MAIN_INFO_SOCIETE_REGION;
$this->object=empty($conf->global->MAIN_INFO_SOCIETE_OBJECT)?'':$conf->global->MAIN_INFO_SOCIETE_OBJECT;
$this->note_private=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE;

View File

@ -115,7 +115,7 @@ if ($action=="deleteline"){
$row = $db->fetch_array ($resql);
$deletelineid=$row[0];
$invoice->deleteline($deletelineid);
$invoice->fetch($deletelineid);
$invoice->fetch($placeid);
}
}

View File

@ -1205,6 +1205,13 @@ td.showDragHandle {
.side-nav-vert {
margin-left: 228px;
}
<?php if (empty($conf->global->THEME_DISABLE_STICKY_TOPMENU)) { ?>
.side-nav-vert {
position: sticky;
top: 0px;
z-index: 210;
}
<?php } ?>
/* For smartphone (testmenuhider is on) */
<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?>

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -63,12 +64,12 @@ class Ticketlogs// extends CommonObject
public $id;
/**
* @var int ID
* @var string trackid
*/
public $fk_track_id;
/**
* @var int ID
* @var int user create ID
*/
public $fk_user_create;
@ -104,7 +105,7 @@ class Ticketlogs// extends CommonObject
}
if (isset($this->fk_user_create)) {
$this->fk_user_create = trim($this->fk_user_create);
$this->fk_user_create = (int) $this->fk_user_create;
}
if (isset($this->message)) {
@ -143,7 +144,7 @@ class Ticketlogs// extends CommonObject
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "ticket_logs");
if (!$notrigger) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -153,7 +154,7 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
//}
}
// Commit or rollback
@ -232,7 +233,7 @@ class Ticketlogs// extends CommonObject
}
if (isset($this->fk_user_create)) {
$this->fk_user_create = trim($this->fk_user_create);
$this->fk_user_create = (int) $this->fk_user_create;
}
if (isset($this->message)) {
@ -261,8 +262,8 @@ class Ticketlogs// extends CommonObject
$this->errors[] = "Error " . $this->db->lasterror();
}
if (!$error) {
if (!$notrigger) {
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -272,8 +273,8 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//}
//}
// Commit or rollback
if ($error) {
@ -303,8 +304,8 @@ class Ticketlogs// extends CommonObject
$this->db->begin();
if (!$error) {
if (!$notrigger) {
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -314,8 +315,8 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//}
//}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "ticket_logs";
@ -351,10 +352,12 @@ class Ticketlogs// extends CommonObject
*/
public function initAsSpecimen()
{
global $user;
$this->id = 0;
$this->fk_track_id = '';
$this->fk_user_create = '';
$this->fk_user_create = $user->id;
$this->datec = '';
$this->message = '';
}

View File

@ -330,6 +330,8 @@ class ProductCombination
$child->price_autogen = $parent->price_autogen;
$child->weight = $parent->weight + $this->variation_weight;
$child->weight_units = $parent->weight_units;
$varlabel = $this->getCombinationLabel($this->fk_product_child);
$child->label = $parent->label.$varlabel;
if ($child->update($child->id, $user) > 0) {
@ -338,14 +340,33 @@ class ProductCombination
// MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
$new_type = $parent->multiprices_base_type[1];
$new_min_price = $parent->multiprices_min[1];
$new_psq = $parent->multiprices_recuperableonly[1];
for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
{
if ($parent->multiprices[$i] != '') {
$new_type = $parent->multiprices_base_type[$i];
$new_min_price = $parent->multiprices_min[$i];
if ($parent->prices_by_qty_list[$i]) {
$new_psq = 1;
} else {
$new_psq = 0;
}
if ($new_type == 'TTC') {
$new_price = $parent->multiprices_ttc[1];
} else {
$new_price = $parent->multiprices[1];
if ($new_type == 'TTC') {
$new_price = $parent->multiprices_ttc[$i];
} else {
$new_price = $parent->multiprices[$i];
}
if ($this->variation_price_percentage) {
if ($new_price != 0) {
$new_price *= 1 + ($this->variation_price / 100);
}
} else {
$new_price += $this->variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq);
}
}
} else {
$new_type = $parent->price_base_type;
@ -357,15 +378,17 @@ class ProductCombination
} else {
$new_price = $parent->price;
}
}
if ($this->variation_price_percentage) {
$new_price *= 1 + ($this->variation_price/100);
} else {
$new_price += $this->variation_price;
}
if ($this->variation_price_percentage) {
if ($new_price != 0) {
$new_price *= 1 + ($this->variation_price / 100);
}
} else {
$new_price += $this->variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
}
$this->db->commit();
@ -682,4 +705,39 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
return 1;
}
/**
* Return label for combinations
* @param int $prod_child id of child
* @return string combination label
*/
public function getCombinationLabel($prod_child)
{
$label = '';
$sql = 'SELECT pav.value AS label';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_attribute_combination pac';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_attribute_combination2val pac2v ON pac2v.fk_prod_combination=pac.rowid';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_attribute_value pav ON pav.rowid=pac2v.fk_prod_attr_val';
$sql.= ' WHERE pac.fk_product_child='.$prod_child;
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->label)
{
$label.=' '.$obj->label;
}
$i++;
}
}
return $label;
}
}

View File

@ -318,6 +318,66 @@ if (! empty($id) || ! empty($ref))
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// TVA
print '<tr><td class="titlefield">' . $langs->trans("DefaultTaxRate") . '</td><td>';
$positiverates='';
if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx);
if (price2num($object->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax1_tx);
if (price2num($object->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($object->localtax2_tx);
if (empty($positiverates)) $positiverates='0';
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
/*
if ($object->default_vat_code)
{
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
}
else print vatrate($object->tva_tx, true, $object->tva_npr, true);*/
print '</td></tr>';
// Price
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
if ($object->price_base_type == 'TTC') {
print price($object->price_ttc) . ' ' . $langs->trans($object->price_base_type);
} else {
print price($object->price) . ' ' . $langs->trans($object->price_base_type);
}
print '</td></tr>';
// Price minimum
print '<tr><td>' . $langs->trans("MinPrice") . '</td><td>';
if ($object->price_base_type == 'TTC') {
print price($object->price_min_ttc) . ' ' . $langs->trans($object->price_base_type);
} else {
print price($object->price_min) . ' ' . $langs->trans($object->price_base_type);
}
print '</td></tr>';
// Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
if ($object->weight != '')
{
print $object->weight." ".measuring_units_string($object->weight_units,"weight");
}
else
{
print '&nbsp;';
}
print "</td></tr>\n";
print "</table>\n";
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();

View File

@ -207,7 +207,7 @@ $htmlheadercontentdefault.='-->'."\n";
* Actions
*/
$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid; // used after a confirm_deletefile into actions_linkedfiles.inc.php
$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir','alpha')?'&section_dir='.urlencode(GETPOST('section_dir','alpha')):''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager'