Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.4' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
	htdocs/fourn/facture/index.php
  • Loading branch information
eldy committed Sep 9, 2013
2 parents f405255 + 7670ed5 commit 1b526b7
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 131 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
347 changes: 292 additions & 55 deletions dev/initdata/mysqldump_dolibarr_3.4.0.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion htdocs/comm/propal/class/propal.class.php
Expand Up @@ -2999,7 +2999,7 @@ function update($notrigger=0)
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;

Expand Down
2 changes: 2 additions & 0 deletions htdocs/expedition/class/expedition.class.php
Expand Up @@ -224,6 +224,7 @@ function create($user)
$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)
{
Expand Down Expand Up @@ -323,6 +324,7 @@ function create_line($entrepot_id, $origin_line_id, $qty)
$sql.= ", ".$qty;
$sql.= ")";

dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
Expand Down
2 changes: 2 additions & 0 deletions htdocs/expedition/fiche.php
Expand Up @@ -87,6 +87,8 @@
if ($action == 'add')
{
$error=0;

$object = new Expedition($db);

$db->begin();

Expand Down
7 changes: 7 additions & 0 deletions htdocs/fourn/class/fournisseur.facture.class.php
Expand Up @@ -656,6 +656,13 @@ function delete($rowid)
// Fin appel triggers
}

if (! $error)
{
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
}

if (! $error)
{
// We remove directory
Expand Down
140 changes: 68 additions & 72 deletions htdocs/webservices/server_invoice.php
Expand Up @@ -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
{
Expand Down Expand Up @@ -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))
{
Expand All @@ -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)
{
Expand All @@ -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';
}

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,
);
}

// 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
);
}

// 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
);

$i++;
$i++;
}

$objectresp=array(
Expand Down
6 changes: 3 additions & 3 deletions test/phpunit/PdfDocTest.php
Expand Up @@ -129,11 +129,11 @@ public function testPdfDocGetLineDesc()
$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();
Expand Down Expand Up @@ -168,4 +168,4 @@ public function testPdfGetHeightForLogo()
$this->assertEquals($result,10.4);
}
}
?>
?>

0 comments on commit 1b526b7

Please sign in to comment.