This commit is contained in:
Philippe 2018-02-21 12:50:23 +01:00
commit cbf12b779d
52 changed files with 595 additions and 207 deletions

View File

@ -9,6 +9,9 @@ FIX: #7379: Compatibility with PRODUCT_USE_OLD_PATH_FOR_PHOTO variable
FIX: #7903 FIX: #7903
FIX: #7933 FIX: #7933
FIX: #8029 Unable to make leave request in holyday module FIX: #8029 Unable to make leave request in holyday module
FIX: #8093
FIX: Bad name alias showing in name of third column
FIX: Cashdesk should not sell to inactive third parties
FIX: Edit accountancy account and warning message on loan FIX: Edit accountancy account and warning message on loan
FIX: $accounts[$bid] is a label ! FIX: $accounts[$bid] is a label !
FIX: $oldvatrateclean & $newvatrateclean must be set if preg_match === false FIX: $oldvatrateclean & $newvatrateclean must be set if preg_match === false
@ -16,6 +19,10 @@ FIX: product best price on product list
FIX: search on contact list FIX: search on contact list
FIX: stats trad for customerinvoice FIX: stats trad for customerinvoice
FIX: translate unactivate on contractline FIX: translate unactivate on contractline
FIX: email sent was not in HTML
FIX: missing hook invoice index
FIX: subject mail sepa
***** ChangeLog for 6.0.4 compared to 6.0.3 ***** ***** ChangeLog for 6.0.4 compared to 6.0.3 *****
FIX: #7737 FIX: #7737
@ -281,6 +288,8 @@ Following changes may create regression for some external modules, but were nece
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var * Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into $multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
the Home - setup - other admin page. the Home - setup - other admin page.
* If you use Multicompany transverse mode, it will be necessary to check the activation of the modules in the children
entities and to review completely the rights of the groups and the users.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx') * Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can * Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1. retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.

View File

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

View File

@ -96,7 +96,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
$object->label = trim($label); $object->label = trim($label);
$object->subscription = (int) trim($subscription); $object->subscription = (int) trim($subscription);
$object->note = trim($comment); $object->note = trim($comment);
$object->mail_valid = (boolean) trim($mail_valid); $object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote); $object->vote = (boolean) trim($vote);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -134,7 +134,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$object->label = trim($label); $object->label = trim($label);
$object->subscription = (int) trim($subscription); $object->subscription = (int) trim($subscription);
$object->note = trim($comment); $object->note = trim($comment);
$object->mail_valid = (boolean) trim($mail_valid); $object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote); $object->vote = (boolean) trim($vote);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -143,7 +144,7 @@ if ($action == 'initbarcodeproducts')
$nextvalue=$modBarCodeProduct->getNextValue($productstatic,''); $nextvalue=$modBarCodeProduct->getNextValue($productstatic,'');
//print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."<br>\n"; //print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."<br>\n";
$result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'date', '', $user, 'PRODUCT_MODIFY'); $result=$productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY');
$nbtry++; $nbtry++;
if ($result > 0) $nbok++; if ($result > 0) $nbok++;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -103,7 +103,7 @@ print "</tr>\n";
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,0,1,array(),0); print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1',1,0,1,array(),0);
print '</td></tr>'; print '</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -105,7 +105,7 @@ print '<td>';
$disabled=0; $disabled=0;
$langs->load("companies"); $langs->load("companies");
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1); print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1',!$disabled,$disabled,1);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />'; //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -79,7 +79,7 @@ print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['firstname
print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>'; print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">'; print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">';
print $langs->trans("CashDeskThirdParty").': '; print $langs->trans("CashDeskThirdParty").': ';
print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', 's.client IN (1,3)', '', 0, 0, null, 0, 'valignmiddle inline-block'); print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', 's.client IN (1,3) AND s.status = 1', '', 0, 0, null, 0, 'valignmiddle inline-block');
print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">'; print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">';
//print $companyLink; //print $companyLink;
print '<br>'; print '<br>';

View File

@ -214,6 +214,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -485,6 +486,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$model=$object->modelpdf; $model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -571,6 +573,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$model=$object->modelpdf; $model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -636,7 +639,7 @@ if (empty($reshook))
$i = 0; $i = 0;
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
if ($line->total_ht!=0) if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
{ // no need to create discount if amount is null { // no need to create discount if amount is null
$amount_ht[$line->tva_tx] += $line->total_ht; $amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva; $amount_tva[$line->tva_tx] += $line->total_tva;
@ -849,6 +852,12 @@ if (empty($reshook))
foreach($facture_source->lines as $line) foreach($facture_source->lines as $line)
{ {
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) {
// load extrafields
$line->fetch_optionals();
}
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0; $fk_parent_line = 0;
@ -1412,6 +1421,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$model=$object->modelpdf; $model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -1632,6 +1642,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
@ -1655,6 +1666,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
if (! empty($prod->customcode)) if (! empty($prod->customcode))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
@ -1720,6 +1732,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$model=$object->modelpdf; $model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -1898,6 +1911,7 @@ if (empty($reshook))
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -4386,6 +4400,7 @@ else if ($id > 0 || ! empty($ref))
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
$outputlangs->load('bills'); $outputlangs->load('bills');
$outputlangs->load('products');
} }
// Build document if it not exists // Build document if it not exists

View File

@ -539,6 +539,15 @@ class Facture extends CommonInvoice
} }
$newinvoiceline->fk_parent_line=$fk_parent_line; $newinvoiceline->fk_parent_line=$fk_parent_line;
if($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except){
$discount = new DiscountAbsolute($this->db);
$discount->fetch($newinvoiceline->fk_remise_except);
$discountId = $soc->set_remise_except($discount->amount_ht, $user, $discount->description, $discount->tva_tx);
$newinvoiceline->fk_remise_except = $discountId;
}
$result=$newinvoiceline->insert(); $result=$newinvoiceline->insert();
// Defined the new fk_parent_line // Defined the new fk_parent_line
@ -2919,6 +2928,9 @@ class Facture extends CommonInvoice
$line->total_ttc = $tabprice[2]; $line->total_ttc = $tabprice[2];
$line->total_localtax1 = $tabprice[9]; $line->total_localtax1 = $tabprice[9];
$line->total_localtax2 = $tabprice[10]; $line->total_localtax2 = $tabprice[10];
$line->multicurrency_total_ht = $tabprice[16];
$line->multicurrency_total_tva = $tabprice[17];
$line->multicurrency_total_ttc = $tabprice[18];
$line->update($user); $line->update($user);
$this->update_price(1); $this->update_price(1);
$this->db->commit(); $this->db->commit();

View File

@ -63,6 +63,7 @@ if ($user->societe_id > 0)
$max=3; $max=3;
$hookmanager->initHooks(array('invoiceindex'));
/* /*
* Actions * Actions
@ -152,6 +153,10 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$sql .= " AND f.fk_soc = $socid"; $sql .= " AND f.fk_soc = $socid";
} }
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerDraft',$parameters);
$sql.=$hookmanager->resPrint;
$resql = $db->query($sql); $resql = $db->query($sql);
@ -228,7 +233,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierDraft',$parameters);
$sql.=$hookmanager->resPrint;
$resql = $db->query($sql); $resql = $db->query($sql);
if ( $resql ) if ( $resql )
@ -310,6 +318,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client"; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
$sql.= " ORDER BY f.tms DESC "; $sql.= " ORDER BY f.tms DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -419,6 +432,11 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND ff.entity = ".$conf->entity; $sql.= " AND ff.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid; if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierLastModified',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid, s.code_fournisseur"; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid, s.code_fournisseur";
$sql.= " ORDER BY ff.tms DESC "; $sql.= " ORDER BY ff.tms DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -498,6 +516,11 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
$sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut"; $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " WHERE d.entity = ".$conf->entity; $sql.= " WHERE d.entity = ".$conf->entity;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereLastDonations',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= $db->order("d.tms","DESC"); $sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
@ -569,6 +592,11 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " WHERE c.fk_type = cc.id"; $sql.= " WHERE c.fk_type = cc.id";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.paye = 0"; $sql.= " AND c.paye = 0";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereSocialContributions',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY c.rowid, c.amount, c.date_ech, c.paye, cc.libelle"; $sql.= " GROUP BY c.rowid, c.amount, c.date_ech, c.paye, cc.libelle";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -652,6 +680,11 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
if ($socid) $sql.= " AND c.fk_soc = ".$socid; if ($socid) $sql.= " AND c.fk_soc = ".$socid;
$sql.= " AND c.fk_statut = 3"; $sql.= " AND c.fk_statut = 3";
$sql.= " AND c.facture = 0"; $sql.= " AND c.facture = 0";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc"; $sql.= " GROUP BY s.nom, s.rowid, s.code_client, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -756,6 +789,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client"; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC"; $sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
@ -879,6 +917,11 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql.= " AND ff.fk_statut = 1"; $sql.= " AND ff.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql.= " AND ff.fk_soc = ".$socid; if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,"; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement"; $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
$sql.= " ORDER BY ff.date_lim_reglement ASC"; $sql.= " ORDER BY ff.date_lim_reglement ASC";

View File

@ -236,10 +236,10 @@ class RejetPrelevement
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$subject = $langs->trans("InfoRejectSubject"); $subject = $langs->transnoentities("InfoRejectSubject");
$sendto = $emuser->getFullName($langs)." <".$emuser->email.">"; $sendto = $emuser->getFullName($langs)." <".$emuser->email.">";
$from = $this->user->getFullName($langs)." <".$this->user->email.">"; $from = $this->user->getFullName($langs)." <".$this->user->email.">";
$msgishtml=0; $msgishtml=1;
$arr_file = array(); $arr_file = array();
$arr_mime = array(); $arr_mime = array();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -101,7 +101,7 @@ if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'"; if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
if ($search_bon) $sql.= natural_search("p.ref", $search_bon); if ($search_bon) $sql.= natural_search("p.ref", $search_bon);
if ($search_code) $sql.= natural_search("s.code_client", $search_code); if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_company) natural_search("s.nom", $search_company); if ($search_company) $sql.= natural_search("s.nom", $search_company);
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -123,13 +123,14 @@ if ($result)
$urladd = "&amp;statut=".$statut; $urladd = "&amp;statut=".$statut;
$urladd .= "&amp;search_bon=".$search_bon; $urladd .= "&amp;search_bon=".$search_bon;
if ($limit > 0 && $limit != $conf->liste_limit) $urladd.='&limit='.urlencode($limit);
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
$moreforfilter=''; print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
$moreforfilter='';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
@ -753,6 +753,30 @@ if (empty($reshook))
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
{ {
$result = $object->validate($user); $result = $object->validate($user);
if ($result > 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
} }
else if ($action == 'reopen' && $user->rights->contrat->creer) else if ($action == 'reopen' && $user->rights->contrat->creer)

View File

@ -322,7 +322,11 @@ class Contrat extends CommonObject
$result=$this->thirdparty->set_as_client(); $result=$this->thirdparty->set_as_client();
// Define new ref // Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life if ($force_number)
{
$num = $force_number;
}
else if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{ {
$num = $this->getNextNumRef($this->thirdparty); $num = $this->getNextNumRef($this->thirdparty);
} }
@ -2983,7 +2987,16 @@ class ContratLigne extends CommonObjectLine
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet'); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
// FIXME Missing insert of extrafields // Insert of extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$this->db->rollback();
return -1;
}
}
if (!$notrigger) if (!$notrigger)
{ {

View File

@ -75,7 +75,7 @@ $opclotureyear=GETPOST('opclotureyear');
$filter_opcloture=GETPOST('filter_opcloture'); $filter_opcloture=GETPOST('filter_opcloture');
// Initialize context for list // Initialize context for list
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array($contextpage)); $hookmanager->initHooks(array($contextpage));

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -50,7 +51,19 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td><?php echo $objectlink->getNomUrl(1); ?></td> <td><?php echo $objectlink->getNomUrl(1); ?></td>
<td></td> <td></td>
<td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td> <td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td>
<td align="right">&nbsp;</td> <td align="right"><?php
// Price of contract is not shown by default because a contract is a list of service with
// start and end date that change with time andd that may be different that the period of reference for price.
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
{
$totalcontrat = 0;
foreach ($objectlink->lines as $linecontrat) {
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
$total = $total + $linecontrat->total_ht;
}
echo price($totalcontrat);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(7); ?></td> <td align="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td> <td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
</tr> </tr>

View File

@ -1183,33 +1183,41 @@ abstract class CommonObject
} }
/** /**
* Load object from specific field * Load object from specific field
* *
* @param string $table Table element or element line * @param string $table Table element or element line
* @param string $field Field selected * @param string $field Field selected
* @param string $key Import key * @param string $key Import key
* @return int <0 if KO, >0 if OK * @param string $element Element name
* @return int <0 if KO, >0 if OK
*/ */
function fetchObjectFrom($table,$field,$key) function fetchObjectFrom($table, $field, $key, $element = null)
{ {
global $conf; global $conf;
$result=false; $result=false;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." = '".$key."'"; $sql.= " WHERE ".$field." = '".$key."'";
$sql.= " AND entity = ".$conf->entity; if (! empty($element)) {
$sql.= " AND entity IN (".getEntity($element).")";
} else {
$sql.= " AND entity = ".$conf->entity;
}
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG); dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$result = $this->fetch($row[0]); // Test for avoid error -1
} if ($row[0] > 0) {
$result = $this->fetch($row[0]);
}
}
return $result; return $result;
} }
/** /**
* Getter generic. Load value from a specific field * Getter generic. Load value from a specific field

View File

@ -1651,9 +1651,16 @@ class ExtraFields
$error_field_required[] = $value; $error_field_required[] = $value;
} }
if (in_array($key_type,array('date','datetime'))) if (in_array($key_type,array('date')))
{ {
// Clean parameters // Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
$value_key=dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
}
elseif (in_array($key_type,array('datetime')))
{
// Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
$value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
} }
else if (in_array($key_type,array('checkbox','chkbxlst'))) else if (in_array($key_type,array('checkbox','chkbxlst')))
@ -1692,12 +1699,12 @@ class ExtraFields
} }
/** /**
* return array_options array for object by extrafields value (using for data send by forms) * return array_options array of data of extrafields value of object sent by a search form
* *
* @param array $extralabels $array of extrafields * @param array $extralabels $array of extrafields
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return int 1 if array_options set / 0 if no value * @return array|int array_options set or 0 if no value
*/ */
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='') function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
{ {

View File

@ -397,13 +397,13 @@ class Notify
break; break;
case 'FICHINTER_ADD_CONTACT': case 'FICHINTER_ADD_CONTACT':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref);
break; break;
case 'FICHINTER_VALIDATE': case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break; break;
@ -651,8 +651,9 @@ class Notify
} }
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval); dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto); $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string $sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string $sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
} }
if ($sendto) if ($sendto)

