2
0
forked from Wavyzz/dolibarr

Fix: product lines with parent line better works

Fix: add trigger LINEPROPAL_DELETE
This commit is contained in:
Regis Houssin
2011-04-07 10:18:41 +00:00
parent a85c726100
commit 914e4a4bf1
6 changed files with 40 additions and 10 deletions

View File

@@ -542,9 +542,9 @@ class Propal extends CommonObject
{ {
if ($this->statut == 0) if ($this->statut == 0)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$lineid; $line=new PropaleLigne($this->db);
if ($this->db->query($sql) ) if ($line->delete($lineid))
{ {
$this->update_price(); $this->update_price();
@@ -2453,8 +2453,31 @@ class PropaleLigne
return -1; return -1;
} }
} }
/**
* Delete line in database
* @return int <0 si ko, >0 si ok
*/
function delete($rowid)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$rowid;
if ($this->db->query($sql) )
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEPROPAL_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
else
{
return -1;
}
}
/** /**
* \brief Mise a jour de l'objet ligne de propale en base * \brief Mise a jour de l'objet ligne de propale en base
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok

View File

@@ -146,14 +146,16 @@ class Form
* @param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres * @param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
* @param img Code img du picto (use img_xxx() function to get it) * @param img Code img du picto (use img_xxx() function to get it)
* @param extracss Add a CSS style to td tags * @param extracss Add a CSS style to td tags
* @param notable Do not include table and tr tags * @param notabs Do not include table and tr tags
* @param incbefore Include code before the text
* @return string Code html du tooltip (texte+picto) * @return string Code html du tooltip (texte+picto)
* @see Use function textwithpicto if you can. * @see Use function textwithpicto if you can.
*/ */
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$extracss='',$notabs=0) function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$extracss='',$notabs=0,$incbefore='')
{ {
global $conf; global $conf;
if ($incbefore) $text = $incbefore.$text;
if (! $htmltext) return $text; if (! $htmltext) return $text;
$paramfortooltip =''; $paramfortooltip ='';

View File

@@ -41,6 +41,7 @@
} }
} }
} else { } else {
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
echo $text.' '.nl2br($line->description); echo $text.' '.nl2br($line->description);

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-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
* 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
@@ -25,7 +25,7 @@
<td> <td>
<a name="<?php echo $line->id; ?>"></a> <a name="<?php echo $line->id; ?>"></a>
<?php <?php
echo $html->textwithtooltip($text,$description,3,'','',$i); echo $html->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
// Show range // Show range
print_date_range($line->date_start, $line->date_end); print_date_range($line->date_start, $line->date_end);

View File

@@ -281,6 +281,10 @@ class InterfaceDemo
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }
elseif ($action == 'LINEPROPAL_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEPROPAL_DELETE') elseif ($action == 'LINEPROPAL_DELETE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B