Qual: Uniformize look of supplier invoice with customer invoice

This commit is contained in:
eldy 2011-10-01 21:55:40 +02:00
parent 4d4be413af
commit 79546fa072
7 changed files with 962 additions and 1026 deletions

View File

@ -79,9 +79,9 @@ $hookmanager=new HookManager($db);
$hookmanager->callHooks(array('invoicecard'));
/******************************************************************************/
/* Actions */
/******************************************************************************/
/*
* Actions
*/
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -239,7 +239,7 @@ if ($action == 'setmode')
{
$object->fetch($id);
$result=$object->mode_reglement($_POST['mode_reglement_id']);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error($db,$object->error);
}
if ($action == 'setinvoicedate')
@ -248,7 +248,7 @@ if ($action == 'setinvoicedate')
$object->date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']);
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date;
$result=$object->update($user);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error($db,$object->error);
}
if ($action == 'setpaymentterm')
@ -256,14 +256,14 @@ if ($action == 'setpaymentterm')
$object->fetch($id);
$date_lim_reglement=dol_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']);
$result=$object->cond_reglement($object->cond_reglement_id,$date_lim_reglement);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error($db,$object->error);
}
if ($action == 'setconditions')
{
$object->fetch($id);
$result=$object->cond_reglement($_POST['cond_reglement_id']);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error($db,$object->error);
}
if ($action == 'setremisepercent' && $user->rights->facture->creer)

View File

@ -97,14 +97,14 @@ class Form
* @param string $preselected Preselected value for parameter
* @param string $paramkey Key of parameter (unique if there is several parameter to show)
* @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'text', ...)
* @param string $typeofdata Type of data ('string' by default, 'email', 'text', 'day', ...)
* @param string $editvalue Use this value instead $preselected
* @return string HTML edit field
* TODO no GET or POST in class file, use a param
*/
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='')
{
global $langs;
global $langs,$db;
$ret='';
if (GETPOST('action') == 'edit'.$htmlname)
{
@ -123,14 +123,20 @@ class Form
{
$ret.='<textarea name="'.$htmlname.'">'.($editvalue?$editvalue:$preselected).'</textarea>';
}
else if ($typeofdata == 'day')
{
$html=new Form($db);
$ret.=$html->form_date($_SERVER['PHP_SELF'].($paramkey?'?'.$paramkey.'='.$paramvalue:''),$preselected,$htmlname);
}
$ret.='</td>';
$ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
if ($typeofdata != 'day') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
$ret.='</tr></table>'."\n";
$ret.='</form>'."\n";
}
else
{
if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1);
if ($typeofdata == 'day') $ret.=dol_print_date($preselected,'day');
else $ret.=$preselected;
}
return $ret;
@ -238,7 +244,7 @@ class Form
/**
* Return combo list of activated countries, into language of user
*
*
* @param selected Id or Code or Label of preselected country
* @param htmlname Name of html select object
* @param htmloption Options html on select object
@ -250,7 +256,7 @@ class Form
/**
* Return combo list of activated countries, into language of user
*
*
* @param selected Id or Code or Label of preselected country
* @param htmlname Name of html select object
* @param htmloption Options html on select object
@ -320,7 +326,7 @@ class Form
/**
* Retourne la liste des types de comptes financiers
*
*
* @param selected Type pre-selectionne
* @param htmlname Nom champ formulaire
*/
@ -356,7 +362,7 @@ class Form
/**
* Return list of social contributions.
* Use mysoc->pays_id or mysoc->pays_code so they must be defined.
*
*
* @param selected Preselected type
* @param htmlname Name of field in form
* @param useempty Set to 1 if we want an empty value
@ -426,7 +432,7 @@ class Form
/**
* Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module)
*
*
* @param selected Preselected type
* @param htmlname Name of field in html form
* @param showempty Add an empty field
@ -517,7 +523,7 @@ class Form
/**
* Output html form to select a third party
*
*
* @param selected Preselected type
* @param htmlname Name of field in form
* @param filter Optionnal filters criteras
@ -532,7 +538,7 @@ class Form
/**
* Output html form to select a third party
*
*
* @param selected Preselected type
* @param htmlname Name of field in form
* @param filter Optionnal filters criteras
@ -608,7 +614,7 @@ class Form
/**
* Return HTML combo list of absolute discounts
*
*
* @param selected Id remise fixe pre-selectionnee
* @param htmlname Nom champ formulaire
* @param filter Criteres optionnels de filtre
@ -674,7 +680,7 @@ class Form
/**
* Return list of all contacts (for a third party or all)
*
*
* @param socid Id ot third party or 0 for all
* @param selected Id contact pre-selectionne
* @param htmlname Name of HTML field ('none' for a not editable field)
@ -900,7 +906,7 @@ class Form
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_do
*
*
* @param selected Preselected products
* @param htmlname Name of HTML seletc field (must be unique in page)
* @param filtertype Filter on product type (''=nofilter, 0=product, 1=service)
@ -1425,7 +1431,7 @@ class Form
/**
* Return list of delivery address
*
*
* @param string $selected Id contact pre-selectionn
* @param int $socid Id of company
* @param string $htmlname Name of HTML field
@ -1477,7 +1483,7 @@ class Form
/**
* Charge dans cache la liste des conditions de paiements possibles
*
*
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko
*/
function load_cache_conditions_paiements()
@ -1516,7 +1522,7 @@ class Form
/**
* Charge dans cache la liste des délais de livraison possibles
*
*
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko
*/
function load_cache_availability()
@ -1555,7 +1561,7 @@ class Form
/**
* Retourne la liste des types de delais de livraison possibles
*
*
* @param selected Id du type de delais pre-selectionne
* @param htmlname Nom de la zone select
* @param filtertype To add a filter
@ -1588,7 +1594,7 @@ class Form
/**
* Load into cache cache_demand_reason, array of input reasons
*
*
* @return int Nb of lines loaded, 0 if already loaded, <0 if ko
*/
function load_cache_demand_reason()
@ -1632,7 +1638,7 @@ class Form
/**
* Return list of events that triggered an object creation
*
*
* @param selected Id du type d'origine pre-selectionne
* @param htmlname Nom de la zone select
* @param exclude To exclude a code value (Example: SRC_PROP)
@ -1667,7 +1673,7 @@ class Form
/**
* Charge dans cache la liste des types de paiements possibles
*
*
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko
*/
function load_cache_types_paiements()

