Merge pull request #186 from grandoc/develop
to use specific tpl within his own theme
This commit is contained in:
commit
c962e515d5
@ -2,7 +2,8 @@
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.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
|
||||
@ -865,93 +866,93 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the payments methods
|
||||
*
|
||||
* @param int $id Id of new payment method
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentMethods($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_mode_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'mode_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
/**
|
||||
* Change the payments methods
|
||||
*
|
||||
* @param int $id Id of new payment method
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentMethods($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_mode_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'mode_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->mode_reglement_id = $id;
|
||||
$this->mode_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
$this->mode_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the payments terms
|
||||
*
|
||||
* @param int $id Id of new payment terms
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentTerms($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
/**
|
||||
* Change the payments terms
|
||||
*
|
||||
* @param int $id Id of new payment terms
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentTerms($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_cond_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'cond_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->cond_reglement_id = $id;
|
||||
$this->cond_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
$this->cond_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define delivery address
|
||||
*
|
||||
* @param int $id Address id
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function setDeliveryAddress($id)
|
||||
/**
|
||||
* Define delivery address
|
||||
*
|
||||
* @param int $id Address id
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function setDeliveryAddress($id)
|
||||
{
|
||||
$fieldname = 'fk_adresse_livraison';
|
||||
if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address';
|
||||
@ -962,14 +963,14 @@ abstract class CommonObject
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_delivery_address = $id;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this).'::setDeliveryAddress Erreur '.$sql.' - '.$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1851,18 +1852,18 @@ abstract class CommonObject
|
||||
$sql.= " WHERE rowid=".$elementId;
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
$this->statut = $status;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->statut = $status;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2145,35 +2146,35 @@ abstract class CommonObject
|
||||
return $nb;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set extra parameters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setExtraParameters()
|
||||
* @return void
|
||||
*/
|
||||
function setExtraParameters()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$extraparams = (! empty($this->extraparams) ? json_encode($this->extraparams) : null);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null");
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2378,7 +2379,14 @@ abstract class CommonObject
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_create.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_create.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2398,7 +2406,14 @@ abstract class CommonObject
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_create.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_create.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2537,12 +2552,26 @@ abstract class CommonObject
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||
|
||||
// Use global variables + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_view.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_view.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_view.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_view.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_view.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_view.tpl.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2552,12 +2581,26 @@ abstract class CommonObject
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_edit.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_edit.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/predefinedproductline_edit.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_edit.tpl.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_edit.tpl.php');
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_edit.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/freeproductline_edit.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_edit.tpl.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2696,8 +2739,15 @@ abstract class CommonObject
|
||||
$this->tpl['price'] = price($line->subprice);
|
||||
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' ';
|
||||
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
|
||||
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/originproductline.tpl.php');
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/originproductline.tpl.php"))
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/originproductline.tpl.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/originproductline.tpl.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user