diff --git a/htdocs/comm/propal/class/actions_proposal.class.php b/htdocs/comm/propal/class/actions_proposal.class.php
index 061b14c6a38..ed7ac2fff55 100644
--- a/htdocs/comm/propal/class/actions_proposal.class.php
+++ b/htdocs/comm/propal/class/actions_proposal.class.php
@@ -17,7 +17,7 @@
*/
/**
- * \file htdocs/comm/propal/actions_proposal.class.php
+ * \file htdocs/comm/propal/class/actions_proposal.class.php
* \ingroup proposal
* \brief Fichier de la classe des actions des propales
* \version $Id$
@@ -43,6 +43,18 @@ class ActionsProposal extends ActionsCommonObject
{
$this->db = $DB;
}
+
+ /**
+ * \brief Load a proposal from database and its ligne array
+ * \param rowid id of object to load
+ * \param ref Ref of proposal
+ * \return int >0 if OK, <0 if KO
+ */
+ function fetch($rowid,$ref='')
+ {
+ $this->object = new Propal($this->db);
+ return $this->object->fetch($rowid,$ref);
+ }
}
diff --git a/htdocs/commande/class/actions_customerorder.class.php b/htdocs/commande/class/actions_customerorder.class.php
new file mode 100644
index 00000000000..82bcdd9014c
--- /dev/null
+++ b/htdocs/commande/class/actions_customerorder.class.php
@@ -0,0 +1,61 @@
+
+ *
+ * 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/commande/class/actions_proposal.class.php
+ * \ingroup order
+ * \brief Fichier de la classe des actions des commandes clients
+ * \version $Id$
+ */
+
+require_once(DOL_DOCUMENT_ROOT ."/core/class/actions_commonobject.class.php");
+require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
+
+/**
+ * \class ActionsCustomerorder
+ * \brief Classe permettant la gestion des actions des commandes clients
+ */
+class ActionsCustomerorder extends ActionsCommonObject
+{
+ var $db;
+ var $object;
+
+ /**
+ * Constructeur de la classe
+ * @param DB Handler acces base de donnees
+ */
+ function ActionsCustomerorder($DB)
+ {
+ $this->db = $DB;
+ }
+
+ /**
+ * Get object and lines from database
+ * @param id Id of object to load
+ * @param ref Ref of object
+ * @return int >0 if OK, <0 if KO
+ */
+ function fetch($rowid,$ref='')
+ {
+ $this->object = new Commande($this->db);
+ return $this->object->fetch($rowid,$ref);
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 0156f2e56a4..7f89b5fcc8d 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1387,24 +1387,24 @@ if ($_GET['action'] == 'create')
else if (in_array($element,array('order','commande','propal','contrat','contract')))
{
// For compatibility
- if ($element == 'order') { $element = $subelement = 'commande'; }
- if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
+ if ($element == 'order') { $element = 'commande'; $subelement = 'customerorder'; }
+ if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'proposal'; }
if ($element == 'contract') { $element = $subelement = 'contrat'; }
- require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
- $classname = ucfirst($subelement);
+ require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/actions_'.$subelement.'.class.php');
+ $classname = 'Actions'.ucfirst($subelement);
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
- $objectsrc->fetch_thirdparty();
+ $objectsrc->object->fetch_thirdparty();
- $projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
- $ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
+ $projectid = (!empty($objectsrc->object->fk_project)?$object->fk_project:'');
+ $ref_client = (!empty($objectsrc->object->ref_client)?$object->ref_client:'');
- $soc = $objectsrc->client;
- $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
- $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
- $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
- $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
+ $soc = $objectsrc->object->client;
+ $cond_reglement_id = (!empty($objectsrc->object->cond_reglement_id)?$objectsrc->object->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
+ $mode_reglement_id = (!empty($objectsrc->object->mode_reglement_id)?$objectsrc->object->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
+ $remise_percent = (!empty($objectsrc->object->remise_percent)?$objectsrc->object->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
+ $remise_absolue = (!empty($objectsrc->object->remise_absolue)?$objectsrc->object->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
}
}
@@ -1656,7 +1656,7 @@ if ($_GET['action'] == 'create')
print '';
@@ -1669,7 +1669,7 @@ if ($_GET['action'] == 'create')
print '';
}
@@ -1680,35 +1680,35 @@ if ($_GET['action'] == 'create')
if ($_GET['origin'] == 'contrat')
{
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
- $objectsrc->remise_absolue=$remise_absolue;
- $objectsrc->remise_percent=$remise_percent;
- $objectsrc->update_price();
+ $objectsrc->object->remise_absolue=$remise_absolue;
+ $objectsrc->object->remise_percent=$remise_percent;
+ $objectsrc->object->update_price();
}
print "\n";
print "\n";
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print '';
- print '';
+ print ''."\n";
+ print ''."\n";
+ print ''."\n";
+ print '';
+ print '';
- print '
'.$langs->trans($classname).'
'.$objectsrc->getNomUrl(1).'
';
- print '
'.$langs->trans('TotalHT').'
'.price($objectsrc->total_ht).'
';
- print '
'.$langs->trans('TotalVAT').'
'.price($objectsrc->total_tva)."
";
+ print '
'.$langs->trans($classname).'
'.$objectsrc->object->getNomUrl(1).'
';
+ print '
'.$langs->trans('TotalHT').'
'.price($objectsrc->object->total_ht).'
';
+ print '
'.$langs->trans('TotalVAT').'
'.price($objectsrc->object->total_tva)."
";
if ($mysoc->pays_code=='ES')
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
- print '
';
+ /*
$title=$langs->trans('ProductsAndServices');
$sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
@@ -1789,7 +1798,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_propal = '.$objectsrc->id;
+ $sql.= ' WHERE pt.fk_propal = '.$objectsrc->object->id;
$sql.= ' ORDER BY pt.rang ASC, pt.rowid';
}
// TODO deplacer dans la classe
@@ -1803,7 +1812,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_commande = '.$objectsrc->id;
+ $sql.= ' WHERE pt.fk_commande = '.$objectsrc->object->id;
$sql.= ' ORDER BY pt.rowid ASC';
}
// TODO deplacer dans la classe
@@ -1818,7 +1827,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'contratdet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_contrat = '.$objectsrc->id;
+ $sql.= ' WHERE pt.fk_contrat = '.$objectsrc->object->id;
$sql.= ' ORDER BY pt.rowid ASC';
}
@@ -1924,7 +1933,7 @@ if ($_GET['action'] == 'create')
dol_print_error($db);
}
- print '';
+ print '';*/
}
}
diff --git a/htdocs/core/class/actions_commonobject.class.php b/htdocs/core/class/actions_commonobject.class.php
index c991d49ff1e..746522886f1 100644
--- a/htdocs/core/class/actions_commonobject.class.php
+++ b/htdocs/core/class/actions_commonobject.class.php
@@ -45,6 +45,129 @@ class ActionsCommonObject
$this->db = $DB;
}
+ /**
+ * Return HTML table with origin title list
+ */
+ function printOriginTitleList()
+ {
+ global $langs;
+
+ print '
';
+ print '
'.$langs->trans('Ref').'
';
+ print '
'.$langs->trans('Description').'
';
+ print '
'.$langs->trans('VAT').'
';
+ print '
'.$langs->trans('PriceUHT').'
';
+ print '
'.$langs->trans('Qty').'
';
+ print '
'.$langs->trans('ReductionShort').'
';
+ }
+
+ /**
+ * Return HTML with list of origin lines
+ */
+ function printOriginLinesList($object)
+ {
+ $num = count($this->object->lines);
+ $var = true;
+ $i = 0;
+
+ foreach ($this->object->lines as $line)
+ {
+ $var=!$var;
+
+ if ($line->product_type == 9 && ! empty($line->special_code))
+ {
+ $object->hooks[$line->special_code]->printObjectLine($object,$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 '
';
+ }
+
}
?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 3aff8931803..6ef95e5b1f3 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1504,115 +1504,6 @@ class CommonObject
}
}
- /**
- * Return HTML with list of origin lines
- * TODO Move this into page (into a lib.php file if mutualized. No code for output must be present into a business class).
- */
- 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
- * TODO Move this into page (into a lib.php file if mutualized. No code for output must be present into a business class).
- * @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 '