View File

@ -89,6 +89,7 @@ abstract class DoliDB implements Database
*/ */
function idate($param) function idate($param)
{ {
// TODO GMT $param should be gmt, so we should add tzouptut to 'gmt'
return dol_print_date($param,"%Y%m%d%H%M%S"); return dol_print_date($param,"%Y%m%d%H%M%S");
} }
@ -279,6 +280,7 @@ abstract class DoliDB implements Database
*/ */
function jdate($string, $gm=false) function jdate($string, $gm=false)
{ {
// TODO GMT must set param gm to true by default
if ($string==0 || $string=="0000-00-00 00:00:00") return ''; if ($string==0 || $string=="0000-00-00 00:00:00") return '';
$string=preg_replace('/([^0-9])/i','',$string); $string=preg_replace('/([^0-9])/i','',$string);
$tmp=$string.'000000'; $tmp=$string.'000000';

View File

@ -1248,7 +1248,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
&& (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
) )
{ {
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here. if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{ {
$ret = dol_convert_file($file, 'png', $fileimage); $ret = dol_convert_file($file, 'png', $fileimage);
if ($ret < 0) $error++; if ($ret < 0) $error++;
@ -1781,11 +1781,13 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
if (empty($localtz)) { if (empty($localtz)) {
$localtz = new DateTimeZone('UTC'); $localtz = new DateTimeZone('UTC');
} }
//var_dump($localtz);
//var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
$dt = new DateTime(null,$localtz); $dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day); $dt->setDate($year,$month,$day);
$dt->setTime((int) $hour, (int) $minute, (int) $second); $dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp(); // should include daylight saving time $date=$dt->getTimestamp(); // should include daylight saving time
//var_dump($date);
return $date; return $date;
} }
else else

View File

@ -1471,7 +1471,7 @@ function dol_print_reduction($reduction,$langs)
} }
else else
{ {
$string = price($reduction).'%'; $string = vatrate($reduction,true);
} }
return $string; return $string;

