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')); $hookmanager->callHooks(array('invoicecard'));
/******************************************************************************/ /*
/* Actions */ * Actions
/******************************************************************************/ */
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $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); $object->fetch($id);
$result=$object->mode_reglement($_POST['mode_reglement_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') if ($action == 'setinvoicedate')
@ -248,7 +248,7 @@ if ($action == 'setinvoicedate')
$object->date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']); $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; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date;
$result=$object->update($user); $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') if ($action == 'setpaymentterm')
@ -256,14 +256,14 @@ if ($action == 'setpaymentterm')
$object->fetch($id); $object->fetch($id);
$date_lim_reglement=dol_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']); $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); $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') if ($action == 'setconditions')
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->cond_reglement($_POST['cond_reglement_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) if ($action == 'setremisepercent' && $user->rights->facture->creer)

View File

@ -97,14 +97,14 @@ class Form
* @param string $preselected Preselected value for parameter * @param string $preselected Preselected value for parameter
* @param string $paramkey Key of parameter (unique if there is several parameter to show) * @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 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 * @param string $editvalue Use this value instead $preselected
* @return string HTML edit field * @return string HTML edit field
* TODO no GET or POST in class file, use a param * TODO no GET or POST in class file, use a param
*/ */
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='') function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='')
{ {
global $langs; global $langs,$db;
$ret=''; $ret='';
if (GETPOST('action') == 'edit'.$htmlname) if (GETPOST('action') == 'edit'.$htmlname)
{ {
@ -123,14 +123,20 @@ class Form
{ {
$ret.='<textarea name="'.$htmlname.'">'.($editvalue?$editvalue:$preselected).'</textarea>'; $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>';
$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.='</tr></table>'."\n";
$ret.='</form>'."\n"; $ret.='</form>'."\n";
} }
else else
{ {
if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1); 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; else $ret.=$preselected;
} }
return $ret; return $ret;

View File

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

View File

@ -57,10 +57,10 @@ class FactureFournisseur extends Facture
var $author; var $author;
var $libelle; var $libelle;
var $datec; var $datec; // Creation date
var $tms; var $tms; // Last update date
var $date; var $date; // Invoice date
var $date_echeance; var $date_echeance; // Max payment date
var $amount; var $amount;
var $remise; var $remise;
var $tva; var $tva;
@ -184,17 +184,18 @@ class FactureFournisseur extends Facture
{ {
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$this->updateline($idligne, $this->updateline(
$this->lines[$i]->description, $idligne,
$this->lines[$i]->pu_ht, $this->lines[$i]->description,
$this->lines[$i]->tva_tx, $this->lines[$i]->pu_ht,
$this->lines[$i]->localtax1_tx, $this->lines[$i]->tva_tx,
$this->lines[$i]->localtax2_tx, $this->lines[$i]->localtax1_tx,
$this->lines[$i]->qty, $this->lines[$i]->localtax2_tx,
$this->lines[$i]->fk_product, $this->lines[$i]->qty,
'HT', $this->lines[$i]->fk_product,
$this->lines[$i]->info_bits, 'HT',
$this->lines[$i]->product_type $this->lines[$i]->info_bits,
$this->lines[$i]->product_type
); );
} }
} }
@ -246,10 +247,12 @@ class FactureFournisseur extends Facture
/** /**
* Load object in memory from database * 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; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -287,7 +290,9 @@ class FactureFournisseur extends Facture
$sql.= " t.import_key,"; $sql.= " t.import_key,";
$sql.= ' s.nom as socnom, s.rowid as socid'; $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.= ' 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); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -369,8 +374,9 @@ class FactureFournisseur extends Facture
/** /**
* \brief Load this->lines * Load this->lines
* \return int 1 si ok, < 0 si erreur *
* @return int 1 si ok, < 0 si erreur
*/ */
function fetch_lines() function fetch_lines()
{ {
@ -433,10 +439,11 @@ class FactureFournisseur extends Facture
/** /**
* \brief Update database * Update database
* \param user User that modify *
* \param notrigger 0=launch triggers after, 1=disable triggers * @param User $user User that modify
* \return int <0 if KO, >0 if OK * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function update($user=0, $notrigger=0) 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.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").",";
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : '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.= " 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.= " libelle=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").","; $sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
$sql.= " amount=".(isset($this->amount)?$this->amount:"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 * \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) function facturefourn_prepare_head($object)
{ {
global $langs, $conf; global $langs, $conf;
@ -29,7 +36,7 @@ function facturefourn_prepare_head($object)
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id; $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'; $head[$h][2] = 'card';
$h++; $h++;

View File

@ -18,10 +18,16 @@
/** /**
* \file htdocs/lib/invoice.lib.php * \file htdocs/lib/invoice.lib.php
* \brief Ensemble de fonctions de base pour le module factures * \brief Functions used by invoice module
* \ingroup invoice * \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) function facture_prepare_head($object)
{ {
global $langs, $conf; global $langs, $conf;