Skip to content
Snippets Groups Projects
Commit e371d6a0 authored by Regis Houssin's avatar Regis Houssin
Browse files

Works on best mutualized code

Works on MVC
parent 8b4a8347
Branches
Tags
No related merge requests found
<?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.
*/
/**
* \file htdocs/comm/propal/actions_proposal.class.php
* \ingroup proposal
* \brief Fichier de la classe des actions des propales
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/actions_commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php');
/**
* \class ActionsProposal
* \brief Classe permettant la gestion des actions des propales
*/
class ActionsProposal extends ActionsCommonObject
{
var $db;
var $object;
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function ActionsProposal($DB)
{
$this->db = $DB;
}
}
?>
\ No newline at end of file
...@@ -1024,7 +1024,8 @@ class Propal extends CommonObject ...@@ -1024,7 +1024,8 @@ class Propal extends CommonObject
$line->fk_product = $objp->fk_product; $line->fk_product = $objp->fk_product;
$line->libelle = $objp->label; // Label produit $line->libelle = $objp->label; // TODO deprecated
$line->label = $objp->label; // Label produit
$line->product_desc = $objp->product_desc; // Description produit $line->product_desc = $objp->product_desc; // Description produit
$line->ref = $objp->ref; $line->ref = $objp->ref;
......
...@@ -1780,6 +1780,8 @@ if ($_GET['action'] == 'create') ...@@ -1780,6 +1780,8 @@ if ($_GET['action'] == 'create')
// TODO deplacer dans la classe // TODO deplacer dans la classe
if ($_GET['origin'] == 'propal') if ($_GET['origin'] == 'propal')
{ {
//$objectsrc->printOriginLinesList();
$title=$langs->trans('ProductsAndServices'); $title=$langs->trans('ProductsAndServices');
$sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,'; $sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
......
<?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.
*/
/**
* \file htdocs/core/class/actions_commonobject.class.php
* \ingroup core
* \brief Fichier de la classe mere des classes metiers (facture, contrat, propal, commande, etc...)
* \version $Id$
*/
/**
* \class ActionsCommonObject
* \brief Classe mere pour heritage des classes metiers
*/
class ActionsCommonObject
{
var $db;
// Instantiate hook classe of thirdparty module
var $hooks=array();
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function AnctionsCommonObject($DB)
{
$this->db = $DB;
}
}
?>
...@@ -1502,6 +1502,113 @@ class CommonObject ...@@ -1502,6 +1502,113 @@ class CommonObject
} }
} }
/**
* Return HTML with list of origin lines
*/
function printOriginLinesList()
{
$num = count($this->lines);
$var = true;
$i = 0;
foreach ($this->lines as $line)
{
$var=!$var;
if ($line->product_type == 9 && ! empty($line->special_code))
{
//$this->hooks[$line->special_code]->printObjectLine($this,$line,$num,$i);
}
else
{
$this->printOriginLine($line,$var);
}
$i++;
}
}
/**
* Return HTML with origin line
* @param element Element type
* @param id Element id
*/
function printOriginLine($line,$var)
{
global $langs,$bc;
$var=!$var;
$date_start=$line->date_debut_prevue;
if ($line->date_debut_reel) $date_start=$line->date_debut_reel;
$date_end=$line->date_fin_prevue;
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
print '<tr '.$bc[$var].'><td>';
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>';
}
else if ($line->fk_product)
{
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">';
print ($line->fk_product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product'));
print ' '.$line->ref.'</a>';
print $line->label?' - '.$line->label:'';
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
else
{
print ($line->product_type == -1 ? '&nbsp;' : ($line->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')));
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
print "</td>\n";
print '<td>';
if ($line->desc)
{
if ($line->desc == '(CREDIT_NOTE)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($line->desc == '(DEPOSIT)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
print $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
print dol_trunc($line->desc,60);
}
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="right">'.vatrate($line->tva_tx).'%</td>';
print '<td align="right">'.price($line->subprice).'</td>';
print '<td align="right">';
print (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
print '</td>';
print '<td align="right">';
print (($line->info_bits & 2) != 2) ? $line->remise_percent.'%' : '&nbsp;';
print '</td>';
print '</tr>';
}
} }
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment