Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-05-11 09:36:31 +02:00
commit e3b9012486
82 changed files with 560 additions and 178 deletions

View File

@ -2,6 +2,83 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 11.0.4 compared to 11.0.3 *****
FIX: #13749
FIX: #7594 Expense report multi pagebreak
FIX: Access to undeclared static property: Contact::$table_element
FIX: actions on supplier proposal not saved (bad trigger name)
FIX: Add function "completeTabsHead" to "addreplace" type hook.
FIX: All forms must use newToken()
FIX: Another "Access to undeclared static property: Contact::$table_element" && "Societe::$table_element"
FIX: author search supplier proposal list
FIX: A variable was erased by a temporary variable
FIX: Avoid infinite loop when a fetch is inside a compute field.
FIX: Backto link
FIX: Bad position of total in column
FIX: bad value in currency into discount created from down payment
FIX: buyprice extrafield langfile and tooltip
FIX: Buyprice was updated only if min price for this qty had same qty
FIX: Can switch from double to price type for extrafields
FIX: Can use decimal value in virtual products
FIX: child categories only with good entity rights
FIX: cloning of emailing when no content selected
FIX: closing tags
FIX: Combo list of available users to filter on the list of leaves.
FIX: Compatibility with multicompany, bad numerotation of task.
FIX: consistency of price w/wo vat wrong when price entered with tax
FIX: default value of selectMasssAction broken
FIX: draftordered replenish virtual stock
FIX: Error update SQL into stock reception
FIX: expensereport status in generated pdf
FIX: extra date field incorrect check
FIX: Extrafields of type price must be '' and not '0' if not defined
FIX: Foreign currency lost when splitting a discount
FIX: get remain to pay with rounding decimals
FIX: gzip and bzip2 must use option -f
FIX: IHM, unexpected quote
FIX: keep viewstatut for doli 3.5
FIX: Link missing into email of some notification
FIX: Look and feel v11
FIX: md stylesheet to be included by external modules like eldy
FIX: missing array option
FIX: missing default accountancy product buy code
FIX: missing fk_bank during export of suppliers invoices
FIX: missing member entity
FIX: missing selectedlines on supplier order but checkbox are displayed
FIX: Missing token and take into account max date when it can.
FIX: model export list must be sorted by label
FIX: multicurrency manage on hidden conf SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL
FIX: Must escape shell
FIX: Must exclude logs and some dirs for compressed backup
FIX: ordered stock already in $stock
FIX: picture migration script from doli 9.0
FIX: print pictures on shipment docs
FIX: product get purchase prices
FIX: product purchase prices
FIX: Protection when database has a corrupted product id
FIX: remove unused var, $usercancreate can be change by Multicompany
FIX: replenish stock to buy
FIX: Sanitizing menu parameter
FIX: Send email from bulk action of list of thirdparties
FIX: setup of suggested payment mode on proposals and orders
FIX: Several pb in export of documents
FIX: Situation invoice take into account the credit notes.
FIX: some others modules (like subtotal) use other product_type than 0 or 1 AND must not be considered in this report
FIX: sort by default role makes no sense
FIX: sort on company on member list
FIX: TakePOS buying price
FIX: text version of html emailing (removed the body style)
FIX: The "test smtp connectivity" failed on page to setup mass emailing
FIX: Error logs an Orderline::delete error, but this is an Orderline::insert error
FIX: Translation of tooltips of extrafields
FIX: Use getNomURL instead of hard coded link. Fix limit.
FIX: Use of image into free text for PDF if DOL_DATA_DIR is outside of
FIX: viewstatut to search status
FIX: we must export company mail address on contact vcard only if contact email address is empty
FIX: when we filter a list on a view status, we want this filter to be on bookmark that we create
FIX: Wrong Sql on getListOfTowns api method
FIX: wrong user right's name to top menu "commercial"
FIX: XSS Vulnerability
***** ChangeLog for 11.0.3 compared to 11.0.2 *****
FIX: unit price for selected supplier products not set. NaN was used.

View File

@ -19,7 +19,7 @@ use Term::ANSIColor;
# Change this to defined target for option 98 and 99
$PROJECT="dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages

View File

@ -966,7 +966,7 @@ while ($i < min($num, $limit))
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -872,7 +872,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -524,7 +524,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -479,7 +479,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column

View File

@ -200,7 +200,6 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<div class="formelementrow">';
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
print '</div>';
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {

View File

@ -137,6 +137,15 @@ class DolibarrApi
unset($object->labelStatus);
unset($object->labelStatusShort);
unset($object->stats_propale);
unset($object->stats_commande);
unset($object->stats_contrat);
unset($object->stats_facture);
unset($object->stats_commande_fournisseur);
unset($object->stats_reception);
unset($object->stats_mrptoconsume);
unset($object->stats_mrptoproduce);
unset($object->element);
unset($object->fk_element);
unset($object->table_element);

View File

@ -459,7 +459,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column

View File

@ -718,7 +718,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -615,7 +615,8 @@ class AdvanceTargetingMailing extends CommonObject
//Standard Extrafield feature
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
$elementtype = Societe::$table_element;
$socstatic = new Societe($this->db);
$elementtype = $socstatic->table_element;
$extrafields->fetch_name_optionals_label($elementtype);
@ -752,7 +753,8 @@ class AdvanceTargetingMailing extends CommonObject
//Standard Extrafield feature
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
$elementtype = Contact::$table_element;
$contactstatic = new Contact($this->db);
$elementtype = $contactstatic->table_element;
// fetch optionals attributes and labels
dol_include_once('/core/class/extrafields.class.php');
@ -854,7 +856,8 @@ class AdvanceTargetingMailing extends CommonObject
//Standard Extrafield feature
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
$elementtype = Societe::$table_element;
$socstatic = new Societe($this->db);
$elementtype = $socstatic->table_element;
// fetch optionals attributes and labels
dol_include_once('/core/class/extrafields.class.php');

View File

@ -2992,8 +2992,11 @@ class Propal extends CommonObject
if (!$error)
{
$main = MAIN_DB_PREFIX . 'propaldet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id;
if ($this->db->query($sql))

View File

@ -1065,7 +1065,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -3396,6 +3396,19 @@ class Commande extends CommonOrder
$error++;
}
if (!$error)
{
// Delete extrafields of order details
$main = MAIN_DB_PREFIX . 'commandedet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = " . $this->id . ")";
if (!$this->db->query($sql))
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
if (!$error)
{
// Delete order details

View File

@ -1075,7 +1075,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -23,7 +23,7 @@
* \brief Page to show portoflio and files of a thirdparty and download it
*/
if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file
if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
}

View File

@ -529,7 +529,7 @@ foreach ($accounts as $key=>$type)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -496,7 +496,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column

View File

@ -1713,6 +1713,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;
@ -1724,6 +1726,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)
{
@ -1768,6 +1781,7 @@ if (empty($reshook))
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost(null, $nextSituationInvoice);
@ -4534,7 +4548,7 @@ elseif ($id > 0 || !empty($ref))
$current_situation_counter = array();
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye_prev = $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;
@ -4545,7 +4559,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_prev).'</td>';
print '<td class="right">'.$prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice).'</td>';
print '</tr>';
}
}

View File

@ -664,9 +664,13 @@ class FactureRec extends CommonInvoice
$error = 0;
$this->db->begin();
$main = MAIN_DB_PREFIX . 'facturedet_rec';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
dol_syslog($sqlef);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
dol_syslog($sql);
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
dol_syslog($sql);
@ -675,6 +679,9 @@ class FactureRec extends CommonInvoice
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error = -3;
// Delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error = -4;
}
else
{
@ -1882,6 +1889,14 @@ class FactureLigneRec extends CommonInvoiceLine
}
}
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
}
}
if (!$error)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;

View File