View File

@ -104,7 +104,7 @@ function dol_hash($chain,$type=0)
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param Canvas $objcanvas Object canvas * @param Canvas $objcanvas Object canvas
@ -382,7 +382,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object $checkproject = array('projet','project'); // Test for project object
$checktask = array('projet_task'); $checktask = array('projet_task');
$nocheck = array('barcode','stock','fournisseur'); // No test $nocheck = array('barcode','stock'); // No test
$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). $checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
// If dbtablename not defined, we use same name for table than module name // If dbtablename not defined, we use same name for table than module name
@ -502,7 +502,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
} }
else if (! in_array($feature,$nocheck)) // By default we check with link to third party else if (! in_array($feature,$nocheck)) // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
{ {
// If external user: Check permission for external users // If external user: Check permission for external users
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -524,7 +524,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid; $sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
$sql.= " AND sc.fk_soc = dbt.".$dbt_keyfield; $sql.= " AND sc.fk_soc = dbt.".$dbt_keyfield;
$sql.= " AND dbt.".$dbt_keyfield." = s.rowid"; $sql.= " AND dbt.".$dbt_keyfield." = s.rowid";
$sql.= " AND s.entity IN (".getEntity($sharedelement, 1).")"; $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql.= " AND sc.fk_user = ".$user->id; $sql.= " AND sc.fk_user = ".$user->id;
} }
// If multicompany and internal users with all permissions, check user is in correct entity // If multicompany and internal users with all permissions, check user is in correct entity

View File

@ -133,10 +133,10 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
$this->posxtva=99; $this->posxtva=101;
$this->posxup=114; $this->posxup=118;
$this->posxqty=130; $this->posxqty=135;
$this->posxunit=147; $this->posxunit=151;
} }
else else
{ {
@ -179,7 +179,7 @@ class pdf_einstein extends ModelePDFCommandes
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -293,16 +293,17 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->AddPage(); $pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs); $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 90; $tab_top = 90+$top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10);
$tab_height = 130; $tab_height = 130-$top_shift;
$tab_height_newpage = 150; $tab_height_newpage = 150;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
@ -1298,16 +1299,32 @@ class pdf_einstein extends ModelePDFCommandes
$posy+=2; $posy+=2;
$top_shift = 0;
// Show list of linked objects // Show list of linked objects
$current_y = $pdf->getY();
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($current_y < $pdf->getY())
{
$top_shift = $pdf->getY() - $current_y;
}
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); $carac_emetteur='';
// Add internal contact of proposal if defined
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$object->fetch_user($arrayidcontact[0]);
$labelbeforecontactname=($outputlangs->transnoentities("FromContactName")!='FromContactName'?$outputlangs->transnoentities("FromContactName"):$outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
}
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender // Show sender
$posy=42; $posy=42+$top_shift;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40; $hautcadre=40;
@ -1359,7 +1376,7 @@ class pdf_einstein extends ModelePDFCommandes
// Show recipient // Show recipient
$widthrecbox=100; $widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42; $posy=42+$top_shift;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
@ -1384,6 +1401,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
return $top_shift;
} }
/** /**

View File

@ -118,10 +118,10 @@ class pdf_crabe extends ModelePDFFactures
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
$this->posxtva=99; $this->posxtva=101;
$this->posxup=114; $this->posxup=118;
$this->posxqty=130; $this->posxqty=135;
$this->posxunit=147; $this->posxunit=151;
} }
else else
{ {
@ -168,7 +168,7 @@ class pdf_crabe extends ModelePDFFactures
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -331,15 +331,16 @@ class pdf_crabe extends ModelePDFFactures
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs); $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 90; $tab_top = 90+$top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10);
$tab_height = 130; $tab_height = 130-$top_shift;
$tab_height_newpage = 150; $tab_height_newpage = 150;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
@ -1670,8 +1671,14 @@ class pdf_crabe extends ModelePDFFactures
$posy+=1; $posy+=1;
$top_shift = 0;
// Show list of linked objects // Show list of linked objects
$current_y = $pdf->getY();
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
if ($current_y < $pdf->getY())
{
$top_shift = $pdf->getY() - $current_y;
}
if ($showaddress) if ($showaddress)
{ {
@ -1680,6 +1687,7 @@ class pdf_crabe extends ModelePDFFactures
// Show sender // Show sender
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
$posy+=$top_shift;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
@ -1735,6 +1743,7 @@ class pdf_crabe extends ModelePDFFactures
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
$posy+=$top_shift;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
@ -1759,6 +1768,7 @@ class pdf_crabe extends ModelePDFFactures
} }
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
return $top_shift;
} }
/** /**

View File

@ -107,10 +107,10 @@ class pdf_azur extends ModelePDFPropales
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
$this->posxtva=99; $this->posxtva=101;
$this->posxup=114; $this->posxup=118;
$this->posxqty=130; $this->posxqty=135;
$this->posxunit=147; $this->posxunit=151;
} }
else else
{ {
@ -153,7 +153,7 @@ class pdf_azur extends ModelePDFPropales
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -329,16 +329,17 @@ class pdf_azur extends ModelePDFPropales
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
//print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
$this->_pagehead($pdf, $object, 1, $outputlangs); $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 90; $tab_top = 90+$top_shift;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42+$top_shift:10);
$tab_height = 130; $tab_height = 130-$top_shift;
$tab_height_newpage = 150; $tab_height_newpage = 150;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift;
// Incoterm // Incoterm
$height_incoterms = 0; $height_incoterms = 0;
@ -1484,8 +1485,14 @@ class pdf_azur extends ModelePDFPropales
$posy+=2; $posy+=2;
$top_shift = 0;
// Show list of linked objects // Show list of linked objects
$current_y = $pdf->getY();
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($current_y < $pdf->getY())
{
$top_shift = $pdf->getY() - $current_y;
}
if ($showaddress) if ($showaddress)
{ {
@ -1503,7 +1510,7 @@ class pdf_azur extends ModelePDFPropales
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender // Show sender
$posy=42; $posy=42+$top_shift;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40; $hautcadre=40;
@ -1554,7 +1561,7 @@ class pdf_azur extends ModelePDFPropales
// Show recipient // Show recipient
$widthrecbox=100; $widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42; $posy=42+$top_shift;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox; $posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
@ -1579,6 +1586,7 @@ class pdf_azur extends ModelePDFPropales
} }
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
return $top_shift;
} }
/** /**

View File

@ -139,7 +139,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
*/ */
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$hookmanager; global $user,$langs,$conf,$mysoc,$hookmanager,$nblignes;
// Get source company // Get source company
if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); if (! is_object($object->thirdparty)) $object->fetch_thirdparty();

