Fix: [ bug #252 ] Contrat : pas d'éditeur WYSIWYG
Fix: Margins information must be visible for orders, proposals and invoices only. Fix: Delete button for contracts not visible
This commit is contained in:
parent
a8012d0f18
commit
8436f0666d
@ -201,7 +201,18 @@ else if ($action == 'classin' && $user->rights->contrat->creer)
|
|||||||
|
|
||||||
else if ($action == 'addline' && $user->rights->contrat->creer)
|
else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
if (GETPOST('pqty') && ((GETPOST('pu') != '' && GETPOST('desc')) || GETPOST('idprod')))
|
if (! GETPOST('qty'))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if ((GETPOST('price_ht') == '' || ! GETPOST('dp_desc')) && ! GETPOST('idprod'))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")),'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($id);
|
$ret=$object->fetch($id);
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
@ -286,11 +297,11 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht=GETPOST('pu');
|
$pu_ht=GETPOST('price_ht');
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
||||||
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||||
$desc=GETPOST('desc');
|
$desc=GETPOST('dp_desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
|
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
|
||||||
@ -310,12 +321,12 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
|||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
GETPOST('pqty'),
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx,
|
$localtax1_tx,
|
||||||
$localtax2_tx,
|
$localtax2_tx,
|
||||||
GETPOST('idprod'),
|
GETPOST('idprod'),
|
||||||
GETPOST('premise'),
|
GETPOST('remise_percent'),
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end,
|
$date_end,
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
@ -343,6 +354,14 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
|||||||
contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs);
|
contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
unset($_POST['qty']);
|
||||||
|
unset($_POST['type']);
|
||||||
|
unset($_POST['idprod']);
|
||||||
|
unset($_POST['remise_percent']);
|
||||||
|
unset($_POST['price_ht']);
|
||||||
|
unset($_POST['tva_tx']);
|
||||||
|
unset($_POST['dp_desc']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -372,7 +391,7 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
|||||||
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
|
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
|
||||||
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
|
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
|
||||||
|
|
||||||
$objectline->description=GETPOST('eldesc');
|
$objectline->description=GETPOST('product_desc');
|
||||||
$objectline->price_ht=GETPOST('elprice');
|
$objectline->price_ht=GETPOST('elprice');
|
||||||
$objectline->subprice=GETPOST('elprice');
|
$objectline->subprice=GETPOST('elprice');
|
||||||
$objectline->qty=GETPOST('elqty');
|
$objectline->qty=GETPOST('elqty');
|
||||||
@ -898,7 +917,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td>".nl2br($objp->description)."</td>\n";
|
print "<td>".dol_htmlentitiesbr($objp->description)."</td>\n";
|
||||||
}
|
}
|
||||||
// TVA
|
// TVA
|
||||||
print '<td align="center">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
print '<td align="center">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
||||||
@ -997,7 +1016,16 @@ else
|
|||||||
{
|
{
|
||||||
print $objp->label?$objp->label.'<br>':'';
|
print $objp->label?$objp->label.'<br>':'';
|
||||||
}
|
}
|
||||||
print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>';
|
|
||||||
|
// editeur wysiwyg
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$nbrows=ROWS_2;
|
||||||
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
|
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||||
|
$doleditor=new DolEditor('product_desc',$objp->description,'',92,'dolibarr_details','',false,true,$enable,$nbrows,70);
|
||||||
|
$doleditor->Create();
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->thirdparty);
|
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->thirdparty);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1252,90 +1280,47 @@ else
|
|||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
/*
|
// Form to add new line
|
||||||
* Ajouter une ligne produit/service
|
|
||||||
*/
|
|
||||||
if ($user->rights->contrat->creer && ($object->statut >= 0))
|
if ($user->rights->contrat->creer && ($object->statut >= 0))
|
||||||
{
|
{
|
||||||
|
$dateSelector=1;
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
print '<table id="tablelines" class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
// Trick to not show product entries
|
||||||
print '<td>'.$langs->trans("Service").'</td>';
|
$savproductenabled=$conf->product->enabled;
|
||||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
$conf->product->enabled = 0;
|
||||||
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("ReductionShort").'</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var=false;
|
// Form to add new line
|
||||||
|
if ($action != 'editline')
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
|
||||||
// Service sur produit predefini
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||||
print '<form name="addline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
{
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
// Add free or predefined products/services
|
||||||
print '<input type="hidden" name="action" value="addline">';
|
$object->formAddObjectLine($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
|
||||||
print '<input type="hidden" name="mode" value="predefined">';
|
}
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
else
|
||||||
|
{
|
||||||
|
// Add free products/services
|
||||||
|
$object->formAddFreeProduct($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
// Add predefined products/services
|
||||||
print '<td colspan="3">';
|
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||||
// multiprix
|
{
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
$var=!$var;
|
||||||
$form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level);
|
$object->formAddPredefinedProduct($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
|
||||||
else
|
}
|
||||||
$form->select_produits('','idprod',1,$conf->product->limit_size);
|
}
|
||||||
print '<br>';
|
|
||||||
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
$parameters=array();
|
||||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->thirdparty->remise_client.'">%</td>';
|
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
}
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
// Restore correct setup
|
||||||
print '<td colspan="8">';
|
$conf->product->enabled = $savproductenabled;
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
|
||||||
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
|
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
|
||||||
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
// Service libre
|
|
||||||
print '<form name="addline_sl" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="addline">';
|
|
||||||
print '<input type="hidden" name="mode" value="libre">';
|
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
|
|
||||||
|
|
||||||
print '<td>';
|
|
||||||
print $form->load_tva("tva_tx",-1,$mysoc,$object->thirdparty);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>';
|
|
||||||
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
|
|
||||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->thirdparty->remise_client.'">%</td>';
|
|
||||||
print '<td align="center" rowspan="2" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
|
||||||
|
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="8">';
|
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
|
||||||
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
|
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
|
||||||
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
@ -1343,17 +1328,12 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//print '</td><td align="center" class="tab" style="padding: 4px; border-right: 1px solid #'.$colorb.'; border-top: 1px solid #'.$colorb.'; border-bottom: 1px solid #'.$colorb.';">';
|
|
||||||
|
|
||||||
//print '</td></tr></table>';
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*
|
||||||
* Boutons Actions
|
* Buttons
|
||||||
*************************************************************/
|
*/
|
||||||
|
|
||||||
if ($user->societe_id == 0)
|
if ($user->societe_id == 0)
|
||||||
{
|
{
|
||||||
@ -1391,6 +1371,10 @@ else
|
|||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -1410,5 +1394,6 @@ else
|
|||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -23,6 +23,10 @@
|
|||||||
* $this (invoice, order, ...)
|
* $this (invoice, order, ...)
|
||||||
* $line defined
|
* $line defined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$usemargins=0;
|
||||||
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
@ -37,23 +41,23 @@
|
|||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($usemargins))
|
||||||
|
{
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
$colspan++;
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
|
||||||
$colspan++;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||||
</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="mode" value="libre">
|
||||||
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||||
|
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||||
@ -92,40 +96,49 @@
|
|||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($usemargins))
|
||||||
?>
|
{
|
||||||
|
?>
|
||||||
<td align="right"><input type="text" size="5" name="buying_price"
|
<td align="right"><input type="text" size="5" name="buying_price"
|
||||||
value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
$colspan++;
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
|
||||||
$colspan++;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php if (! empty($conf->service->enabled) && $dateSelector) {
|
<?php
|
||||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->service->enabled) && $dateSelector)
|
||||||
$colspan = 10;
|
{
|
||||||
else
|
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
||||||
$colspan = 9;
|
else $colspan = 9;
|
||||||
if (! empty($conf->margin->enabled)) {
|
|
||||||
|
if (! empty($usemargins))
|
||||||
|
{
|
||||||
$colspan++; // For the buying price
|
$colspan++; // For the buying price
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
if($conf->global->DISPLAY_MARGIN_RATES) $colspan++;
|
||||||
$colspan++;
|
if($conf->global->DISPLAY_MARK_RATES) $colspan++;
|
||||||
if($conf->global->DISPLAY_MARK_RATES)
|
|
||||||
$colspan++;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td colspan="<?php echo $colspan; ?>"><?php
|
<td colspan="<?php echo $colspan; ?>"><?php
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
if (! empty($object->element) && $object->element == 'contrat')
|
||||||
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
{
|
||||||
echo ' '.$langs->trans('to').' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
|
||||||
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
|
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
|
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
||||||
|
echo ' '.$langs->trans('to').' ';
|
||||||
|
echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -24,6 +24,10 @@
|
|||||||
* $this (invoice, order, ...)
|
* $this (invoice, order, ...)
|
||||||
* $line defined
|
* $line defined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$usemargins=0;
|
||||||
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
@ -42,22 +46,23 @@
|
|||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
|
<form name="addpredefinedproduct" 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="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="mode" value="predefined">
|
||||||
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@ -72,7 +77,9 @@ jQuery(document).ready(function() {
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo '<span>';
|
echo '<span>';
|
||||||
$form->select_produits('','idprod','',$conf->product->limit_size,$buyer->price_level);
|
$filtertype='';
|
||||||
|
if (! empty($object->element) && $object->element == 'contrat') $filtertype='1';
|
||||||
|
$form->select_produits('','idprod',$filtertype,$conf->product->limit_size,$buyer->price_level);
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
@ -94,20 +101,20 @@ jQuery(document).ready(function() {
|
|||||||
</td>
|
</td>
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="1"></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 $buyer->remise_client; ?>">%</td>
|
<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||||
?>
|
?>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<select id="fournprice" name="fournprice" style="display: none;"></select>
|
<select id="fournprice" name="fournprice" style="display: none;"></select>
|
||||||
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
|
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
|
||||||
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline">
|
<input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline">
|
||||||
</td>
|
</td>
|
||||||
@ -118,7 +125,7 @@ if (! empty($conf->service->enabled) && $dateSelector)
|
|||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
||||||
else $colspan = 9;
|
else $colspan = 9;
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
$colspan++; // For the buying price
|
$colspan++; // For the buying price
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||||
@ -128,10 +135,20 @@ if (! empty($conf->service->enabled) && $dateSelector)
|
|||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td colspan="<?php echo $colspan; ?>">
|
<td colspan="<?php echo $colspan; ?>">
|
||||||
<?php
|
<?php
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
if (! empty($object->element) && $object->element == 'contrat')
|
||||||
echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
{
|
||||||
echo ' '.$langs->trans('to').' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
|
||||||
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
|
$form->select_date('',"date_end",$usehm,$usehm,1,"addline");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
|
echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
||||||
|
echo ' '.$langs->trans('to').' ';
|
||||||
|
echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -142,42 +159,42 @@ if (! empty($conf->service->enabled) && $dateSelector)
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#idprod").change(function() {
|
$("#idprod").change(function() {
|
||||||
$("#fournprice options").remove();
|
$("#fournprice options").remove();
|
||||||
$("#fournprice").hide();
|
$("#fournprice").hide();
|
||||||
$("#buying_price").val("").show();
|
$("#buying_price").val("").show();
|
||||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
var options = '';
|
var options = '';
|
||||||
var i = 0;
|
var i = 0;
|
||||||
$(data).each(function() {
|
$(data).each(function() {
|
||||||
i++;
|
i++;
|
||||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
options += ' selected';
|
options += ' selected';
|
||||||
$("#buying_price").val(this.price);
|
$("#buying_price").val(this.price);
|
||||||
}
|
}
|
||||||
options += '>'+this.label+'</option>';
|
options += '>'+this.label+'</option>';
|
||||||
});
|
});
|
||||||
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||||
$("#buying_price").hide();
|
$("#buying_price").hide();
|
||||||
$("#fournprice").html(options).show();
|
$("#fournprice").html(options).show();
|
||||||
$("#fournprice").change(function() {
|
$("#fournprice").change(function() {
|
||||||
var selval = $(this).find('option:selected').attr("price");
|
var selval = $(this).find('option:selected').attr("price");
|
||||||
if (selval)
|
if (selval)
|
||||||
$("#buying_price").val(selval).hide();
|
$("#buying_price").val(selval).hide();
|
||||||
else
|
else
|
||||||
$('#buying_price').show();
|
$('#buying_price').show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'json');
|
'json');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user