@ -1434,9 +1434,10 @@ class Facture extends CommonInvoice
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
if ($txttoshow)
{
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
//$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
$result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow, 1, 1).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
@ -2165,13 +2166,16 @@ class Facture extends CommonInvoice
}
}
// Invoice line extrafileds
$main = MAIN_DB_PREFIX . 'facturedet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
// Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql) && $this->delete_linked_contact())
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact())
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid;
@ -5311,6 +5315,13 @@ class FactureLigne extends CommonInvoiceLine
}
// End call triggers
// extrafields
$result = $this->deleteExtraFields();
if ($result < 0)
{
$this->db->rollback();
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -5403,7 +5414,7 @@ class FactureLigne extends CommonInvoiceLine
$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;
$sql .= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed
$sql .= ' AND f.situation_cycle_ref = '.$invoicecache[$invoiceid]->situation_cycle_ref; // Prevent cycle outed
$sql .= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE;
$res = $this->db->query($sql);
@ -5411,6 +5422,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

@ -1313,7 +1313,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -53,6 +53,7 @@ $search_ref = GETPOST('search_ref', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$bon = new BonPrelevement($db, "");
$hookmanager->initHooks(array('withdrawalsreceiptslist'));
/*

View File

@ -58,6 +58,8 @@ $statut = GETPOST('statut', 'int');
$bon = new BonPrelevement($db, "");
$ligne = new LignePrelevement($db, $user);
$hookmanager->initHooks(array('withdrawalsreceiptslineslist'));
/*
* Actions

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

@ -936,7 +936,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1234,6 +1234,22 @@ class Contrat extends CommonObject
}
}
if (!$error)
{
// Delete contratdet extrafields
$main = MAIN_DB_PREFIX . 'contratdet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_contrat = " . $this->id . ")";
dol_syslog(get_class($this)."::delete contratdet_extrafields", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->error();
$error++;
}
}
if (!$error)
{
// Delete contratdet

View File

@ -744,7 +744,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -687,7 +687,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -2962,8 +2962,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)
@ -3002,18 +3002,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'
{
$localtax_array = array($obj->localtax1_type, $obj->localtax1_tx, $obj->localtax2_type, $obj->localtax2_tx);
// 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];
}
}
@ -5007,6 +5012,25 @@ abstract class CommonObject
/* Functions for extrafields */
/**
* Function to make a fetch but set environment to avoid to load computed values before.
*
* @param int $id ID of object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
public function fetchNoCompute($id)
{
global $conf;
$savDisableCompute = $conf->disable_compute;
$conf->disable_compute = 1;
$ret = $this->fetch($id);
$conf->disable_compute = $savDisableCompute;
return $ret;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
@ -5020,7 +5044,7 @@ abstract class CommonObject
public function fetch_optionals($rowid = null, $optionsArray = null)
{
// phpcs:enable
global $extrafields;
global $conf, $extrafields;
if (empty($rowid)) $rowid = $this->id;
@ -5104,7 +5128,10 @@ abstract class CommonObject
foreach ($tab as $key => $value) {
if (!empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key]))
{
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0);
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0);
}
}
}
}

View File

@ -48,6 +48,8 @@ class Conf
//! To store if javascript/ajax is enabked
public $use_javascript_ajax;
//! To store if javascript/ajax is enabked
public $disable_compute;
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
public $currency;
//! Used to store current css (from theme)

View File

@ -1681,7 +1681,8 @@ class ExtraFields
}
elseif ($type == 'price')
{
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
if ($value || $value == '0') $value = price($value, 0, $langs, 0, 0, -1);
}
elseif ($type == 'select')
{

View File

@ -1574,16 +1574,16 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users
* Return the HTML select list of users
*
* @param string $selected Id user preselected
* @param string $htmlname Field name in form
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array $include Array list of users id to include
* @param int $enableonly Array list of users id to be enabled. All other must be disabled
* @param string $force_entity '0' or Ids of environment to force
* @param string $selected Id user preselected
* @param string $htmlname Field name in form
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param int $enableonly Array list of users id to be enabled. All other must be disabled
* @param string $force_entity '0' or Ids of environment to force
* @return void
* @deprecated Use select_dolusers instead
* @see select_dolusers()
@ -1598,24 +1598,24 @@ class Form
/**
* Return select list of users
*
* @param string $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1, keep unselected (if empty is allowed)
* @param string $htmlname Field name in form
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param array $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
* @param string $force_entity '0' or Ids of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request (Example: 'employee = 1')
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
* @param int $outputmode 0=HTML select string, 1=Array
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return string HTML select string
* @param string $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1, keep unselected (if empty is allowed)
* @param string $htmlname Field name in form
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param array $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
* @param string $force_entity '0' or Ids of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request (Example: 'employee = 1')
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
* @param int $outputmode 0=HTML select string, 1=Array
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return string HTML select string
* @see select_dolgroups()
*/
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false)

View File

@ -77,7 +77,7 @@ class FormOther
$sql .= " FROM ".MAIN_DB_PREFIX."export_model";
$sql .= " WHERE type = '".$this->db->escape($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)
{
@ -603,8 +603,6 @@ class FormOther
$numlines = count($lines);
for ($i = 0; $i < $numlines; $i++) {
if ($lines[$i]->fk_parent == $parent) {
$var = !$var;
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
// Break on a new project

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;
@ -400,6 +401,9 @@ class Notify
$sendto = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <".$obj->email.">";
$notifcodedefid = $obj->adid;
$trackid = '';
if ($obj->type_target == 'tocontactid') $trackid = 'con'.$obj->id;
if ($obj->type_target == 'touserid') $trackid = 'use'.$obj->id;
if (dol_strlen($obj->email))
{
@ -416,95 +420,100 @@ 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;
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $newref);
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
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;
$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("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':
$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("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);
@ -523,9 +532,10 @@ 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);
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))
{
@ -547,7 +557,7 @@ class Notify
-1,
'',
'',
'',
$trackid,
'',
'notification'
);
@ -598,6 +608,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];
@ -612,6 +623,7 @@ class Notify
$sendto = $conf->global->$param;
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
$trackid = '';
$object_type = '';
$link = '';
@ -652,7 +664,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;
@ -695,29 +707,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);
@ -732,11 +749,9 @@ class Notify
$filepdf = $pdf_path;
}
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n";
$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);
@ -779,7 +794,7 @@ class Notify
0,
1,
'',
'',
$trackid,
'',
'',
'notification'