View File

@ -154,7 +154,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*/ */
function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$hookmanager,$mysoc; global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO

View File

@ -141,7 +141,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{ {
global $user,$langs,$conf,$mysoc,$db,$hookmanager; global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO

View File

@ -201,18 +201,12 @@ if ($permission) {
if ($tab[$i]['source']=='internal') if ($tab[$i]['source']=='internal')
{ {
$userstatic->id=$tab[$i]['id']; $userstatic->fetch($tab[$i]['id']);
$userstatic->lastname=$tab[$i]['lastname'];
$userstatic->firstname=$tab[$i]['firstname'];
$userstatic->photo=$tab[$i]['photo'];
$userstatic->login=$tab[$i]['login'];
echo $userstatic->getNomUrl(-1); echo $userstatic->getNomUrl(-1);
} }
if ($tab[$i]['source']=='external') if ($tab[$i]['source']=='external')
{ {
$contactstatic->id=$tab[$i]['id']; $contactstatic->fetch($tab[$i]['id']);
$contactstatic->lastname=$tab[$i]['lastname'];
$contactstatic->firstname=$tab[$i]['firstname'];
echo $contactstatic->getNomUrl(1); echo $contactstatic->getNomUrl(1);
} }
?> ?>
@ -223,16 +217,10 @@ if ($permission) {
<?php <?php
if ($tab[$i]['source']=='internal') if ($tab[$i]['source']=='internal')
{ {
$userstatic->id=$tab[$i]['id'];
$userstatic->lastname=$tab[$i]['lastname'];
$userstatic->firstname=$tab[$i]['firstname'];
echo $userstatic->LibStatut($tab[$i]['statuscontact'],3); echo $userstatic->LibStatut($tab[$i]['statuscontact'],3);
} }
if ($tab[$i]['source']=='external') if ($tab[$i]['source']=='external')
{ {
$contactstatic->id=$tab[$i]['id'];
$contactstatic->lastname=$tab[$i]['lastname'];
$contactstatic->firstname=$tab[$i]['firstname'];
echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3); echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3);
} }
?> ?>

View File

@ -140,7 +140,7 @@ class Fichinter extends CommonObject
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $conf, $user, $langs; global $conf, $langs;
dol_syslog(get_class($this)."::create ref=".$this->ref); dol_syslog(get_class($this)."::create ref=".$this->ref);
@ -1169,6 +1169,8 @@ class Fichinter extends CommonObject
*/ */
function fetch_lines() function fetch_lines()
{ {
$this->lines = array();
$sql = 'SELECT rowid, description, duree, date, rang'; $sql = 'SELECT rowid, description, duree, date, rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet';
$sql.=' WHERE fk_fichinter = '.$this->id .' ORDER BY rang ASC, date ASC' ; $sql.=' WHERE fk_fichinter = '.$this->id .' ORDER BY rang ASC, date ASC' ;

View File

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

View File

@ -101,6 +101,21 @@ if (empty($reshook))
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int')); $result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
if ($action == 'update_extras') {
$object->fetch($id);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0) $error++;
}
if ($error) $action = 'edit_extras';
}
} }

View File

