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

This commit is contained in:
Juanjo Menent 2016-12-10 14:50:40 +01:00
commit 198bef1bb5
6 changed files with 260 additions and 240 deletions

View File

@ -187,11 +187,11 @@ if ($action == 'writebookkeeping') {
// Fees // Fees
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
if ($accountingaccount->fetch(null, $k)) { if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -355,7 +355,7 @@ if ($action == 'export_csv') {
// Fees // Fees
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
@ -464,7 +464,7 @@ if (empty($action) || $action == 'view') {
// Fees // Fees
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print "<tr " . $bc[$var] . " >"; print "<tr " . $bc[$var] . " >";

View File

@ -219,11 +219,11 @@ if ($action == 'writebookkeeping') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
if ($accountingaccount->fetch(null, $k)) { if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -398,7 +398,7 @@ if ($action == 'export_csv') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
@ -518,7 +518,7 @@ if (empty($action) || $action == 'view') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print "<tr " . $bc[$var] . " >"; print "<tr " . $bc[$var] . " >";

View File

@ -243,7 +243,7 @@ if ($action == 'writebookkeeping') {
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
if ($accountingaccount->fetch(null, $k)) { if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -375,7 +375,7 @@ if ($action == 'export_csv') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount_static = new AccountingAccount($db); $accountingaccount_static = new AccountingAccount($db);
if ($accountingaccount_static->fetch(null, $k)) { if ($accountingaccount_static->fetch(null, $k, true)) {
print $date . $sep; print $date . $sep;
print $sell_journal . $sep; print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep; print length_accountg(html_entity_decode($k)) . $sep;
@ -429,7 +429,7 @@ if ($action == 'export_csv') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
@ -559,7 +559,7 @@ if (empty($action) || $action == 'view') {
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";

View File

@ -1070,17 +1070,17 @@ if (empty($reshook))
// Set project // Set project
else if ($action == 'classin' && $user->rights->propal->creer) { else if ($action == 'classin' && $user->rights->propal->creer) {
$object->setProject($_POST['projectid']); $object->setProject(GETPOST('projectid','int'));
} }
// Delai de livraison // Delai de livraison
else if ($action == 'setavailability' && $user->rights->propal->creer) { else if ($action == 'setavailability' && $user->rights->propal->creer) {
$result = $object->availability($_POST['availability_id']); $result = $object->set_availability($user, GETPOST('availability_id','int'));
} }
// Origine de la propale // Origine de la propale
else if ($action == 'setdemandreason' && $user->rights->propal->creer) { else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
$result = $object->demand_reason($_POST['demand_reason_id']); $result = $object->set_demand_reason($user, GETPOST('demand_reason_id','int'));
} }
// Conditions de reglement // Conditions de reglement
@ -1701,10 +1701,10 @@ if ($action == 'create')
// Proposal card // Proposal card
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
@ -1744,17 +1744,17 @@ if ($action == 'create')
} }
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
/* /*
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">'; print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
@ -1784,7 +1784,7 @@ if ($action == 'create')
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/ */
// Company // Company
/* /*
print '<tr><td>' . $langs->trans('Company') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>'; print '<tr><td>' . $langs->trans('Company') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
@ -2107,42 +2107,42 @@ if ($action == 'create')
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>'; print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>'; print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>'; print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
} }
// Amount HT // Amount HT
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
print '<td class="nowrap">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>'; print '<td class="nowrap">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
print '</tr>'; print '</tr>';
// Amount VAT // Amount VAT
print '<tr><td>' . $langs->trans('AmountVAT') . '</td>'; print '<tr><td>' . $langs->trans('AmountVAT') . '</td>';
print '<td class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>'; print '<td class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
print '</tr>'; print '</tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
{ {
@ -2156,27 +2156,27 @@ if ($action == 'create')
print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>'; print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
print '</tr>'; print '</tr>';
} }
// Amount TTC // Amount TTC
print '<tr><td>' . $langs->trans('AmountTTC') . '</td>'; print '<tr><td>' . $langs->trans('AmountTTC') . '</td>';
print '<td class="nowrap">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>'; print '<td class="nowrap">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
print '</tr>'; print '</tr>';
// Statut // Statut
//print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>'; //print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
print '</table>'; print '</table>';
// Margin Infos // Margin Infos
if (! empty($conf->margin->enabled)) if (! empty($conf->margin->enabled))
{ {
$formmargin->displayMarginInfos($object); $formmargin->displayMarginInfos($object);
} }
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
@ -2232,7 +2232,7 @@ if ($action == 'create')
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
dol_fiche_end(); dol_fiche_end();
@ -2391,7 +2391,7 @@ if ($action == 'create')
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -50,7 +50,7 @@ class Propal extends CommonObject
public $fk_element='fk_propal'; public $fk_element='fk_propal';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='propal'; public $picto='propal';
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -503,7 +503,7 @@ class Propal extends CommonObject
$this->line->label=$label; $this->line->label=$label;
$this->line->desc=$desc; $this->line->desc=$desc;
$this->line->qty=$qty; $this->line->qty=$qty;
$this->line->vat_src_code=$vat_src_code; $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva; $this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1; $this->line->localtax1_tx=$txlocaltax1;
@ -638,7 +638,7 @@ class Propal extends CommonObject
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
// Clean vat code // Clean vat code
$vat_src_code=''; $vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
@ -1180,7 +1180,7 @@ class Propal extends CommonObject
$clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj);
// Create clone // Create clone
$result=$clonedObj->create($user); $result=$clonedObj->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
else else
@ -1541,7 +1541,7 @@ class Propal extends CommonObject
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
return 0; return 0;
} }
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer)) if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate))))
{ {
@ -1551,7 +1551,7 @@ class Propal extends CommonObject
} }
$now=dol_now(); $now=dol_now();
$this->db->begin(); $this->db->begin();
// Numbering module definition // Numbering module definition
@ -1839,7 +1839,7 @@ class Propal extends CommonObject
*/ */
function set_availability($user, $id, $notrigger=0) function set_availability($user, $id, $notrigger=0)
{ {
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;
@ -1849,7 +1849,7 @@ class Propal extends CommonObject
$sql.= " SET fk_availability = '".$id."'"; $sql.= " SET fk_availability = '".$id."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (!$resql) if (!$resql)
{ {
@ -1861,6 +1861,7 @@ class Propal extends CommonObject
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
$this->fk_availability = $id; $this->fk_availability = $id;
$this->availability_id = $availability_id;
} }
if (! $notrigger && empty($error)) if (! $notrigger && empty($error))
@ -1887,6 +1888,14 @@ class Propal extends CommonObject
return -1*$error; return -1*$error;
} }
} }
else
{
$error_str='Propal status do not meet requirement '.$this->statut;
dol_syslog(__METHOD__.$error_str, LOG_ERR);
$this->error=$error_str;
$this->errors[]= $this->error;
return -2;
}
} }
/** /**
@ -1899,14 +1908,14 @@ class Propal extends CommonObject
*/ */
function set_demand_reason($user, $id, $notrigger=0) function set_demand_reason($user, $id, $notrigger=0)
{ {
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
$sql.= " SET fk_input_reason = '".$id."'"; $sql.= " SET fk_input_reason = ".$id;
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -1922,6 +1931,7 @@ class Propal extends CommonObject
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
$this->fk_input_reason = $id; $this->fk_input_reason = $id;
$this->demand_reason_id = $id;
} }
@ -1949,6 +1959,14 @@ class Propal extends CommonObject
return -1*$error; return -1*$error;
} }
} }
else
{
$error_str='Propal status do not meet requirement '.$this->statut;
dol_syslog(__METHOD__.$error_str, LOG_ERR);
$this->error=$error_str;
$this->errors[]= $this->error;
return -2;
}
} }
/** /**
@ -2406,7 +2424,7 @@ class Propal extends CommonObject
$this->statut = self::STATUS_DRAFT; $this->statut = self::STATUS_DRAFT;
$this->brouillon = 1; $this->brouillon = 1;
} }
if (! $notrigger && empty($error)) if (! $notrigger && empty($error))
{ {
// Call trigger // Call trigger
@ -2733,6 +2751,7 @@ class Propal extends CommonObject
* @param int $availability_id Id of new delivery time * @param int $availability_id Id of new delivery time
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @deprecated use set_availability
*/ */
function availability($availability_id, $notrigger=0) function availability($availability_id, $notrigger=0)
{ {
@ -2753,7 +2772,7 @@ class Propal extends CommonObject
$this->errors[]=$this->db->error(); $this->errors[]=$this->db->error();
$error++; $error++;
} }
if (! $error) if (! $error)
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
@ -2800,6 +2819,7 @@ class Propal extends CommonObject
* @param int $demand_reason_id Id of new source demand * @param int $demand_reason_id Id of new source demand
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
* @deprecated use set_demand_reason
*/ */
function demand_reason($demand_reason_id, $notrigger=0) function demand_reason($demand_reason_id, $notrigger=0)
{ {
@ -2820,7 +2840,7 @@ class Propal extends CommonObject
$this->errors[]=$this->db->error(); $this->errors[]=$this->db->error();
$error++; $error++;
} }
if (! $error) if (! $error)
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
@ -3241,7 +3261,7 @@ class Propal extends CommonObject
global $langs, $conf, $user; global $langs, $conf, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result=''; $result='';
$label=''; $label='';
$url=''; $url='';
@ -3272,7 +3292,7 @@ class Propal extends CommonObject
$url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params; $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params;
} }
} }
$linkclose=''; $linkclose='';
if (empty($notooltip) && $user->rights->propal->lire) if (empty($notooltip) && $user->rights->propal->lire)
{ {
@ -3284,9 +3304,9 @@ class Propal extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"'; $linkclose.=' class="classfortooltip"';
} }
$linkstart = '<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) if ($withpicto)
@ -3350,7 +3370,7 @@ class Propal extends CommonObject
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except; $this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
$this->lines[$i]->remise_percent = $obj->remise_percent; $this->lines[$i]->remise_percent = $obj->remise_percent;
$this->lines[$i]->vat_src_code = $obj->vat_src_code; $this->lines[$i]->vat_src_code = $obj->vat_src_code;
$this->lines[$i]->tva_tx = $obj->tva_tx; $this->lines[$i]->tva_tx = $obj->tva_tx;
$this->lines[$i]->info_bits = $obj->info_bits; $this->lines[$i]->info_bits = $obj->info_bits;
$this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_ht = $obj->total_ht;
@ -3684,7 +3704,7 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
// if buy price not defined, define buyprice as configured in margin admin // if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring) if ($this->pa_ht == 0 && $pa_ht_isemptystring)
{ {

File diff suppressed because it is too large Load Diff