Works on module hook integration
This commit is contained in:
parent
ec23d17743
commit
530e321a3e
@ -1288,7 +1288,7 @@ class CommonObject
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/addpredefinedproductform.tpl.php');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1300,7 +1300,7 @@ class CommonObject
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/addfreeproductform.tpl.php');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1400,152 +1400,20 @@ class CommonObject
|
||||
if (! empty($line->date_end)) $type=1;
|
||||
|
||||
// Ligne en mode visu
|
||||
// TODO simplifier les templates
|
||||
if ($_GET['action'] != 'editline' || $_GET['lineid'] != $line->id)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Produit
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
$product_static = new Product($db);
|
||||
|
||||
print '<td>';
|
||||
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne;
|
||||
|
||||
// Show product and description
|
||||
$product_static->type=$line->fk_product_type;
|
||||
$product_static->id=$line->fk_product;
|
||||
$product_static->ref=$line->ref;
|
||||
$product_static->libelle=$line->product_label;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$line->product_label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($line->date_start, $line->date_end);
|
||||
|
||||
// Add description in form
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$line->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
if (($line->info_bits & 2) == 2)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
|
||||
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
|
||||
print '</a>';
|
||||
if ($line->description)
|
||||
{
|
||||
if ($line->description == '(CREDIT_NOTE)')
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' - '.nl2br($line->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($line->description);
|
||||
// Show range
|
||||
print_date_range($line->date_start,$line->date_end);
|
||||
}
|
||||
print "</td>\n";
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_view.tpl.php');
|
||||
}
|
||||
|
||||
// VAT Rate
|
||||
print '<td align="right" nowrap="nowrap">'.vatrate($line->tva_tx,'%',$line->info_bits).'</td>';
|
||||
|
||||
// U.P HT
|
||||
print '<td align="right" nowrap="nowrap">'.price($line->subprice)."</td>\n";
|
||||
|
||||
// Qty
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ((($line->info_bits & 2) != 2) && $line->special_code != 3)
|
||||
{
|
||||
print $line->qty;
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Remise percent (negative or positive)
|
||||
if (!empty($line->remise_percent) && $line->special_code != 3)
|
||||
{
|
||||
print '<td align="right">'.dol_print_reduction($line->remise_percent,$langs)."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Montant total HT
|
||||
if ($line->special_code == 3)
|
||||
{
|
||||
// Si ligne en option
|
||||
print '<td align="right" nowrap="nowrap">'.$langs->trans('Option').'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" nowrap="nowrap">'.price($line->total_ht)."</td>\n";
|
||||
}
|
||||
|
||||
// Icone d'edition et suppression
|
||||
if ($this->statut == 0 && $user->rights->$element->creer)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (($line->info_bits & 2) == 2)
|
||||
{
|
||||
// Ligne remise predefinie, on permet pas modif
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
if ($num > 1)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($i > 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">';
|
||||
print img_up();
|
||||
print '</a>';
|
||||
}
|
||||
if ($i < $num-1)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">';
|
||||
print img_down();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="3"> </td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Ligne en mode update
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE addfreeproductform.tpl.php -->
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||
|
||||
<?php
|
||||
// TODO à déplacer
|
||||
@ -82,4 +82,4 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE addfreeproductform.tpl.php -->
|
||||
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||
26
htdocs/core/tpl/freeproductline_edit.tpl.php
Normal file
26
htdocs/core/tpl/freeproductline_edit.tpl.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
|
||||
|
||||
|
||||
<!-- END PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
105
htdocs/core/tpl/freeproductline_view.tpl.php
Normal file
105
htdocs/core/tpl/freeproductline_view.tpl.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td><a name="<?php echo $line->rowid; ?>"></a>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||
<?php echo img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); ?>
|
||||
</a>
|
||||
<?php if ($line->description) {
|
||||
if ($line->description == '(CREDIT_NOTE)') {
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
} else {
|
||||
echo ' - '.nl2br($line->description);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
echo $text.' '.nl2br($line->description);
|
||||
// Show range
|
||||
print_date_range($line->date_start,$line->date_end);
|
||||
} ?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||
else echo ' '; ?>
|
||||
</td>
|
||||
|
||||
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
|
||||
<td align="right"><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo $langs->trans('Option'); ?></td>
|
||||
<?php } else { ?>
|
||||
<td align="right" nowrap="nowrap"><?php price($line->total_ht); ?></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
||||
<td align="center">
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id; ?>">
|
||||
<?php echo img_delete(); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<?php if ($num > 1) { ?>
|
||||
<td align="center">
|
||||
<?php if ($i > 0) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php echo img_up(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($i < $num-1) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php echo img_down(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- END PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE addpredefinedproductform.tpl.php -->
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||
|
||||
<?php
|
||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||
@ -88,4 +88,4 @@ $colspan = 'colspan="3"';
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE addpredefinedproductform.tpl.php -->
|
||||
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||
26
htdocs/core/tpl/predefinedproductline_edit.tpl.php
Normal file
26
htdocs/core/tpl/predefinedproductline_edit.tpl.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
|
||||
|
||||
|
||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
106
htdocs/core/tpl/predefinedproductline_view.tpl.php
Normal file
106
htdocs/core/tpl/predefinedproductline_view.tpl.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td>
|
||||
<a name="<?php echo $line->id; ?>"></a>
|
||||
<?php
|
||||
// Show product and description
|
||||
$product_static->type=$line->fk_product_type;
|
||||
$product_static->id=$line->fk_product;
|
||||
$product_static->ref=$line->ref;
|
||||
$product_static->libelle=$line->product_label;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$line->product_label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||
echo $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($line->date_start, $line->date_end);
|
||||
|
||||
// Add description in form
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||
else echo ' '; ?>
|
||||
</td>
|
||||
|
||||
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
|
||||
<td align="right"><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo $langs->trans('Option'); ?></td>
|
||||
<?php } else { ?>
|
||||
<td align="right" nowrap="nowrap"><?php price($line->total_ht); ?></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
||||
<td align="center">
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id; ?>">
|
||||
<?php echo img_delete(); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<?php if ($num > 1) { ?>
|
||||
<td align="center">
|
||||
<?php if ($i > 0) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php echo img_up(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($i < $num-1) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php echo img_down(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
Loading…
Reference in New Issue
Block a user