Fix: remove duplicate code

This commit is contained in:
Regis Houssin 2018-06-20 10:59:46 +02:00
parent ebfd1846a3
commit 5b491a4d57
8 changed files with 18 additions and 68 deletions

View File

@ -123,20 +123,6 @@ class ActionsCardProduct
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object);
@ -180,10 +166,13 @@ class ActionsCardProduct
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]);
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->object->status);
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$this->object->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
// Finished
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
@ -208,10 +197,6 @@ class ActionsCardProduct
if ($action == 'view')
{
// Status
$this->tpl['status'] = $this->object->getLibStatut(2,0);
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
// Photo
$this->tpl['nblignes'] = 4;
if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity]))

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -65,7 +65,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<?php if (! empty($conf->stock->enabled)) { ?>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -65,7 +65,7 @@ dol_htmloutput_errors($object->error,$object->errors);
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<?php if (! empty($conf->stock->enabled)) { ?>

View File

@ -63,16 +63,6 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
<td><?php echo $object->status; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $object->status_buy; ?></td>
</tr>
<tr>
<td class="tdtop"><?php echo $langs->trans("Description"); ?></td>
<td colspan="2"><?php echo $object->description; ?></td>

View File

@ -122,20 +122,6 @@ class ActionsCardService
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object);
@ -182,10 +168,13 @@ class ActionsCardService
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]);
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->object->status);
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$this->object->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
// Duration unit
// TODO creer fonction
@ -203,10 +192,6 @@ class ActionsCardService
if ($action == 'view')
{
// Status
$this->tpl['status'] = $this->object->getLibStatut(2,0);
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
// Photo
$this->tpl['nblignes'] = 4;
if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity]))

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -62,7 +62,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<tr><td><?php echo $langs->trans("Duration"); ?></td>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -62,7 +62,7 @@ dol_htmloutput_errors($object->error,$object->errors);
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<tr><td><?php echo $langs->trans("Duration"); ?></td>

View File

@ -63,16 +63,6 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
<td><?php echo $object->status; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $object->status_buy; ?></td>
</tr>
<tr>
<td class="tdtop"><?php echo $langs->trans("Description"); ?></td>
<td colspan="2"><?php echo $object->description; ?></td>