Works on templates implementation for mutualized code
This commit is contained in:
parent
398969f6bf
commit
9f0bde74b6
@ -1447,13 +1447,13 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$propal->showAddFreeProductForm($propal);
|
||||
$propal->showAddFreeProductForm();
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
$propal->showAddPredefinedProductForm($propal);
|
||||
$propal->showAddPredefinedProductForm();
|
||||
}
|
||||
|
||||
// Add hook of other modules
|
||||
|
||||
@ -1936,143 +1936,15 @@ else
|
||||
*/
|
||||
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] <> 'editline')
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
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>';
|
||||
|
||||
// Add free products/services form
|
||||
print '<form action="fiche.php?id='.$commande->id.'#add" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
|
||||
$var=true;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
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($soc->tva_assuj == "0")
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
else
|
||||
print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="pu" size="5"></td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';
|
||||
print '<td align="right" nowrap="nowrap"><input type="text" name="remise_percent" size="1" value="'.$soc->remise_client.'">%</td>';
|
||||
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
// Start and end dates selector
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
print $html->select_date('','date_start',$usehm,$usehm,1,"addline");
|
||||
print ' '.$langs->trans('to').' ';
|
||||
print $html->select_date('','date_end',$usehm,$usehm,1,"addline");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
// Ajout de produits/services predefinis
|
||||
|
||||
$commande->showAddFreeProductForm(1);
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
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 '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'#add" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="action" value="addline">';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="3">';
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
$html->select_produits('','idprod','',$conf->product->limit_size,$soc->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="nowrap"><input type="text" size="1" name="remise_percent" value="'.$soc->remise_client.'">%</td>';
|
||||
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
// Start and end dates selector
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
print $html->select_date('','date_start_prod',$usehm,$usehm,1,"addline");
|
||||
print ' '.$langs->trans('to').' ';
|
||||
print $html->select_date('','date_end_prod',$usehm,$usehm,1,"addline");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</form>';
|
||||
$commande->showAddPredefinedProductForm(1);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -1153,7 +1153,7 @@ class CommonObject
|
||||
/**
|
||||
* Show add free products/services form
|
||||
*/
|
||||
function showAddFreeProductForm($object)
|
||||
function showAddFreeProductForm($dateSelector=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
@ -1164,7 +1164,7 @@ class CommonObject
|
||||
/**
|
||||
* Show add predefined products/services form
|
||||
*/
|
||||
function showAddPredefinedProductForm($object)
|
||||
function showAddPredefinedProductForm($dateSelector=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html,$bc,$var;
|
||||
|
||||
@ -35,10 +35,10 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>#add" method="POST">
|
||||
<form 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="action" value="addline">
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td <?php echo $colspan; ?>>
|
||||
@ -76,6 +76,19 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector) {?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td colspan="9">
|
||||
<?php
|
||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
echo $html->select_date('','date_start',$usehm,$usehm,1,"addline");
|
||||
echo ' '.$langs->trans('to').' ';
|
||||
echo $html->select_date('','date_end',$usehm,$usehm,1,"addline");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -43,10 +43,10 @@ $colspan = 'colspan="3"';
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
|
||||
<form id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>#add" method="POST">
|
||||
<form id="addpredefinedproduct" 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="action" value="addline">
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td <?php echo $colspan; ?>>
|
||||
@ -80,6 +80,19 @@ $colspan = 'colspan="3"';
|
||||
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector) {?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td colspan="9">
|
||||
<?php
|
||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
echo $html->select_date('','date_start',$usehm,$usehm,1,"addline");
|
||||
echo ' '.$langs->trans('to').' ';
|
||||
echo $html->select_date('','date_end',$usehm,$usehm,1,"addline");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user