View File

@ -184,8 +184,8 @@ else // If external user
}
// Load the menu manager (only if not already done)
$file_menu=$conf->standard_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
$file_menu = $conf->standard_menu;
if (GETPOST('menu', 'aZ09')) $file_menu = GETPOST('menu', 'aZ09'); // example: menu=eldy_menu.php
if (! class_exists('MenuManager'))
{
$menufound=0;

View File

@ -896,15 +896,23 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0,
if ($timestampStart < $timestampEnd)
{
$numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
$nbOpenDay = $numdays - $numholidays;
$nbOpenDay.= " " . $langs->trans("Days");
$nbOpenDay.= ' '.$langs->trans("Days");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
}
elseif ($timestampStart == $timestampEnd)
{
$numholidays = 0;
if ($lastday) {
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
if ($numholidays == 1) return 0;
}
$nbOpenDay=$lastday;
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
}

View File

@ -960,18 +960,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;
}
}
@ -1848,6 +1848,7 @@ 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 {

View File

@ -4548,7 +4548,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
{
if ($currency_code == 'auto') $currency_code = $conf->currency;
$listofcurrenciesbefore = array('USD', 'GBP', 'AUD', 'HKD', 'MXN', 'PEN', 'CNY', 'CAD');
$listofcurrenciesbefore = array('AUD', 'CAD', 'CNY', 'COP', 'CLP', 'GBP', 'HKD', 'MXN', 'PEN', 'USD');
$listoflanguagesbefore = array('nl_NL');
if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore))
{

View File

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

@ -227,19 +227,21 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$tmpentry = array(
'enabled'=>(!empty($conf->propal->enabled) ||
!empty($conf->commande->enabled) ||
!empty($conf->supplier_order->enabled) ||
!empty($conf->supplier_proposal->enabled) ||
!empty($conf->contrat->enabled) ||
!empty($conf->fournisseur->enabled) ||
!empty($conf->supplier_proposal->enabled) ||
!empty($conf->supplier_order->enabled) ||
!empty($conf->contrat->enabled) ||
!empty($conf->ficheinter->enabled)
) ? 1 : 0,
'perms'=>(!empty($user->rights->propal->lire) ||
!empty($user->rights->commande->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->fournisseur->lire) ||
!empty($user->rights->supplier_proposal->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire)
),
'module'=>'propal|commande|supplier_order|supplier_proposal|contrat|ficheinter'
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
);
$onlysupplierorder = ! empty($user->rights->fournisseur->commande->lire) &&

View File

@ -346,7 +346,10 @@ class modFournisseur extends DolibarrModules
case 'sellist':
$tmp='';
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$var=array_keys($tmpparam['options']);
$tmp=array_shift($var);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
break;
}

