Merge branch '10.0' of https://github.com/Dolibarr/dolibarr into 10.0

This commit is contained in:
florian HENRY 2020-06-24 12:24:55 +02:00
commit a7f022dcea
48 changed files with 282 additions and 139 deletions

View File

@ -252,6 +252,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -329,6 +330,7 @@ $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {
@ -406,6 +408,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {
@ -458,6 +461,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {

View File

@ -666,7 +666,7 @@ if (! $error && $action == 'writebookkeeping') {
} elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
$bookkeeping->numero_compte = $tabpay[$key]["account_various"];
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
$bookkeeping->label_compte = $accountingaccount->label;
@ -1174,7 +1174,12 @@ if (empty($action) || $action == 'view') {
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
if (! empty($tabcompany[$key]['code_compta']))
{
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
if (in_array($tabtype[$key], array('payment_various'))) {
// For such case, if subledger is not defined, we won't use subledger accounts.
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
} else {
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
}
}
else
{

View File

@ -250,6 +250,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -321,6 +322,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -392,6 +394,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/supplier/index.php');

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
* it under the terms of the GNU General Public License as published bypliance with the License.
@ -17,6 +18,9 @@
*/
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
/**

View File

@ -99,6 +99,7 @@ $trigger_name=''; // Disable triggers
$paramname='id';
$mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
$sendcontext='';
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
@ -791,8 +792,8 @@ else
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile('', '', '', '');
$result=$mail->check_server_port($server, $port);
$mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
$result = $mail->check_server_port($server, $port);
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
else
{

View File

@ -536,8 +536,9 @@ else
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile('', '', '', '');
$result=$mail->check_server_port($server, $port);
$mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
$result = $mail->check_server_port($server, $port);
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
else
{

View File

@ -166,6 +166,7 @@ if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans(
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
if ($conf->ticket->enabled) $elementList['ticket_send']=$langs->trans('MailToTicket');
$elementList['user']=$langs->trans('MailToUser');
$parameters=array('elementList'=>$elementList);

View File

@ -221,6 +221,7 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
<div class="formelementrow"><input type="checkbox"
name="use_transaction" value="yes" id="checkbox_use_transaction" /> <label
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label>
</div>
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>

View File

@ -603,7 +603,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
$sql.= " AND t.active = ".$active;
$sql.= " WHERE t.active = ".$active;
if ($zipcode) $sql.=" AND t.zip LIKE '%" . $this->db->escape($zipcode) . "%'";
if ($town) $sql.=" AND t.town LIKE '%" . $this->db->escape($town) . "%'";
// Add sql filters

View File

@ -190,7 +190,7 @@ class ActionComm extends CommonObject
* Object user of owner
* @var User
* @deprecated
* @see userownerid
* @see $userownerid
*/
public $usertodo;
@ -198,7 +198,7 @@ class ActionComm extends CommonObject
* Object user that did action
* @var User
* @deprecated
* @see userdoneid
* @see $userdoneid
*/
public $userdone;
@ -209,7 +209,7 @@ class ActionComm extends CommonObject
* Company linked to action (optional)
* @var Societe|null
* @deprecated
* @see socid
* @see $socid
*/
public $societe;
@ -217,7 +217,7 @@ class ActionComm extends CommonObject
* Contact linked to action (optional)
* @var Contact|null
* @deprecated
* @see contactid
* @see $contactid
*/
public $contact;
@ -595,6 +595,7 @@ class ActionComm extends CommonObject
$sql = "SELECT a.id,";
$sql.= " a.id as ref,";
$sql.= " a.entity,";
$sql.= " a.ref_ext,";
$sql.= " a.datep,";
$sql.= " a.datep2,";
@ -631,6 +632,7 @@ class ActionComm extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->id;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
@ -797,7 +799,7 @@ class ActionComm extends CommonObject
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$res=$this->db->query($sql);
if ($res < 0) {
if (!$res) {
$this->error=$this->db->lasterror();
$error++;
}
@ -808,7 +810,7 @@ class ActionComm extends CommonObject
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$res=$this->db->query($sql);
if ($res < 0) {
if (!$res) {
$this->error=$this->db->lasterror();
$error++;
}

View File

@ -422,7 +422,11 @@ class PaymentVarious extends CommonObject
$sign * abs($this->amount),
$this->num_payment,
($this->category_transaction > 0 ? $this->category_transaction : 0),
$user
$user,
'',
'',
'',
$this->datev
);
// Update fk_bank into llx_paiement.

View File

@ -990,6 +990,11 @@ if (empty($reshook))
}
$id = $object->create($user);
// NOTE: Pb with situation invoice
// NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total
// NOTE: fields total on credit note are stored as delta both on total of lines and on invoice total (good)
// NOTE: fields situation_percent on situation invoice are stored as cumulative values on lines (bad)
// NOTE: fields situation_percent on credit note are stored as delta on lines (good)
if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
{
if (!empty($facture_source->lines))
@ -1010,36 +1015,38 @@ if (empty($reshook))
}
if($facture_source->type == Facture::TYPE_SITUATION)
if ($facture_source->type == Facture::TYPE_SITUATION)
{
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
$line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from
$line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from
if(!empty($facture_source->tab_previous_situation_invoice))
if (!empty($facture_source->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
// search the last standard invoice in cycle and the possible credit note between this last and facture_source
// TODO Move this out of loop of $facture_source->lines
$tab_jumped_credit_notes = array();
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while( $searchPreviousInvoice )
while ($searchPreviousInvoice)
{
if($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
{
$searchPreviousInvoice=false; // find, exit;
break;
}
else
{
if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) {
$tab_jumped_credit_notes[$lineIndex] = $facture_source->tab_previous_situation_invoice[$lineIndex]->id;
}
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
foreach ($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $source_fk_prev_id)
if ($prevLine->id == $source_fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
@ -1059,6 +1066,36 @@ if (empty($reshook))
// prorata
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
//print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
// If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta)
$maxPrevSituationPercent = 0;
foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
foreach ($facture_source->tab_previous_situation_invoice[$index]->lines as $prevLine)
{
if ($prevLine->fk_prev_id == $source_fk_prev_id)
{
$maxPrevSituationPercent = $prevLine->situation_percent;
$line->total_ht -= $prevLine->total_ht;
$line->total_tva -= $prevLine->total_tva;
$line->total_ttc -= $prevLine->total_ttc;
$line->total_localtax1 -= $prevLine->total_localtax1;
$line->total_localtax2 -= $prevLine->total_localtax2;
$line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
$line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
$line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
$line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
}
}
}
// prorata
$line->situation_percent += $maxPrevSituationPercent;
//print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
}
}
@ -1078,7 +1115,7 @@ if (empty($reshook))
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount already linked
$object->lines[] = $line; // insert new line in current object
@ -1106,12 +1143,12 @@ if (empty($reshook))
}
// Add link between credit note and origin
if(! empty($object->fk_facture_source)) {
if(! empty($object->fk_facture_source) && $id>0) {
$facture_source->fetch($object->fk_facture_source);
$facture_source->fetchObjectLinked();
if(! empty($facture_source->linkedObjectsIds)) {
foreach($facture_source->linkedObjectsIds as $sourcetype => $TIds) {
if (!empty($facture_source->linkedObjectsIds)) {
foreach ($facture_source->linkedObjectsIds as $sourcetype => $TIds) {
$object->add_object_linked($sourcetype, current($TIds));
}
}
@ -1590,6 +1627,8 @@ if (empty($reshook))
if (!empty($origin) && !empty($originid))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$object->origin = $origin;
$object->origin_id = $originid;
@ -1601,6 +1640,17 @@ if (empty($reshook))
$line->fetch_optionals($line->id);
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// The $line->situation_percent has been modified, so we must recalculate all amounts
$tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $line->situation_percent);
$line->total_ht = $tabprice[0];
$line->total_tva = $tabprice[1];
$line->total_ttc = $tabprice[2];
$line->total_localtax1 = $tabprice[9];
$line->total_localtax2 = $tabprice[10];
$line->multicurrency_total_ht = $tabprice[16];
$line->multicurrency_total_tva = $tabprice[17];
$line->multicurrency_total_ttc = $tabprice[18];
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except)
{
@ -1644,6 +1694,7 @@ if (empty($reshook))
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);
@ -4188,7 +4239,7 @@ elseif ($id > 0 || ! empty($ref))
$current_situation_counter = array();
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye = $prev_invoice->getSommePaiement();
$tmptotalpaidforthisinvoice = $prev_invoice->getSommePaiement();
$total_prev_ht += $prev_invoice->total_ht;
$total_prev_ttc += $prev_invoice->total_ttc;
$current_situation_counter[] = (($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?-1:1) * $prev_invoice->situation_counter;
@ -4199,7 +4250,7 @@ elseif ($id > 0 || ! empty($ref))
if (! empty($conf->banque->enabled)) print '<td class="right"></td>';
print '<td class="right">' . price($prev_invoice->total_ht) . '</td>';
print '<td class="right">' . price($prev_invoice->total_ttc) . '</td>';
print '<td class="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '<td class="right">' . $prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice) . '</td>';
print '</tr>';
}
}
@ -4821,9 +4872,8 @@ elseif ($id > 0 || ! empty($ref))
// Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
{
if (! $objectidnext)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&amp;fac_avoir=' . $object->id . '&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').'' . $object->id . '&amp;action=create&amp;type=2'.($object->entity > 0 ? '&amp;originentity='.$object->entity : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
if (! $objectidnext) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid . '&amp;fac_avoir=' . $object->id . '&amp;action=create&amp;type=2' . ($object->fk_project > 0 ? '&amp;projectid=' . $object->fk_project : '') . ($object->entity > 0 ? '&amp;originentity=' . $object->entity : '') . '">' . $langs->trans("CreateCreditNote") . '</a></div>';
}
}

View File

@ -1584,7 +1584,8 @@ class Facture extends CommonInvoice
}
/**
* Fetch previous and next situations invoices
* Fetch previous and next situations invoices.
* Return all previous and next invoices (both standard and credit notes).
*
* @return void
*/
@ -1595,7 +1596,7 @@ class Facture extends CommonInvoice
$this->tab_previous_situation_invoice = array();
$this->tab_next_situation_invoice = array();
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC';
$sql = 'SELECT rowid, type, situation_cycle_ref, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC';
dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG);
$result = $this->db->query($sql);
@ -5013,8 +5014,7 @@ class FactureLigne extends CommonInvoiceLine
$returnPercent = floatval($res['situation_percent']);
if($include_credit_note) {
if ($include_credit_note) {
$sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd';
$sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) ';
$sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id;
@ -5026,6 +5026,8 @@ class FactureLigne extends CommonInvoiceLine
while($obj = $this->db->fetch_object($res)) {
$returnPercent = $returnPercent + floatval($obj->situation_percent);
}
} else {
dol_print_error($this->db);
}
}

View File

@ -342,7 +342,7 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Bill').'</td>';
print '<td>'.$langs->trans('Company').'</td>';
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED )print '<td>'.$langs->trans('Entity').'</td>';
if (!empty($conf->multicompany->enabled) && $conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ) print '<td>'.$langs->trans('Entity').'</td>';
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
print '<td class="right">'.$langs->trans('RemainderToPay').'</td>';
@ -379,7 +379,7 @@ if ($resql)
print '</td>';
// Expected to pay
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){
if(!empty($conf->multicompany->enabled) && $conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){
print '<td>';
$mc->getInfo($objp->entity);
print $mc->label;

View File

@ -36,7 +36,10 @@ $socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$urladd = '';
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
if ($limit != $conf->liste_limit) $urladd .= '&limit=' . $limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
@ -53,6 +56,7 @@ $search_ref = GETPOST('search_ref', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$bon=new BonPrelevement($db, "");
$hookmanager->initHooks(array('withdrawalsreceiptslist'));
/*
@ -101,7 +105,7 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$urladd= "&amp;statut=".$statut;
$urladd .= "&amp;statut=" . $statut;
$selectedfields='';

View File

@ -56,6 +56,7 @@ $search_company = GETPOST('search_company', 'alpha');
$statut = GETPOST('statut', 'int');
$bon=new BonPrelevement($db, "");
$hookmanager->initHooks(array('withdrawalsreceiptslineslist'));
$ligne=new LignePrelevement($db, $user);

View File

@ -40,6 +40,7 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons');
// Get supervariables
$page = GETPOST('page', 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$sortorder = GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha');
@ -57,6 +58,7 @@ if ($sortorder == "") $sortorder="DESC";
if ($sortfield == "") $sortfield="p.datec";
$rej = new RejetPrelevement($db, $user);
$hookmanager->initHooks(array('withdrawalsreceiptsrejectedlist'));
$ligne = new LignePrelevement($db, $user);
/*
@ -85,7 +87,7 @@ if ($result)
print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="noborder tagtable liste" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], "p.ref", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);

View File

@ -243,6 +243,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
$sql.= " WHERE l.fk_facture = f.rowid";
$sql.= " AND f.fk_statut in (1,2)";
$sql.= " AND l.product_type in (0,1)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
} else {

View File

@ -79,7 +79,7 @@ if ($company->id)
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country, "TYPE=WORK;POSTAL");
if ($company->email != $contact->email) $v->setEmail($company->email, 'TYPE=PREF,INTERNET');
if (empty($contact->email)) $v->setEmail($company->email, 'TYPE=PREF,INTERNET');
// Si contact lie a un tiers non de type "particulier"
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);
}

View File

@ -2807,8 +2807,8 @@ abstract class CommonObject
$sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type';
if ($this->table_element_line == 'facturedet') $sql.= ', situation_percent';
$sql.= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
if ($this->table_element_line == 'facturedet') $sql.= ', situation_percent';
$sql.= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
if ($exclspec)
@ -2847,18 +2847,23 @@ abstract class CommonObject
if (empty($reshook) && $forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
{
// This part of code is to fix data. We should not call it too often.
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100), $multicurrency_tx);
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
if ($diff)
$diff_when_using_price_ht=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); // If price was set with tax price adn unit price HT has a low number of digits, then we may have a diff on recalculation from unit price HT.
$diff_on_current_total=price2num($obj->total_ttc - $obj->total_ht - $obj->total_tva - $obj->total_localtax1 - $obj->total_localtax2, 'MT', 1);
//var_dump($obj->total_ht.' '.$obj->total_tva.' '.$obj->total_localtax1.' '.$obj->total_localtax2.' =? '.$obj->total_ttc);
//var_dump($diff_when_using_price_ht.' '.$diff_on_current_total);
if ($diff_when_using_price_ht && $diff_on_current_total)
{
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid;
dol_syslog('We found unconsistent data into detailed line (difference of '.$diff.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db, 'Failed to update line');
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
//
dol_syslog('We found unconsistent data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db, 'Failed to update line');
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
}
}

View File

@ -3582,10 +3582,11 @@ class Form
$opt = '<option value ="" selected></option>';
$sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc';
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'facture';
$sql.= ' WHERE entity IN ('.getEntity('invoice').')';
$sql.= ' AND situation_counter>=1';
$sql.= ' ORDER by situation_cycle_ref, situation_counter desc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture';
$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
$sql .= ' AND situation_counter>=1';
$sql .= ' AND type <> 2';
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
// Last seen cycle
@ -6670,7 +6671,8 @@ class Form
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, td.total_ht as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),

View File

@ -75,7 +75,7 @@ class FormOther
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
$sql.= " WHERE type = '".$type."'";
if (!empty($fk_user)) $sql.=" AND fk_user IN (0, ".$fk_user.")"; // An export model
$sql.= " ORDER BY rowid";
$sql.= " ORDER BY label";
$result = $this->db->query($sql);
if ($result)
{

View File

@ -991,9 +991,7 @@ class FormTicket
// MESSAGE
$defaultmessage="";
if (is_array($arraydefaultmessage) && count($arraydefaultmessage) > 0 && $arraydefaultmessage->content) {
$defaultmessage=$arraydefaultmessage->content;
}
if (is_object($arraydefaultmessage) && $arraydefaultmessage->content) $defaultmessage = $arraydefaultmessage->content;
$defaultmessage=str_replace('\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)

View File

@ -314,6 +314,7 @@ class Notify
global $user,$conf,$langs,$mysoc;
global $hookmanager;
global $dolibarr_main_url_root;
global $action;
if (! in_array($notifcode, $this->arrayofnotifsupported)) return 0;
@ -415,34 +416,34 @@ class Notify
switch ($notifcode) {
case 'BILL_VALIDATE':
$link='/compta/facture/card.php?facid='.$object->id;
$link = '<a href="' . $urlwithroot . '/compta/facture/card.php?facid=' . $object->id . '">' . $newref . '</a>';
$dir_output = $conf->facture->dir_output;
$object_type = 'facture';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
break;
case 'BILL_PAYED':
$link='/compta/facture/card.php?facid='.$object->id;
$link ='<a href="' . $urlwithroot . '/compta/facture/card.php?facid='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->facture->dir_output;
$object_type = 'facture';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
break;
case 'ORDER_VALIDATE':
$link='/commande/card.php?id='.$object->id;
$link = '<a href="' . $urlwithroot . '/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->commande->dir_output;
$object_type = 'order';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
break;
case 'PROPAL_VALIDATE':
$link='/comm/propal/card.php?id='.$object->id;
$link = '<a href="' . $urlwithroot . '/comm/propal/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
break;
case 'PROPAL_CLOSE_SIGNED':
$link='/comm/propal/card.php?id='.$object->id;
$link = '<a href="' . $urlwithroot . '/comm/propal/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
break;
case 'FICHINTER_ADD_CONTACT':
$link='/fichinter/card.php?id='.$object->id;
@ -451,17 +452,17 @@ class Notify
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $newref);
break;
case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id;
$link = '<a href="' . $urlwithroot . '/fichinter/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
break;
case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $newref, $user->getFullName($outputlangs));
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($outputlangs));
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'ORDER_SUPPLIER_APPROVE':
@ -469,41 +470,46 @@ class Notify
$dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $newref, $user->getFullName($outputlangs));
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($outputlangs));
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'ORDER_SUPPLIER_REFUSE':
$link='/fourn/commande/card.php?id='.$object->id;
$link = '<a href="' . $urlwithroot . '/fourn/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $newref, $user->getFullName($outputlangs));
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($outputlangs));
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'SHIPPING_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $newref);
$object_type = 'expedition';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
break;
case 'EXPENSE_REPORT_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expensereport->dir_output;
$object_type = 'expensereport';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
break;
case 'EXPENSE_REPORT_APPROVE':
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expensereport->dir_output;
$object_type = 'expensereport';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
break;
case 'HOLIDAY_VALIDATE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
break;
case 'HOLIDAY_APPROVE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
break;
}
$ref = dol_sanitizeFileName($newref);
@ -522,10 +528,11 @@ class Notify
$message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
$message.= "\n";
$message.= $mesg;
if ($link) $message.= "\n" . $urlwithroot . $link;
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
$reshook=$hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
if (!isset($action)) $action = '';
$reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
@ -592,6 +599,7 @@ class Notify
{
foreach($conf->global as $key => $val)
{
$reg = array();
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
$threshold = (float) $reg[1];
@ -646,7 +654,7 @@ class Notify
break;
case 'FICHINTER_ADD_CONTACT':
$link = '<a href="' . $urlwithroot . '/fichinter/card.php?id='.$object->id . '">' . $newref . '</a>';
$dir_output = $conf->facture->dir_output;
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
break;
@ -689,29 +697,34 @@ class Notify
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'SHIPPING_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated", $newref);
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
break;
case 'EXPENSE_REPORT_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expensereport->dir_output;
$object_type = 'expensereport';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $newref);
$mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
break;
case 'EXPENSE_REPORT_APPROVE':
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->expensereport->dir_output;
$object_type = 'expensereport';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $newref);
$mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
break;
case 'HOLIDAY_VALIDATE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated", $newref);
$mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
break;
case 'HOLIDAY_APPROVE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $newref);
$mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
break;
}
$ref = dol_sanitizeFileName($newref);
@ -730,7 +743,6 @@ class Notify
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
$message.= "\n";
$message.= $mesg;
//if ($link) $message.= "\n" . $urlwithroot . $link; // link already added around the ref into the text
$message = nl2br($message);

View File

@ -959,18 +959,18 @@ function dol_unescapefile($filename)
*/
function dolCheckVirus($src_file)
{
global $conf, $db;
global $conf;
if (! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
{
if (! class_exists('AntiVir')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php';
}
$antivir = new AntiVir($db);
$antivir=new AntiVir($db);
$result = $antivir->dol_avscan_file($src_file);
if ($result < 0) // If virus or error, we stop here
{
$reterrors = $antivir->errors;
$reterrors=$antivir->errors;
return $reterrors;
}
}
@ -1853,15 +1853,16 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages();
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
try {
$ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
try {
$ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
else
{

View File

@ -1651,7 +1651,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
{
$ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
$ret .= ($object->state_id?(' ('.($object->state_id).')'):'');
$ret .= ($object->state_code?(' ('.($object->state_code).')'):'');
}
else // Other: title firstname name \n address lines \n zip town \n country
{

View File

@ -388,7 +388,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
//var_dump($expedition->linkedObjects);
$receiving='';
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
if (!empty($expedition->linkedObjects['delivery'])) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
if (! empty($receiving))
{

View File

@ -593,7 +593,7 @@ class pdf_crabe extends ModelePDFFactures
{
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R');
$pdf->MultiCell($this->postotalht-$this->posxprogress+1, 3, $progress, 0, 'R');
}
// Total HT line

View File

@ -214,7 +214,7 @@ class modContrat extends DolibarrModules
*/
public function init($options = '')
{
global $conf;
global $conf, $langs;
// Nettoyage avant activation
$this->remove($options);

View File

@ -83,7 +83,7 @@ print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td
// Fields for situation invoice
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref2 right">' . $langs->trans('TotalHT100Short') . '</td>';
print '<td class="linecolcycleref2 right">' . $form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')) . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))

View File

@ -2535,7 +2535,7 @@ elseif ($id || $ref)
// This is just to generate a delivery receipt
//var_dump($object->linkedObjectsIds['delivery']);
if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0)
if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery']))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
}

View File

@ -529,7 +529,7 @@ class Expedition extends CommonObject
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
$sql.= ", e.date_valid";
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
@ -558,6 +558,7 @@ class Expedition extends CommonObject
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->socid = $obj->socid;
$this->ref_customer = $obj->ref_customer;
@ -602,7 +603,7 @@ class Expedition extends CommonObject
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
$this->db->free($result);
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;

View File

@ -970,7 +970,7 @@ class ExpenseReport extends CommonObject
{
// phpcs:enable
global $conf;
$this->lines=array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
@ -2274,7 +2274,7 @@ class ExpenseReport extends CommonObject
public function load_state_board()
{
// phpcs:enable
global $conf;
global $conf, $user;
$this->nb=array();
@ -2282,6 +2282,12 @@ class ExpenseReport extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
$sql.= " WHERE ex.fk_statut > 0";
$sql.= " AND ex.entity IN (".getEntity('expensereport').")";
if(!$user->rights->expensereport->readall)
{
$userchildids = $user->getAllChildIds(1);
$sql.= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
$sql.= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
}
$resql=$this->db->query($sql);
if ($resql) {
@ -2316,15 +2322,17 @@ class ExpenseReport extends CommonObject
$now=dol_now();
$userchildids = $user->getAllChildIds(1);
$sql = "SELECT ex.rowid, ex.date_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
else $sql.= " WHERE ex.fk_statut = 5";
$sql.= " AND ex.entity IN (".getEntity('expensereport').")";
$sql.= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
$sql.= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
if(!$user->rights->expensereport->readall)
{
$userchildids = $user->getAllChildIds(1);
$sql.= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
$sql.= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
}
$resql=$this->db->query($sql);
if ($resql)

View File

@ -1815,7 +1815,6 @@ class CommandeFournisseur extends CommonOrder
if ($result < 0)
{
$error++;
return -1;
}
// End call triggers
}
@ -1923,6 +1922,7 @@ class CommandeFournisseur extends CommonOrder
{
$this->errors[]='ErrorWhenRunningTrigger';
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
// End call triggers

View File

@ -1967,7 +1967,7 @@ class FactureFournisseur extends CommonInvoice
$this->errors[] = $line->error;
} else {
// Update total price into invoice record
$res = $this->update_price('', 'auto');
$res = $this->update_price('', 'auto', 0, $this->thirdparty);
}
return $res;

View File

@ -2182,12 +2182,20 @@ class Holiday extends CommonObject
public function load_state_board()
{
// phpcs:enable
global $user;
$this->nb=array();
$sql = "SELECT count(h.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as h";
$sql.= " WHERE h.statut > 1";
$sql.= " AND h.entity IN (".getEntity('holiday').")";
if(!$user->rights->expensereport->read_all)
{
$userchildids = $user->getAllChildIds(1);
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
}
$resql=$this->db->query($sql);
if ($resql) {
@ -2221,14 +2229,16 @@ class Holiday extends CommonObject
$now=dol_now();
$userchildids = $user->getAllChildIds(1);
$sql = "SELECT h.rowid, h.date_debut";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as h";
$sql.= " WHERE h.statut = 2";
$sql.= " AND h.entity IN (".getEntity('holiday').")";
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
if(!$user->rights->expensereport->read_all)
{
$userchildids = $user->getAllChildIds(1);
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
}
$resql=$this->db->query($sql);
if ($resql)

View File

@ -324,7 +324,7 @@ if (empty($user->societe_id))
include_once $includes[$key]; // Loading a class cost around 1Mb
$board=new $classe($db);
$board->load_state_board($user);
$board->load_state_board();
$boardloaded[$classe]=$board;
}
else

View File

@ -337,9 +337,14 @@ UPDATE llx_c_lead_status set code = 'WON' where code = 'WIN';
-- To replace amount on all invoice and lines when forgetting to apply a 20% vat
-- update llx_facturedet set tva_tx = 20 where tva_tx = 0;
-- update llx_facturedet set total_ht = round(total_ttc / 1.2, 5) where total_ht = total_ttc;
-- update llx_facturedet set total_tva = total_ttc - total_ht where total_vat = 0;
-- update llx_facture set total = round(total_ttc / 1.2, 5) where total_ht = total_ttc;
-- update llx_facture set tva = total_ttc - total where tva = 0;
-- To fix bad total of price excluding tax, vat and price tax including tax.
-- select * from llx_facture where tva <> (total_ttc - total - localtax1 - localtax2 - revenuestamp);
-- update llx_facture set tva = (total_ttc - total - localtax1 - localtax2 - revenuestamp) where tva <> (total_ttc - total - localtax1 - localtax2 - revenuestamp);
-- select * from llx_facturedet where total_tva <> (total_ttc - total_ht - total_localtax1 - total_localtax2);
-- update llx_facturedet set total_tva = (total_ttc - total_ht - total_localtax1 - total_localtax2) where total_tva <> (total_ttc - total_ht - total_localtax1 - total_localtax2);
-- To insert elements into a category
-- Search idcategory: select rowid from llx_categorie where type=0 and ref like '%xxx%'
@ -470,6 +475,11 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
-- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL;
-- Test inconsistency of data into situation invoices: If it differs, it may be the total_ht that is wrong and situation_percent that is good.
-- select f.rowid, f.type, fd.qty, fd.subprice, fd.situation_percent, fd.total_ht, fd.total_ttc, fd.total_tva, fd.multicurrency_total_ht, fd.multicurrency_total_tva, fd.multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100)))
-- from llx_facturedet as fd, llx_facture as f where fd.fk_facture = f.rowid AND (total_ht - situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) > 0.01 and f.type = 5;
-- Note to migrate from old counter aquarium to new one
-- drop table tmp;

View File

@ -3605,10 +3605,9 @@ function migrate_mode_reglement($db, $langs, $conf)
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @param string $versionto Version target
* @return void
*/
function migrate_clean_association($db, $langs, $conf, $versionto)
function migrate_clean_association($db, $langs, $conf)
{
$result = $db->DDLDescTable(MAIN_DB_PREFIX."categorie_association");
if ($result) // result defined for version 3.2 or -

View File

@ -218,6 +218,7 @@ ListAccounts=List of the accounting accounts
UnknownAccountForThirdparty=Unknown third-party account. We will use %s
UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error
ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. We will use %s
ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty.
ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error.
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error
PaymentsNotLinkedToProduct=Payment not linked to any product / service

View File

@ -1792,6 +1792,7 @@ MailToThirdparty=Third parties
MailToMember=Members
MailToUser=Users
MailToProject=Projects page
MailToTicket=Tickets
ByDefaultInList=Show by default on list view
YouUseLastStableVersion=You use the latest stable version
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)
@ -1923,4 +1924,4 @@ DeleteEmailCollector=Delete email collector
ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector?
RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value
AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled

View File

@ -554,4 +554,5 @@ AutoFillDateFromShort=Set start date
AutoFillDateTo=Set end date for service line with next invoice date
AutoFillDateToShort=Set end date
MaxNumberOfGenerationReached=Max number of gen. reached
BILL_DELETEInDolibarr=Invoice deleted
BILL_DELETEInDolibarr=Invoice deleted
UnitPriceXQtyLessDiscount=Unit price x Qty - Discount

View File

@ -218,6 +218,7 @@ ListAccounts=Liste des comptes comptables
UnknownAccountForThirdparty=Compte de tiers inconnu. %s sera utilisé
UnknownAccountForThirdpartyBlocking=Compte de tiers inconnu. Erreur bloquante.
ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Code comptable du tiers non défini ou tiers inconnu. On utilisera %s.
ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Tiers inconnu et code comptable auxiliaire non défini sur le paiement. Nous conserverons la valeur du compte auxiliaire vide.
ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Compte tiers non défini ou inconnu. Erreur bloquante.
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Compte tiers inconnu et compte d'attente non défini. Erreur blocante.
PaymentsNotLinkedToProduct=Paiement non lié à un produit / service

View File

@ -109,7 +109,7 @@ Separator=Séparateur de champs
Enclosure=Encadrement des chaînes de textes
SpecialCode=Code spécial
ExportStringFilter=%% permet de remplacer 1 ou plusieurs caractères dans le texte
ExportDateFilter=AAAA, AAAAMM, AAAAMMJJ: filtre pour une année/mois/jour<br>AAAA+AAAA, AAAAMM+AAAAMM, AAAAMMJJ+AAAAMMJJ: filtre pour une plage année/mois/jour<br> > AAAA, > AAAAMM, > AAAAMMJJ': filtre pour une date supérieure à une année/mois/jour donné<br> < AAAA, < AAAAMM, < AAAAMMJJ: filtre pour une date inférieure à une année/mois/jour donné
ExportDateFilter=AAAA, AAAAMM, AAAAMMJJ: filtre pour une année/mois/jour<br>AAAA+AAAA, AAAAMM+AAAAMM, AAAAMMJJ+AAAAMMJJ: filtre pour une plage année/mois/jour<br> > AAAA, > AAAAMM, > AAAAMMJJ: filtre pour une date supérieure à une année/mois/jour donné<br> < AAAA, < AAAAMM, < AAAAMMJJ: filtre pour une date inférieure à une année/mois/jour donné
ExportNumericFilter=NNNNN filtre une seule valeur<br>NNNNN+NNNNN filtre une plage de valeurs<br>< NNNNN filtre les valeurs inférieures<br>> NNNNN filtre les valeurs supérieures
ImportFromLine=Début d'import à la ligne numéro
EndAtLineNb=Fin à la ligne numéro

View File

@ -28,9 +28,9 @@ require_once NUSOAP_PATH.'/nusoap.php';
$langs->load("companies");
//http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
$WS_DOL_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService';
$WS_DOL_URL='https://ec.europa.eu/taxation_customs/vies/services/checkVatService';
//$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl';
$WS_DOL_URL_WSDL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_DOL_URL_WSDL='https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_METHOD ='checkVat';

View File

@ -3402,6 +3402,7 @@ class Societe extends CommonObject
$this->twitter=$member->twitter;
$this->facebook=$member->facebook;
$this->linkedin=$member->linkedin;
$this->entity=$member->entity;
$this->client = 1; // A member is a customer by default
$this->code_client = ($customercode?$customercode:-1);

View File

@ -74,8 +74,8 @@ if (GETPOST('action', 'alpha') == 'set')
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);

View File

@ -176,11 +176,12 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
// Force reload of setup for the current entity
if ((empty($line->entity)?1:$line->entity) != $conf->entity)
{
dol_syslog("cron_run_jobs.php we work on another entity conf than ".$conf->entity." so we reload user and conf", LOG_DEBUG);
echo " -> we change entity so we reload user and conf";
dol_syslog("cron_run_jobs.php we work on another entity conf than ".$conf->entity." so we reload mysoc, langs, user and conf", LOG_DEBUG);
echo " -> we change entity so we reload mysoc, langs, user and conf";
$conf->entity = (empty($line->entity)?1:$line->entity);
$conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings
$mysoc->setMysoc($conf);
// Force recheck that user is ok for the entity to process and reload permission for entity
if ($conf->entity != $user->entity && $user->entity != 0)
@ -203,6 +204,11 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
}
$user->getrights();
}
// Reload langs
$langcode = (empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT);
if (! empty($user->conf->MAIN_LANG_DEFAULT)) $langcode = $user->conf->MAIN_LANG_DEFAULT;
if ($langs->getDefaultLang() != $langcode) $langs->setDefaultLang($langcode);
}
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database