View File

@ -432,7 +432,7 @@ class FormFile
if ($allowgenifempty && ! is_array($modellist) && empty($modellist) && $modulepart != 'unpaid')
{
$langs->load("errors");
$out.= ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));
$out.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
}
$out.= '</td>';

View File

@ -57,10 +57,10 @@ class FactureFournisseur extends Facture
var $author;
var $libelle;
var $datec;
var $tms;
var $date;
var $date_echeance;
var $datec; // Creation date
var $tms; // Last update date
var $date; // Invoice date
var $date_echeance; // Max payment date
var $amount;
var $remise;
var $tva;
@ -184,17 +184,18 @@ class FactureFournisseur extends Facture
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$this->updateline($idligne,
$this->lines[$i]->description,
$this->lines[$i]->pu_ht,
$this->lines[$i]->tva_tx,
$this->lines[$i]->localtax1_tx,
$this->lines[$i]->localtax2_tx,
$this->lines[$i]->qty,
$this->lines[$i]->fk_product,
'HT',
$this->lines[$i]->info_bits,
$this->lines[$i]->product_type
$this->updateline(
$idligne,
$this->lines[$i]->description,
$this->lines[$i]->pu_ht,
$this->lines[$i]->tva_tx,
$this->lines[$i]->localtax1_tx,
$this->lines[$i]->localtax2_tx,
$this->lines[$i]->qty,
$this->lines[$i]->fk_product,
'HT',
$this->lines[$i]->info_bits,
$this->lines[$i]->product_type
);
}
}
@ -246,10 +247,12 @@ class FactureFournisseur extends Facture
/**
* Load object in memory from database
* @param id id object
* @return int <0 if KO, >0 if OK
*
* @param int $id Id supplier invoice
* @param string $ref Ref supplier invoice
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
function fetch($id='',$ref='')
{
global $langs;
$sql = "SELECT";
@ -287,7 +290,9 @@ class FactureFournisseur extends Facture
$sql.= " t.import_key,";
$sql.= ' s.nom as socnom, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE t.rowid='.$id.' AND t.fk_soc = s.rowid';
if ($id) $sql.= " WHERE t.rowid=".$id;
if ($ref) $sql.= " WHERE t.rowid='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref)
$sql.= ' AND t.fk_soc = s.rowid';
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
@ -369,8 +374,9 @@ class FactureFournisseur extends Facture
/**
* \brief Load this->lines
* \return int 1 si ok, < 0 si erreur
* Load this->lines
*
* @return int 1 si ok, < 0 si erreur
*/
function fetch_lines()
{
@ -433,10 +439,11 @@ class FactureFournisseur extends Facture
/**
* \brief Update database
* \param user User that modify
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, >0 if OK
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=0, $notrigger=0)
{
@ -486,7 +493,7 @@ class FactureFournisseur extends Facture
$sql.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").",";
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
$sql.= " datef=".(dol_strlen($this->date)!=0 ? "'".$this->db->idate($this->date)."'" : 'null').",";
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
if (dol_strlen($this->tms) != 0) $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql.= " libelle=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,16 @@
/**
* \file htdocs/lib/fourn.lib.php
* \brief Ensemble de fonctions de base pour le module fournisseur
* \brief Functions used by supplier invoice module
* \ingroup supplier
*/
/**
* Initialize the array of tabs for supplier invoice
*
* @param Facture $object Invoice object
* @return array Array of head tabs
*/
function facturefourn_prepare_head($object)
{
global $langs, $conf;
@ -29,7 +36,7 @@ function facturefourn_prepare_head($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id;
$head[$h][1] = $langs->trans('Card');
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'card';
$h++;

View File

@ -18,10 +18,16 @@
/**
* \file htdocs/lib/invoice.lib.php
* \brief Ensemble de fonctions de base pour le module factures
* \brief Functions used by invoice module
* \ingroup invoice
*/
/**
* Initialize the array of tabs for customer invoice
*
* @param Facture $object Invoice object
* @return array Array of head tabs
*/
function facture_prepare_head($object)
{
global $langs, $conf;