View File

@ -474,7 +474,6 @@ class doc_generic_task_odt extends ModelePDFTask
if (!file_exists($dir))
{
print '$dir'.$dir;
if (dol_mkdir($dir) < 0)
{
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);

View File

@ -193,14 +193,17 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
// Define list of possible type transition
$typewecanchangeinto=array(
'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'),
'text'=>array('text','html'),
'html'=>array('text','html'),
'double'=>array('double', 'price'),
'price'=>array('double', 'price'),
'text'=>array('text', 'html'),
'html'=>array('text', 'html'),
'password'=>array('password', 'varchar'),
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'select'=>array('varchar', 'phone', 'mail', 'url', 'select')
);
if (in_array($type, array_keys($typewecanchangeinto)))
{
$newarray=array();

View File

@ -459,7 +459,8 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
// Standard Extrafield feature
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
$elementype = Contact::$table_element;
$contactstatic = new Contact($db);
$elementype = $contactstatic->table_element;
// fetch optionals attributes and labels
dol_include_once('/core/class/extrafields.class.php');
$extrafields = new ExtraFields($db);

View File

@ -33,12 +33,12 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array
$sql.= ")";
}
}
elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
elseif ($crit != '' && (! in_array($typ, array('select', 'sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
{
$mode_search=0;
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string
elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) {
$sql .= ' AND (' . $extrafieldsobjectprefix.$tmpkey . ' = "' . $db->escape($crit) . '")';

View File

@ -813,7 +813,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
jQuery("#prod_entry_mode_free").prop('checked',true).change();
jQuery("#prod_entry_mode_predef").prop('checked',false).change();
jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val('');
jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_fourn_ref, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
jQuery("#fournprice_predef").hide();
}
@ -825,11 +825,13 @@ if (!empty($usemargins) && $user->rights->margins->creer)
<?php if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?>
jQuery("#price_ht").val('').show();
jQuery("#multicurrency_price_ht").val('').show();
jQuery("#title_up_ht, #title_up_ht_currency").show();
<?php } else { ?>
jQuery("#price_ht").val('').hide();
jQuery("#multicurrency_price_ht").val('').hide();
jQuery("#title_up_ht, #title_up_ht_currency").hide();
<?php } ?>
jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_fourn_ref, #title_vat, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#buying_price").show();
jQuery('#trlinefordates, .divlinefordates').show();

View File

@ -1280,15 +1280,23 @@ class Expedition extends CommonObject
if (!$error)
{
$main = MAIN_DB_PREFIX . 'expeditiondet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
$sql .= " WHERE fk_expedition = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
// delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error++;
if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition";

View File

@ -591,7 +591,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1049,7 +1049,7 @@ class ExpenseReport extends CommonObject
$deplig = new ExpenseReportLine($this->db);
$deplig->rowid = $objp->rowid;
$deplig->id = $objp->id;
$deplig->id = $objp->rowid;
$deplig->comments = $objp->comments;
$deplig->qty = $objp->qty;
$deplig->value_unit = $objp->value_unit;

View File

@ -761,7 +761,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -961,6 +961,16 @@ class Fichinter extends CommonObject
}
}
if (!$error)
{
$main = MAIN_DB_PREFIX . 'fichinterdet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = " . $this->id . ")";
$resql = $this->db->query($sql);
if (!$resql) $error++;
}
if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet";
@ -1704,6 +1714,13 @@ class FichinterLigne extends CommonObjectLine
dol_syslog(get_class($this)."::deleteline lineid=".$this->id);
$this->db->begin();
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
$this->db->rollback();
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);

View File

@ -562,7 +562,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1994,6 +1994,17 @@ class CommandeFournisseur extends CommonOrder
// End call triggers
}
$main = MAIN_DB_PREFIX . 'commande_fournisseurdet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = " . $this->id . ")";
dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG);
if (!$this->db->query($sql))
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql))
@ -3700,6 +3711,14 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->db->begin();
// extrafields
$result = $this->deleteExtraFields();
if ($result < 0)
{
$this->db->rollback();
return -1;
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -303,6 +303,7 @@ class CommandeFournisseurDispatch extends CommonObject
$this->batch = $obj->batch;
$this->eatby = $this->db->jdate($obj->eatby);
$this->sellby = $this->db->jdate($obj->sellby);
$this->fetch_optionals();
}
$this->db->free($resql);
@ -439,6 +440,16 @@ class CommandeFournisseurDispatch extends CommonObject
}
}
// Remove extrafields
if (!$error) {
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR);
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
@ -689,6 +700,7 @@ class CommandeFournisseurDispatch extends CommonObject
$line->batch = $obj->batch;
$line->eatby = $this->db->jdate($obj->eatby);
$line->sellby = $this->db->jdate($obj->sellby);
$line->fetch_optionals();
$this->lines[$line->id] = $line;
}

