Fix: compatibility with external module and hook
This commit is contained in:
parent
be7c268e8d
commit
2757038f1f
@ -750,7 +750,10 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
|
|||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc,
|
$pu_ttc,
|
||||||
$info_bits,
|
$info_bits,
|
||||||
$type
|
$type,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
$_POST['fk_parent_line']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -298,7 +298,7 @@ class Propal extends CommonObject
|
|||||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit)
|
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit)
|
||||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||||
*/
|
*/
|
||||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0)
|
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -385,6 +385,7 @@ class Propal extends CommonObject
|
|||||||
$this->line->total_ttc=$total_ttc;
|
$this->line->total_ttc=$total_ttc;
|
||||||
$this->line->product_type=$type;
|
$this->line->product_type=$type;
|
||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
|
|
||||||
// Mise en option de la ligne
|
// Mise en option de la ligne
|
||||||
//if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3;
|
//if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3;
|
||||||
@ -2345,6 +2346,7 @@ class PropaleLigne
|
|||||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||||
if (empty($this->info_bits)) $this->info_bits=0;
|
if (empty($this->info_bits)) $this->info_bits=0;
|
||||||
if (empty($this->special_code)) $this->special_code=0;
|
if (empty($this->special_code)) $this->special_code=0;
|
||||||
|
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->product_type < 0) return -1;
|
if ($this->product_type < 0) return -1;
|
||||||
@ -2353,11 +2355,12 @@ class PropaleLigne
|
|||||||
|
|
||||||
// Insert line into database
|
// Insert line into database
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
||||||
$sql.= ' (fk_propal, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
$sql.= ' (fk_propal, fk_parent_line, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
||||||
$sql.= ' subprice, remise_percent, ';
|
$sql.= ' subprice, remise_percent, ';
|
||||||
$sql.= ' info_bits, ';
|
$sql.= ' info_bits, ';
|
||||||
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, special_code, rang, marge_tx, marque_tx)';
|
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, special_code, rang, marge_tx, marque_tx)';
|
||||||
$sql.= " VALUES (".$this->fk_propal.",";
|
$sql.= " VALUES (".$this->fk_propal.",";
|
||||||
|
$sql.= " ".$this->fk_parent_line.",";
|
||||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||||
$sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
|
$sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
|
||||||
$sql.= " '".$this->product_type."',";
|
$sql.= " '".$this->product_type."',";
|
||||||
|
|||||||
@ -1325,7 +1325,7 @@ class CommonObject
|
|||||||
*/
|
*/
|
||||||
function showAddPredefinedProductForm($dateSelector,$seller,$buyer)
|
function showAddPredefinedProductForm($dateSelector,$seller,$buyer)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs,$object;
|
||||||
global $html,$bcnd,$var;
|
global $html,$bcnd,$var;
|
||||||
|
|
||||||
// Use global variables + $dateSelector + $seller and $buyer
|
// Use global variables + $dateSelector + $seller and $buyer
|
||||||
@ -1340,9 +1340,9 @@ class CommonObject
|
|||||||
*/
|
*/
|
||||||
function showAddFreeProductForm($dateSelector,$seller,$buyer)
|
function showAddFreeProductForm($dateSelector,$seller,$buyer)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs,$object;
|
||||||
global $html,$bcnd,$var;
|
global $html,$bcnd,$var;
|
||||||
|
|
||||||
// Use global variables + $dateSelector + $seller and $buyer
|
// Use global variables + $dateSelector + $seller and $buyer
|
||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,12 +28,8 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
<?php
|
|
||||||
// TODO à déplacer
|
|
||||||
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
|
||||||
?>
|
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td <?php echo $colspan; ?>><a name="add"></a><?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?></td>
|
<td><a name="add"></a><?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||||
@ -42,16 +38,22 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
<form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||||
<input type="hidden" name="action" value="addline">
|
<input type="hidden" name="action" value="addline" />
|
||||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>" />
|
||||||
|
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td <?php echo $colspan; ?>>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
||||||
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
|
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
|
||||||
|
|
||||||
|
if (! empty($object->hooks)) {
|
||||||
|
foreach($object->hooks as $module) {
|
||||||
|
$module->formAddProductOption($object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
|
|||||||
@ -28,15 +28,9 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
<?php
|
|
||||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
|
||||||
$colspan = 'colspan="4"';
|
|
||||||
else
|
|
||||||
$colspan = 'colspan="3"';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td <?php echo $colspan; ?>>
|
<td colspan="3">
|
||||||
<?php
|
<?php
|
||||||
echo $langs->trans("AddNewLine").' - ';
|
echo $langs->trans("AddNewLine").' - ';
|
||||||
if ($conf->service->enabled)
|
if ($conf->service->enabled)
|
||||||
@ -56,7 +50,7 @@ $colspan = 'colspan="3"';
|
|||||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||||
|
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td <?php echo $colspan; ?>>
|
<td colspan="3">
|
||||||
<?php
|
<?php
|
||||||
// multiprix
|
// multiprix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if($conf->global->PRODUIT_MULTIPRICES)
|
||||||
@ -65,6 +59,12 @@ $colspan = 'colspan="3"';
|
|||||||
$html->select_produits('','idprod','',$conf->product->limit_size);
|
$html->select_produits('','idprod','',$conf->product->limit_size);
|
||||||
|
|
||||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||||
|
|
||||||
|
if (! empty($object->hooks)) {
|
||||||
|
foreach($object->hooks as $module) {
|
||||||
|
$module->formAddProductOption($object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user