@ -468,9 +468,11 @@ class ProductFournisseur extends Product
* @param int $prodid Id of product * @param int $prodid Id of product
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit
* @param int $offset Offset
* @return array Array of Products with new properties to define supplier price * @return array Array of Products with new properties to define supplier price
*/ */
function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='') function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $limit=0, $offset=0)
{ {
global $conf; global $conf;
@ -484,7 +486,8 @@ class ProductFournisseur extends Product
$sql.= " AND s.status=1"; // only enabled company selected $sql.= " AND s.status=1"; // only enabled company selected
$sql.= " AND pfp.fk_product = ".$prodid; $sql.= " AND pfp.fk_product = ".$prodid;
if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price"; if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price";
else $sql.= $this->db->order($sortfield,$sortorder); else $sql.= $this->db->order($sortfield, $sortorder);
$sql.=$this->db->plimit($limit, $offset);
dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG); dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -516,7 +519,7 @@ class ProductFournisseur extends Product
$prodfourn->id = $prodid; $prodfourn->id = $prodid;
$prodfourn->fourn_tva_npr = $record["info_bits"]; $prodfourn->fourn_tva_npr = $record["info_bits"];
$prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$prodfourn->supplier_reputation = $record["supplier_reputation"]; $prodfourn->supplier_reputation = $record["supplier_reputation"];
if (!empty($conf->dynamicprices->enabled) && !empty($prodfourn->fk_supplier_price_expression)) { if (!empty($conf->dynamicprices->enabled) && !empty($prodfourn->fk_supplier_price_expression)) {
$priceparser = new PriceParser($this->db); $priceparser = new PriceParser($this->db);

View File

@ -81,7 +81,7 @@ $datelivraison=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), G
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ordersuppliercard','globalcard')); $hookmanager->initHooks(array('ordersuppliercard','globalcard'));

View File

@ -44,7 +44,7 @@ $action = GETPOST('action', 'alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
$object = new CommandeFournisseur($db); $object = new CommandeFournisseur($db);

View File

@ -56,7 +56,7 @@ $lineid = GETPOST('lineid', 'int');
$action = GETPOST('action','aZ09'); $action = GETPOST('action','aZ09');
if ($user->societe_id) if ($user->societe_id)
$socid = $user->societe_id; $socid = $user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
if (empty($conf->stock->enabled)) { if (empty($conf->stock->enabled)) {
accessforbidden(); accessforbidden();

View File

@ -54,7 +54,7 @@ $confirm = GETPOST('confirm','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');

View File

@ -56,7 +56,7 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check // Security check
$socid=0; $socid=0;
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'fournisseur',$id,'', 'commande'); $result=restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
if (!$user->rights->fournisseur->commande->lire) accessforbidden(); if (!$user->rights->fournisseur->commande->lire) accessforbidden();

View File

@ -43,7 +43,7 @@ $action = GETPOST('action','aZ09');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
$object = new CommandeFournisseur($db); $object = new CommandeFournisseur($db);
$object->fetch($id, $ref); $object->fetch($id, $ref);

View File

@ -282,8 +282,8 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all)); $canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// If this is a rough draft // If this is a rough draft, approved, canceled or refused
if ($object->statut == 1 || $object->statut == 3) if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)
{ {
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
if ($canedit) if ($canedit)
@ -1246,7 +1246,7 @@ else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
} }
if ($user->rights->holiday->delete && $object->statut == 1) // If draft if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
} }

View File

@ -116,7 +116,7 @@ if (empty($reshook))
$userValue = $_POST['nb_holiday_'.$val['rowid']]; $userValue = $_POST['nb_holiday_'.$val['rowid']];
$userValue = $userValue[$userID]; $userValue = $userValue[$userID];
if (!empty($userValue)) if (!empty($userValue) || (string) $userValue == '0')
{ {
$userValue = price2num($userValue,5); $userValue = price2num($userValue,5);
} else { } else {
@ -172,11 +172,14 @@ $userstatic=new User($db);
llxHeader('', $langs->trans('CPTitreMenu')); llxHeader('', $langs->trans('CPTitreMenu'));
$typeleaves=$holiday->getTypes(1,1);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -210,10 +213,8 @@ if (is_numeric($listUsers) && $listUsers < 0)
setEventMessages($holiday->error, $holiday->errors, 'errors'); setEventMessages($holiday->error, $holiday->errors, 'errors');
} }
$var=true;
$i = 0; $i = 0;
$typeleaves=$holiday->getTypes(1,1);
if (count($typeleaves) == 0) if (count($typeleaves) == 0)
{ {
@ -234,8 +235,6 @@ else
$userchilds=$user->getAllChildIds(); $userchilds=$user->getAllChildIds();
} }
print '<input type="hidden" name="action" value="update" />';
$moreforfilter=''; $moreforfilter='';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';

View File