View File

@ -1180,10 +1180,14 @@ class FactureFournisseur extends CommonInvoice
if (!$error)
{
$main = MAIN_DB_PREFIX . 'facture_fourn_det';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture_fourn = $rowid)";
$resqlef = $this->db->query($sqlef);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';';
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
if ($resqlef && $resql)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -2034,7 +2038,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;
@ -3141,6 +3145,11 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->deleteObjectLinked();
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
}
if (!$error) {
// Supprime ligne
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det ';

View File

@ -189,7 +189,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($obj->nb).'</td>';
print '<td>'.$commandestatic->LibStatut($obj->fk_statut).'</td>';
print '<td class="right"><a href="list.php?statut='.$obj->fk_statut.'">'.$obj->nb.' '.$commandestatic->LibStatut($obj->fk_statut, 3).'</a></td>';
print "</tr>\n";

View File

@ -40,6 +40,17 @@ $id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = 'a.datep,a.id';
if (!$sortorder) $sortorder = 'DESC,DESC';
if (GETPOST('actioncode', 'array'))
{
$actioncode=GETPOST('actioncode', 'array', 3);
@ -212,12 +223,12 @@ if (!empty($object->id))
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters);
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
// End of page

View File

@ -1058,7 +1058,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1291,7 +1291,9 @@ else
if ($includesunday) $htmlhelp.='<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp);
print '</td>';
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
print '<td>';
print num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
print '</td>';
print '</tr>';
if ($object->statut == Holiday::STATUS_REFUSED)

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -476,7 +476,7 @@ if ($resql)
$include = '';
if (!empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see all
if (empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see only its hierarchyl
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -488,7 +488,7 @@ if ($resql)
if (!empty($arrayfields['cp.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
@ -744,7 +744,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -427,7 +427,7 @@ ExtrafieldCheckBox=Checkboxes
ExtrafieldCheckBoxFromList=Checkboxes from table
ExtrafieldLink=Link to an object
ComputedFormula=Computed field
ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: <strong>$db, $conf, $langs, $mysoc, $user, $object</strong>.<br><strong>WARNING</strong>: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.<br>Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.<br><br>Example of formula:<br>$object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)<br><br>Example to reload object<br>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'<br><br>Other example of formula to force load of object and its parent object:<br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found'
ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: <strong>$db, $conf, $langs, $mysoc, $user, $object</strong>.<br><strong>WARNING</strong>: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.<br>Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.<br><br>Example of formula:<br>$object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)<br><br>Example to reload object<br>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'<br><br>Other example of formula to force load of object and its parent object:<br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found'
Computedpersistent=Store computed field
ComputedpersistentDesc=Computed extra fields will be stored in the database, however, the value will only be recalculated when the object of this field is changed. If the computed field depends on other objects or global data this value might be wrong!!
ExtrafieldParamHelpPassword=Leaving this field blank means this value will be stored without encryption (field must be only hidden with star on screen).<br>Set 'auto' to use the default encryption rule to save password into database (then value read will be the hash only, no way to retrieve original value)

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - main
DIRECTION=ltr
FONTFORPDF=helvética
FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=,

View File

@ -475,7 +475,7 @@ if ($id > 0)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Capital
if ($action == 'edit')

View File

@ -669,8 +669,6 @@ class Products extends DolibarrApi
}
/**
* List purchase prices
*
* Get a list of all purchase prices of products
*
* @param string $sortfield Sort field
@ -702,11 +700,11 @@ class Products extends DolibarrApi
if ($supplier > 0) {
$sql .= " AND s.fk_soc = ".$db->escape($supplier);
}
$sql .= " AND s.fk_product = t.rowid ";
$sql .= " AND s.fk_product = t.rowid";
// Select products of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".$db->escape($category);
$sql .= " AND c.fk_product = t.rowid ";
$sql .= " AND c.fk_product = t.rowid";
}
if ($mode == 1) {
// Show only products
@ -739,10 +737,15 @@ class Products extends DolibarrApi
while ($i < $min)
{
$obj = $db->fetch_object($result);
$product_static = new Product($db);
if ($product_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($product_static);
$product_fourn = new ProductFournisseur($this->db);
$product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0);
foreach($product_fourn_list as $tmpobj) {
$this->_cleanObjectDatas($tmpobj);
}
//var_dump($product_fourn_list->db);exit;
$obj_ret[$obj->rowid] = $product_fourn_list;
$i++;
}
}
@ -1527,6 +1530,7 @@ class Products extends DolibarrApi
unset($object->prices_by_qty_id);
unset($object->libelle);
unset($object->product_id_already_linked);
unset($object->reputations);
unset($object->name);
unset($object->firstname);

View File

@ -1148,7 +1148,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -515,6 +515,8 @@ class MouvementStock extends CommonObject
// Update PMP and denormalized value of stock qty at product level
if (! $error)
{
$newpmp = price2num($newpmp, 'MU');
// $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
// $sql.= " WHERE rowid = ".$fk_product;
// Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql

View File

@ -571,7 +571,7 @@ if ($num)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -476,7 +476,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -895,7 +895,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -836,7 +836,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1332,7 +1332,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
*/
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -763,8 +763,13 @@ class Reception extends CommonObject
}
// extrafields
$line->array_options = $supplierorderline->array_options;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
$line->array_options = $array_options;
{
foreach ($array_options as $key => $value) {
$line->array_options[$key] = $value;
}
}
$line->fk_product = $fk_product;
$line->fk_commande = $supplierorderline->fk_commande;
@ -938,10 +943,14 @@ class Reception extends CommonObject
if (!$error)
{
$main = MAIN_DB_PREFIX . 'commande_fournisseur_dispatch';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_reception = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch";
$sql .= " WHERE fk_reception = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
// Delete linked object
$res = $this->deleteObjectLinked();

View File

@ -885,7 +885,7 @@ if ($resql)
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -1279,7 +1279,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -481,7 +481,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column

View File

@ -2061,11 +2061,14 @@ class SupplierProposal extends CommonObject
if (! $error)
{
$main = MAIN_DB_PREFIX . 'supplier_proposaldet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_supplier_proposal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal = ".$this->id;
if ($this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal WHERE rowid = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
// Delete linked object
$res = $this->deleteObjectLinked();

View File

@ -779,7 +779,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -0,0 +1,57 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FI8TNESS 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/>.
*/
/**
* \file htdocs/theme/md/manifest.json.php
* \brief File for The Web App
*/
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (! defined('NOLOGIN')) define('NOLOGIN', '1');
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require_once __DIR__.'/../../main.inc.php';
$appli=constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
?>
{
"name": "<?php echo $appli; ?>",
"icons": [
{
"src": "<?php echo DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png'; ?>",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@ -669,7 +669,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column

View File

@ -655,7 +655,7 @@ while ($i < min($num, $limit))
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -519,7 +519,7 @@ while ($i < min($num, $limit)) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column