Works on templates implementation for mutualized code
This commit is contained in:
parent
21d266f93e
commit
398969f6bf
@ -1447,135 +1447,20 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
if ($conf->milestone->enabled)
|
||||
{
|
||||
formAddMilestone($propal);
|
||||
$propal->showAddFreeProductForm($propal);
|
||||
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td '.$colspan.'>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").'</td>';
|
||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Add free products/services form
|
||||
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'?id='.$propal->id.'#add" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
print '<input type="hidden" name="id" value="'.$propal->id.'">';
|
||||
|
||||
print '<tr '.$bc[$var].">\n";
|
||||
print '<td '.$colspan.'>';
|
||||
|
||||
print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
||||
if ($conf->product->enabled && $conf->service->enabled) print '<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('dp_desc',$_POST["dp_desc"],100,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
print '<textarea class="flat" cols="70" name="dp_desc" rows="'.$nbrows.'">'.$_POST["dp_desc"].'</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
if ($societe->tva_assuj == "0")
|
||||
print '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||
else
|
||||
$html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
|
||||
print "</td>\n";
|
||||
print '<td align="right"><input type="text" size="5" name="np_price"></td>';
|
||||
print '<td align="right"><input type="text" size="2" name="qty" value="'.(isset($_POST["qty"])?$_POST["qty"]:1).'"></td>';
|
||||
print '<td align="right" nowrap><input type="text" size="1" value="'.$societe->remise_client.'" name="remise_percent">%</td>';
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
// Ajout de produits/services predefinis
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||
{
|
||||
$colspan = 'colspan="4"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan = 'colspan="3"';
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td '.$colspan.'>';
|
||||
print $langs->trans("AddNewLine").' - ';
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
print $langs->trans('RecordedProductsAndServices');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('RecordedProducts');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '</tr>';
|
||||
print "\n".'<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$propal->id.'#add" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
print '<input type="hidden" name="id" value="'.$propal->id.'">';
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td '.$colspan.'>';
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
$html->select_produits('','idprod','',$conf->product->limit_size,$societe->price_level);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_produits('','idprod','',$conf->product->limit_size);
|
||||
}
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('np_desc',$_POST["np_desc"],100,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
print '<textarea cols="70" name="np_desc" rows="'.$nbrows.'" class="flat">'.$_POST["np_desc"].'</textarea>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" size="2" name="qty" value="1"></td>';
|
||||
print '<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="'.$societe->remise_client.'">%</td>';
|
||||
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans("Add").'" name="addline">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</form>';
|
||||
$propal->showAddPredefinedProductForm($propal);
|
||||
}
|
||||
|
||||
// Add hook of other modules
|
||||
if ($conf->milestone->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
formAddMilestone($propal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -1149,9 +1149,34 @@ class CommonObject
|
||||
print $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show add free products/services form
|
||||
*/
|
||||
function showAddFreeProductForm($object)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/addfreeproductform.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show add predefined products/services form
|
||||
*/
|
||||
function showAddPredefinedProductForm($object)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/addpredefinedproductform.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Show linked object block
|
||||
* @param $object
|
||||
* @param $objectid
|
||||
* @param $somethingshown
|
||||
*/
|
||||
function showLinkedObjectBlock($object,$objectid,$somethingshown=0)
|
||||
{
|
||||
|
||||
81
htdocs/core/tpl/addfreeproductform.tpl.php
Normal file
81
htdocs/core/tpl/addfreeproductform.tpl.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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 -->
|
||||
|
||||
<?php
|
||||
// TODO à déplacer
|
||||
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
?>
|
||||
|
||||
<tr class="liste_titre">
|
||||
<td <?php echo $colspan; ?>><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('PriceUHT'); ?></td>
|
||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>#add" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="addline">
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>">
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td <?php echo $colspan; ?>>
|
||||
<?php
|
||||
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
||||
if ($conf->product->enabled && $conf->service->enabled) echo '<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('dp_desc',$_POST["dp_desc"],100,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
echo '<textarea class="flat" cols="70" name="dp_desc" rows="'.$nbrows.'">'.$_POST["dp_desc"].'</textarea>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right">
|
||||
<?php
|
||||
if ($societe->tva_assuj == "0")
|
||||
echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||
else
|
||||
$html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
|
||||
?>
|
||||
</td>
|
||||
<td align="right"><input type="text" size="5" name="np_price"></td>
|
||||
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $societe->remise_client; ?>" name="remise_percent">%</td>
|
||||
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
85
htdocs/core/tpl/addpredefinedproductform.tpl.php
Normal file
85
htdocs/core/tpl/addpredefinedproductform.tpl.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?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 -->
|
||||
|
||||
<?php
|
||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||
$colspan = 'colspan="4"';
|
||||
else
|
||||
$colspan = 'colspan="3"';
|
||||
?>
|
||||
|
||||
<tr class="liste_titre">
|
||||
<td <?php echo $colspan; ?>>
|
||||
<?php
|
||||
echo $langs->trans("AddNewLine").' - ';
|
||||
if ($conf->service->enabled)
|
||||
echo $langs->trans('RecordedProductsAndServices');
|
||||
else
|
||||
echo $langs->trans('RecordedProducts');
|
||||
?>
|
||||
</td>
|
||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
|
||||
<form id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>#add" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="addline">
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>">
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td <?php echo $colspan; ?>>
|
||||
<?php
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES)
|
||||
$html->select_produits('','idprod','',$conf->product->limit_size,$societe->price_level);
|
||||
else
|
||||
$html->select_produits('','idprod','',$conf->product->limit_size);
|
||||
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('np_desc',$_POST["np_desc"],100,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
echo '<textarea cols="70" name="np_desc" rows="'.$nbrows.'" class="flat">'.$_POST["np_desc"].'</textarea>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td align="right"><input type="text" size="2" name="qty" value="1"></td>
|
||||
<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $societe->remise_client; ?>">%</td>
|
||||
|
||||
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"></td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user