Merge remote-tracking branch 'origin/3.4' into develop

Conflicts:
	.travis.yml
	htdocs/fourn/facture/index.php
This commit is contained in:
Laurent Destailleur 2013-09-09 20:00:12 +02:00
commit 1b526b7aa5
8 changed files with 378 additions and 130 deletions

View File

@ -121,6 +121,9 @@ Fix: Mailing module : if an email is already in destinaires list all other email
Fix: Localtaxes balance not showing
Fix: Intervention box links to contracts id
Fix: Compatiblity with multicompany module
Fix: Edit propal line was losing product supplier price id
Fix: Delete linked element to supplier invoice when deleted
Qual: Add travis-ci integration
***** ChangeLog for 3.4 compared to 3.3.* *****
For users:
@ -178,6 +181,7 @@ For users:
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
- Fix: [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
- Fix: Expedition creation, can retreive product from other expedition
For translators:
- Update language files.

File diff suppressed because one or more lines are too long

View File

@ -2999,7 +2999,7 @@ class PropaleLigne extends CommonObject
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_parent_line)) $this->fk_fournprice=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0;

View File

@ -224,6 +224,7 @@ class Expedition extends CommonObject
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -323,6 +324,7 @@ class Expedition extends CommonObject
$sql.= ", ".$qty;
$sql.= ")";
dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;

View File

@ -87,6 +87,8 @@ if ($id > 0 || ! empty($ref))
if ($action == 'add')
{
$error=0;
$object = new Expedition($db);
$db->begin();

View File

@ -656,6 +656,13 @@ class FactureFournisseur extends CommonInvoice
// Fin appel triggers
}
if (! $error)
{
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
}
if (! $error)
{
// We remove directory

View File

@ -313,27 +313,24 @@ function getInvoice($authentication,$id='',$ref='',$ref_ext='')
'invoice'=>array(
'id' => $invoice->id,
'ref' => $invoice->ref,
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
'type' => $invoice->type,
'total_net' => $invoice->total_ht,
'total_vat' => $invoice->total_tva,
'total' => $invoice->total_ttc,
'note_private' => $invoice->note_private?$invoice->note_private:'',
'note_public' => $invoice->note_public?$invoice->note_public:'',
'status'=> $invoice->statut,
'close_code' => $invoice->close_code?$invoice->close_code:'',
'close_note' => $invoice->close_note?$invoice->close_note:'',
'lines' => $linesresp
// 'lines' => array('0'=>array('id'=>222,'type'=>1),
// '1'=>array('id'=>333,'type'=>1))
));
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
'type' => $invoice->type,
'total_net' => $invoice->total_ht,
'total_vat' => $invoice->total_tva,
'total' => $invoice->total_ttc,
'note_private' => $invoice->note_private?$invoice->note_private:'',
'note_public' => $invoice->note_public?$invoice->note_public:'',
'status'=> $invoice->statut,
'close_code' => $invoice->close_code?$invoice->close_code:'',
'close_note' => $invoice->close_note?$invoice->close_note:'',
'lines' => $linesresp
));
}
else
{
@ -379,7 +376,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if ($fuser->societe_id) $socid=$fuser->societe_id;
// Check parameters
if (! $error && empty($idthirdparty))
{
@ -393,13 +390,9 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
$sql.='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
$sql.=' FROM '.MAIN_DB_PREFIX.'facture as f';
//$sql.=', '.MAIN_DB_PREFIX.'societe as s';
//$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
$sql.=" WHERE f.entity = ".$conf->entity;
if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
$resql=$db->query($sql);
if ($resql)
{
@ -414,55 +407,58 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
$invoice->fetch($obj->facid);
// Sécurité pour utilisateur externe
if( $socid && ( $socid != $order->socid) )
if( $socid && ( $socid != $invoice->socid) )
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request';
$errorcode='PERMISSION_DENIED'; $errorlabel=$invoice->socid.' User does not have permission for this request';
}
// Define lines of invoice
$linesresp=array();
foreach($invoice->lines as $line)
{
$linesresp[]=array(
'id'=>$line->rowid,
'type'=>$line->product_type,
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
);
}
// Now define invoice
$linesinvoice[]=array(
'id' => $invoice->id,
'ref' => $invoice->ref,
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
'date_due' => $invoice->date_lim_reglement?dol_print_date($invoice->date_lim_reglement,'dayrfc'):'',
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
'type' => $invoice->type,
'total_net' => $invoice->total_ht,
'total_vat' => $invoice->total_tva,
'total' => $invoice->total_ttc,
'note_private' => $invoice->note_private?$invoice->note_private:'',
'note_public' => $invoice->note_public?$invoice->note_public:'',
'status'=> $invoice->statut,
'close_code' => $invoice->close_code?$invoice->close_code:'',
'close_note' => $invoice->close_note?$invoice->close_note:'',
'lines' => $linesresp
);
if(!$error)
{
// Define lines of invoice
$linesresp=array();
foreach($invoice->lines as $line)
{
$linesresp[]=array(
'id'=>$line->rowid,
'type'=>$line->product_type,
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
);
}
$i++;
// Now define invoice
$linesinvoice[]=array(
'id' => $invoice->id,
'ref' => $invoice->ref,
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
'date_due' => $invoice->date_lim_reglement?dol_print_date($invoice->date_lim_reglement,'dayrfc'):'',
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
'type' => $invoice->type,
'total_net' => $invoice->total_ht,
'total_vat' => $invoice->total_tva,
'total' => $invoice->total_ttc,
'note_private' => $invoice->note_private?$invoice->note_private:'',
'note_public' => $invoice->note_public?$invoice->note_public:'',
'status'=> $invoice->statut,
'close_code' => $invoice->close_code?$invoice->close_code:'',
'close_note' => $invoice->close_note?$invoice->close_note:'',
'lines' => $linesresp
);
}
$i++;
}
$objectresp=array(

View File

@ -129,11 +129,11 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$localproduct=new Product($this->savdb);
$localproduct=new Product($this->savdb);
$localproduct->fetch(0,'PIDRESS');
$product_id=$localproduct->id;
if ($product_id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); }
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
$localobject->lines=array();
@ -168,4 +168,4 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
$this->assertEquals($result,10.4);
}
}
?>
?>