@ -366,14 +366,27 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
migrate_remise_except_entity($db,$langs,$conf); migrate_remise_except_entity($db,$langs,$conf);
} }
// Scripts for last version // Scripts for last version
$afterversionarray=explode('.','5.0.9'); $afterversionarray=explode('.','5.0.9');
$beforeversionarray=explode('.','6.0.9'); $beforeversionarray=explode('.','6.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
// No particular code if (! empty($conf->multicompany->enabled))
} {
} global $multicompany_transverse_mode;
// Only if the transverse mode is not used
if (empty($multicompany_transverse_mode))
{
// Migrate to add entity value into llx_user_rights
migrate_user_rights_entity($db, $langs, $conf);
// Migrate to add entity value into llx_usergroup_rights
migrate_usergroup_rights_entity($db, $langs, $conf);
}
}
}
}
// Code executed only if migrate is LAST ONE. Must always be done. // Code executed only if migrate is LAST ONE. Must always be done.
if (versioncompare($versiontoarray,$versionranarray) >= 0 || versioncompare($versiontoarray,$versionranarray) <= -3) if (versioncompare($versiontoarray,$versionranarray) >= 0 || versioncompare($versiontoarray,$versionranarray) <= -3)
@ -3967,6 +3980,158 @@ function migrate_remise_except_entity($db,$langs,$conf)
print '</td></tr>'; print '</td></tr>';
} }
/**
* Migrate to add entity value into llx_user_rights
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return void
*/
function migrate_user_rights_entity($db,$langs,$conf)
{
print '<tr><td colspan="4">';
print '<b>'.$langs->trans('MigrationUserRightsEntity')."</b><br>\n";
$error = 0;
dolibarr_install_syslog("upgrade2::migrate_user_rights_entity");
$db->begin();
$sqlSelect = "SELECT u.rowid, u.entity";
$sqlSelect.= " FROM ".MAIN_DB_PREFIX."user as u";
$sqlSelect.= " WHERE u.entity > 1";
//print $sqlSelect;
$resql = $db->query($sqlSelect);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."user_rights SET";
$sqlUpdate.= " entity = " . $obj->entity;
$sqlUpdate.= " WHERE fk_user = " . $obj->rowid;
$result=$db->query($sqlUpdate);
if (! $result)
{
$error++;
dol_print_error($db);
}
print ". ";
$i++;
}
}
else
{
print $langs->trans('AlreadyDone')."<br>\n";
}
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
}
else
{
dol_print_error($db);
$db->rollback();
}
print '</td></tr>';
}
/**
* Migrate to add entity value into llx_usergroup_rights
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return void
*/
function migrate_usergroup_rights_entity($db,$langs,$conf)
{
print '<tr><td colspan="4">';
print '<b>'.$langs->trans('MigrationUserGroupRightsEntity')."</b><br>\n";
$error = 0;
dolibarr_install_syslog("upgrade2::migrate_usergroup_rights_entity");
$db->begin();
$sqlSelect = "SELECT u.rowid, u.entity";
$sqlSelect.= " FROM ".MAIN_DB_PREFIX."usergroup as u";
$sqlSelect.= " WHERE u.entity > 1";
//print $sqlSelect;
$resql = $db->query($sqlSelect);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."usergroup_rights SET";
$sqlUpdate.= " entity = " . $obj->entity;
$sqlUpdate.= " WHERE fk_usergroup = " . $obj->rowid;
$result=$db->query($sqlUpdate);
if (! $result)
{
$error++;
dol_print_error($db);
}
print ". ";
$i++;
}
}
else
{
print $langs->trans('AlreadyDone')."<br>\n";
}
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
}
else
{
dol_print_error($db);
$db->rollback();
}
print '</td></tr>';
}
/** /**
* Migration directory * Migration directory
* *

View File

@ -193,6 +193,8 @@ MigrationCategorieAssociation=Migration of categories
MigrationEvents=Migration of events to add event owner into assignement table MigrationEvents=Migration of events to add event owner into assignement table
MigrationRemiseEntity=Update entity field value of llx_societe_remise MigrationRemiseEntity=Update entity field value of llx_societe_remise
MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_except MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_except
MigrationUserRightsEntity=Update entity field value of llx_user_rights
MigrationUserGroupRightsEntity=Update entity field value of llx_usergroup_rights
MigrationReloadModule=Reload module %s MigrationReloadModule=Reload module %s
ShowNotAvailableOptions=Show not available options ShowNotAvailableOptions=Show not available options
HideNotAvailableOptions=Hide not available options HideNotAvailableOptions=Hide not available options

View File

@ -1652,7 +1652,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
if (! empty($conf->user->enabled) && $user->rights->user->user->lire) if (! empty($conf->user->enabled) && $user->rights->user->user->lire)
{ {
$langs->load("users"); $langs->load("users");
$searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'maxwidth100', 'sall', 'M', 'searchleftuser', img_object('','user')); $searchform.=printSearchForm(DOL_URL_ROOT.'/user/index.php', DOL_URL_ROOT.'/user/index.php', $langs->trans("Users"), 'maxwidth100', 'sall', 'M', 'searchleftuser', img_object('','user'));
} }
} }

View File

@ -189,7 +189,7 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid";
$sql .= " WHERE f.fk_statut > 0"; $sql .= " WHERE f.fk_statut > 0";
$sql .= " AND f.entity = " . getEntity('facture'); $sql .= " AND f.entity IN (" . getEntity('facture') . ") ";
if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'"; if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'";
if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'"; if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'";
if ($search_ref) $sql.=natural_search('f.facnumber', $search_ref); if ($search_ref) $sql.=natural_search('f.facnumber', $search_ref);

View File

@ -63,7 +63,20 @@ if (! empty($_REQUEST['search_fourn_id']))
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
if (empty($user->rights->fournisseur->lire)) accessforbidden();
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0);
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="s.nom";
if (! $sortorder) $sortorder="ASC";
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('pricesuppliercard','globalcard')); $hookmanager->initHooks(array('pricesuppliercard','globalcard'));
@ -589,13 +602,21 @@ if ($id > 0 || $ref)
print "\n</div>\n"; print "\n</div>\n";
print '<br>'; print '<br>';
if ($user->rights->fournisseur->lire) if ($user->rights->fournisseur->lire)
{ {
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
$param.='&ref='.urlencode($object->ref);
$product_fourn = new ProductFournisseur($db); $product_fourn = new ProductFournisseur($db);
$product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder); $product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, $limit, $offset);
$nbtotalofrecords = count($product_fourn_list); $product_fourn_list_all = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, 0, 0);
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($product_fourn_list), $nbtotalofrecords, 'title_accountancy.png'); $nbtotalofrecords = count($product_fourn_list_all);
$num = count($product_fourn_list);
if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++;
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1);
// Suppliers list title // Suppliers list title
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -606,7 +627,7 @@ if ($id > 0 || $ref)
$param="&id=".$object->id; $param="&id=".$object->id;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Suppliers",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Suppliers",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("SupplierRef"); print_liste_field_titre("SupplierRef",$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder);
if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability",$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder); if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability",$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("VATRate",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("VATRate",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);

View File

@ -783,14 +783,14 @@ elseif ($object->id > 0)
// Opportunity probability // Opportunity probability
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>'; print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?price($object->opp_percent,0,$langs,1,0):'')).'"> %'; print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?vatrate($object->opp_percent):'')).'"> %';
print '<span id="oldopppercent"></span>'; print '<span id="oldopppercent"></span>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Opportunity amount // Opportunity amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>'; print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
print '<td><input size="5" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount,0,$langs,1,0):'')).'"></td>'; print '<td><input size="5" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price2num($object->opp_amount):'')).'"></td>';
print '</tr>'; print '</tr>';
} }

View File

@ -301,7 +301,7 @@ $listofreferent=array(
'class'=>'CommandeFournisseur', 'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur', 'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande', 'datefieldname'=>'date_commande',
'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&socid='.$socid, 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
'lang'=>'suppliers', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierOrder', 'buttonnew'=>'AddSupplierOrder',
'testnew'=>$user->rights->fournisseur->commande->creer, 'testnew'=>$user->rights->fournisseur->commande->creer,
@ -313,7 +313,7 @@ $listofreferent=array(
'margin'=>'minus', 'margin'=>'minus',
'table'=>'facture_fourn', 'table'=>'facture_fourn',
'datefieldname'=>'datef', 'datefieldname'=>'datef',
'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
'lang'=>'suppliers', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierInvoice', 'buttonnew'=>'AddSupplierInvoice',
'testnew'=>$user->rights->fournisseur->facture->creer, 'testnew'=>$user->rights->fournisseur->facture->creer,

View File

@ -520,6 +520,7 @@ if (empty($reshook))
} }
} }
// Customer categories association // Customer categories association
$custcats = GETPOST( 'custcats', 'array' ); $custcats = GETPOST( 'custcats', 'array' );
$object->setCategories($custcats, 'customer'); $object->setCategories($custcats, 'customer');
@ -634,15 +635,16 @@ if (empty($reshook))
{ {
$error = $object->error; $errors = $object->errors; $error = $object->error; $errors = $object->errors;
} }
// Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined)
if(!empty($user->rights->categorie->lire)){
// Customer categories association
$categories = GETPOST( 'custcats', 'array' );
$object->setCategories($categories, 'customer');
// Customer categories association // Supplier categories association
$categories = GETPOST( 'custcats', 'array' ); $categories = GETPOST('suppcats', 'array');
$object->setCategories($categories, 'customer'); $object->setCategories($categories, 'supplier');
}
// Supplier categories association
$categories = GETPOST('suppcats', 'array');
$object->setCategories($categories, 'supplier');
// Logo/Photo save // Logo/Photo save
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);

View File

@ -1051,16 +1051,16 @@ class Societe extends CommonObject
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid';
if ($rowid) $sql .= ' WHERE s.rowid = '.$rowid; if ($rowid) $sql .= ' WHERE s.rowid = '.$rowid;
else if ($ref) $sql .= " WHERE s.nom = '".$this->db->escape($ref)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($ref) $sql .= " WHERE s.nom = '".$this->db->escape($ref)."' AND s.entity IN (".getEntity($this->element).")";
else if ($ref_ext) $sql .= " WHERE s.ref_ext = '".$this->db->escape($ref_ext)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($ref_ext) $sql .= " WHERE s.ref_ext = '".$this->db->escape($ref_ext)."' AND s.entity IN (".getEntity($this->element).")";
else if ($ref_int) $sql .= " WHERE s.ref_int = '".$this->db->escape($ref_int)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($ref_int) $sql .= " WHERE s.ref_int = '".$this->db->escape($ref_int)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof1) $sql .= " WHERE s.siren = '".$this->db->escape($idprof1)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof1) $sql .= " WHERE s.siren = '".$this->db->escape($idprof1)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof2) $sql .= " WHERE s.siret = '".$this->db->escape($idprof2)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof2) $sql .= " WHERE s.siret = '".$this->db->escape($idprof2)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element).")";
else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element).")";
else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element).")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -1919,7 +1919,7 @@ class Societe extends CommonObject
if (! empty($this->code_fournisseur) && $this->fournisseur) if (! empty($this->code_fournisseur) && $this->fournisseur)
$label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur; $label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur;
if (! empty($conf->accounting->enabled) && $this->client) if (! empty($conf->accounting->enabled) && $this->client)
$label.= '<br><b>' . $langs->trans('CustomerAccountancyCode') . ':</b> '. $this->code_compta_client; $label.= '<br><b>' . $langs->trans('CustomerAccountancyCode') . ':</b> '. $this->code_compta;
if (! empty($conf->accounting->enabled) && $this->fournisseur) if (! empty($conf->accounting->enabled) && $this->fournisseur)
$label.= '<br><b>' . $langs->trans('SupplierAccountancyCode') . ':</b> '. $this->code_compta_fournisseur; $label.= '<br><b>' . $langs->trans('SupplierAccountancyCode') . ':</b> '. $this->code_compta_fournisseur;

View File

@ -7,6 +7,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Josep Lluis Amador <joseplluis@lliuretic.cat> * Copyright (C) 2016 Josep Lluis Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -963,6 +964,7 @@ while ($i < min($num, $limit))
$companystatic->id=$obj->rowid; $companystatic->id=$obj->rowid;
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->name_alias=$obj->name_alias;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
$companystatic->client=$obj->client; $companystatic->client=$obj->client;
$companystatic->status=$obj->status; $companystatic->status=$obj->status;
@ -978,14 +980,16 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
$savalias = $obj->name_alias;
if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias='';
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax200">';
print $companystatic->getNomUrl(1,'',100); print $companystatic->getNomUrl(1,'',100);
print "</td>\n"; print "</td>\n";
$companystatic->name_alias = $savalias;
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['s.name_alias']['checked'])) if (! empty($arrayfields['s.name_alias']['checked']))
{ {
$companystatic->name_alias=$obj->name_alias; // Added after the getNomUrl
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax200">';
print $companystatic->name_alias; print $companystatic->name_alias;
print "</td>\n"; print "</td>\n";