Merge branch '3.5' of git@github.com:Dolibarr/dolibarr.git into 3.5
This commit is contained in:
commit
f115501ddf
@ -41,6 +41,7 @@ Fix: [ bug #1240 ] traduction.
|
||||
Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation.
|
||||
Fix: [ bug #1280 ] service with not end of date was tagged as expired.
|
||||
Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference
|
||||
Fix: [ bug #1306 ] Fatal error when adding an external calendar
|
||||
New: Added es_CL language
|
||||
|
||||
***** ChangeLog for 3.5 compared to 3.4.* *****
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
@ -579,14 +579,21 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes')
|
||||
// Convertir en reduc
|
||||
else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$object->fetch_lines();
|
||||
|
||||
if (!empty($object->paye)) // protection against multiple submit
|
||||
// Check if there is already a discount (protection to avoid duplicate creation when resubmit post)
|
||||
$discountcheck=new DiscountAbsolute($db);
|
||||
$result=$discountcheck->fetch(0,$object->id);
|
||||
|
||||
$canconvert=0;
|
||||
if ($object->type == 3 && $object->paye == 1 && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed completely and not already converted (see real condition into condition used to show button converttoreduc)
|
||||
if ($object->type == 2 && $object->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
|
||||
if ($canconvert)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// Boucle sur chaque taux de tva
|
||||
$i=0;
|
||||
foreach($object->lines as $line)
|
||||
@ -1981,9 +1988,10 @@ if ($action == 'update_extras')
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
@ -2186,6 +2194,7 @@ if ($action == 'create')
|
||||
$options.='</option>';
|
||||
}
|
||||
|
||||
// Show link for credit note
|
||||
$facids=$facturestatic->list_qualified_avoir_invoices($soc->id);
|
||||
if ($facids < 0)
|
||||
{
|
||||
@ -3593,7 +3602,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == 0 || $object->type == 1) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
if ((($object->type == 0 || $object->type == 1)
|
||||
|| ($object->type == 2 && empty($discount->id))
|
||||
|| ($object->type == 3 && empty($discount->id)))
|
||||
&& ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
{
|
||||
@ -3680,23 +3692,32 @@ else if ($id > 0 || ! empty($ref))
|
||||
// For credit note only
|
||||
if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a></div>';
|
||||
if ($resteapayer == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPaymentBack').'</span></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// For credit note
|
||||
if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
|
||||
}
|
||||
// For deposit invoice
|
||||
if ($object->type == 3 && $object->statut == 2 && $resteapayer == 0 && $user->rights->facture->creer && empty($discount->id))
|
||||
if ($object->type == 3 && $object->paye == 1 && $resteapayer == 0 && $user->rights->facture->creer && empty($discount->id))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Classify paid (if not deposit and not credit note. Such invoice are "converted")
|
||||
if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement &&
|
||||
(($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0)) )
|
||||
// Classify paid
|
||||
if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && (($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0))
|
||||
|| ($object->type == 3 && $object->paye == 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
}
|
||||
|
||||
@ -201,6 +201,11 @@ class Conf
|
||||
//var_dump($this->modules);
|
||||
//var_dump($this->modules_parts['theme']);
|
||||
|
||||
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
|
||||
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
|
||||
//$this->global->MAIN_SERVER_TZ='Europe/Paris';
|
||||
if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') date_default_timezone_set($this->global->MAIN_SERVER_TZ);
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
|
||||
@ -987,9 +987,9 @@ function dol_getdate($timestamp,$fast=false)
|
||||
* @param int $month Month (1 to 12)
|
||||
* @param int $day Day (1 to 31)
|
||||
* @param int $year Year
|
||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||
* @param int $gm true or 1=Input informations are GMT values, false or 0 or 'server' = local to server TZ, 'user' = local to user TZ
|
||||
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
||||
* @return int Date as a timestamp, '' if error
|
||||
* @return int Date as a timestamp, '' if error
|
||||
* @see dol_print_date, dol_stringtotime, dol_getdate
|
||||
*/
|
||||
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
@ -1015,7 +1015,23 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
|
||||
if (method_exists('DateTime','getTimestamp') && empty($conf->global->MAIN_OLD_DATE))
|
||||
{
|
||||
if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get());
|
||||
if (empty($gm) || $gm === 'server')
|
||||
{
|
||||
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
|
||||
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
|
||||
if (! empty($conf->global->MAIN_SERVER_TZ))
|
||||
{
|
||||
if ($conf->global->MAIN_SERVER_TZ != 'auto') $default_timezone=$conf->global->MAIN_SERVER_TZ;
|
||||
else $default_timezone=@date_default_timezone_get();
|
||||
}
|
||||
else $default_timezone=@date_default_timezone_get();
|
||||
$localtz = new DateTimeZone($default_timezone);
|
||||
}
|
||||
else if ($gm === 'user')
|
||||
{
|
||||
$default_timezone=(empty($_SESSION["dol_tz_string"])?'UTC':$_SESSION["dol_tz_string"]);
|
||||
$localtz = new DateTimeZone($default_timezone);
|
||||
}
|
||||
else $localtz = new DateTimeZone('UTC');
|
||||
$dt = new DateTime(null,$localtz);
|
||||
$dt->setDate($year,$month,$day);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -109,7 +109,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - 16; // width of images
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxpicture-=20;
|
||||
@ -153,7 +153,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("orders");
|
||||
$outputlangs->load("deliveries");
|
||||
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
@ -228,6 +228,15 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -304,7 +313,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -400,6 +409,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
@ -583,20 +593,6 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy=$pdf->GetY()+1;
|
||||
}
|
||||
*/
|
||||
if (! empty($object->date_livraison))
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$text=$outputlangs->transnoentities("DeliveryDate").':';
|
||||
$pdf->MultiCell(80, 3, $text, 0, 'L', 0);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$text=dol_print_date($object->date_livraison,'day','',$outputlangs);
|
||||
$pdf->MultiCell(80, 3, $text, 0, 'L', 0);
|
||||
|
||||
$posy=$pdf->GetY()+1;
|
||||
}
|
||||
/* TODO
|
||||
else if (! empty($object->availability_code))
|
||||
{
|
||||
@ -609,7 +605,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$posy=$pdf->GetY()+1;
|
||||
}*/
|
||||
|
||||
// Show shipping date
|
||||
// Show planed date of delivery
|
||||
if ($object->date_livraison)
|
||||
{
|
||||
$outputlangs->load("sendings");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -109,7 +109,7 @@ class pdf_proforma extends ModelePDFCommandes
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - 16; // width of images
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxpicture-=20;
|
||||
@ -227,6 +227,15 @@ class pdf_proforma extends ModelePDFCommandes
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -303,7 +312,7 @@ class pdf_proforma extends ModelePDFCommandes
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -399,6 +408,7 @@ class pdf_proforma extends ModelePDFCommandes
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -267,6 +267,7 @@ class pdf_merou extends ModelePdfExpedition
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -264,6 +264,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -109,7 +109,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - 16; // width of images
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxpicture-=20;
|
||||
@ -228,6 +228,15 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -306,7 +315,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -378,7 +387,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
|
||||
|
||||
// Retrieve type from database for backward compatibility with old records
|
||||
if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
|
||||
&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
|
||||
@ -401,6 +410,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -250,7 +250,7 @@ class ImportCsv extends ModeleImports
|
||||
/**
|
||||
* Return array of next record in input file.
|
||||
*
|
||||
* @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string)
|
||||
* @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string)
|
||||
*/
|
||||
function import_read_record()
|
||||
{
|
||||
@ -383,7 +383,7 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
// Set $newval with value to insert and set $listvalues with sql request part for insert
|
||||
$newval='';
|
||||
if ($arrayrecord[($key-1)]['type'] > 0) $newval=$arrayrecord[($key-1)]['val']; // If type of field is not null or '' but string
|
||||
if ($arrayrecord[($key-1)]['type'] > 0) $newval=$arrayrecord[($key-1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
|
||||
|
||||
// Make some tests on $newval
|
||||
|
||||
@ -441,41 +441,46 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
if (empty($newval)) $newval='0';
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull')
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifauto')
|
||||
{
|
||||
if (empty($newval) || $newval=='auto')
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
$this->thirpartyobject->get_codeclient(0,0);
|
||||
$newval=$this->thirpartyobject->code_client;
|
||||
//print 'code_client='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull')
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifauto')
|
||||
{
|
||||
if (empty($newval) || $newval=='auto')
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
$newval=$this->thirpartyobject->get_codefournisseur(0,1);
|
||||
$newval=$this->thirpartyobject->code_fournisseur;
|
||||
//print 'code_fournisseur='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifauto')
|
||||
{
|
||||
if (empty($newval) || $newval=='auto')
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
$this->thirpartyobject->get_codecompta('customer');
|
||||
$newval=$this->thirpartyobject->code_compta;
|
||||
//print 'code_compta='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifauto')
|
||||
{
|
||||
if (empty($newval) || $newval=='auto')
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
$this->thirpartyobject->get_codecompta('supplier');
|
||||
$newval=$this->thirpartyobject->code_compta_fournisseur;
|
||||
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
|
||||
//print 'code_compta_fournisseur='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
|
||||
}
|
||||
|
||||
//print 'Val to use as insert is '.$newval.'<br>';
|
||||
@ -540,6 +545,7 @@ class ImportCsv extends ModeleImports
|
||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
||||
$listfields.=$fieldname;
|
||||
|
||||
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
|
||||
if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues.=($newval=='0'?$newval:"null");
|
||||
elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues.="''";
|
||||
else $listvalues.="'".$this->db->escape($newval)."'";
|
||||
@ -653,7 +659,7 @@ function cleansep($value)
|
||||
function tablewithentity($table)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$resql=$db->DDLDescTable($table,'entity');
|
||||
if ($resql)
|
||||
{
|
||||
@ -662,7 +668,7 @@ function tablewithentity($table)
|
||||
if ($obj) return 1;
|
||||
else return 0;
|
||||
}
|
||||
else return -1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2008 Chiptronik
|
||||
@ -223,15 +223,24 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
/*
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
*/
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -307,7 +316,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -370,6 +379,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -401,14 +401,14 @@ class modSociete extends DolibarrModules
|
||||
's.fk_typent'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ctypent.class.php','class'=>'Ctypent','method'=>'fetch','dict'=>'DictionnaryCompanyType'),
|
||||
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'),
|
||||
's.fk_stcomm'=>array('rule'=>'zeroifnull'),
|
||||
's.code_client'=>array('rule'=>'getcustomercodeifnull'),
|
||||
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifnull'),
|
||||
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifnull'),
|
||||
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifnull')
|
||||
's.code_client'=>array('rule'=>'getcustomercodeifauto'),
|
||||
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'),
|
||||
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'),
|
||||
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto')
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789');
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or empty or 'auto'",'s.code_fournisseur'=>"SU01-0001 or empty or 'auto'",'s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789');
|
||||
|
||||
// Import list of contact and attributes
|
||||
$r++;
|
||||
|
||||
@ -222,12 +222,15 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$pdf->MultiCell(20, 3, $dateend, 0, 'L');
|
||||
|
||||
|
||||
$pageposafter=$pdf->getPage();
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -153,7 +153,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$outputlangs->load("products");
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE))
|
||||
@ -161,7 +161,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if (empty($object->lines[$i]->fk_product)) continue;
|
||||
|
||||
|
||||
$objphoto = new Product($this->db);
|
||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||
|
||||
@ -185,7 +185,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
if ($conf->propal->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
|
||||
// $deja_regle = 0;
|
||||
|
||||
// Definition of $dir and $file
|
||||
@ -254,6 +254,15 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -320,7 +329,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposbefore+1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
$showpricebeforepagebreak=0;
|
||||
@ -358,7 +367,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -375,6 +384,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
@ -456,6 +466,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -58,7 +58,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Supplier invoice
|
||||
* @param Object $object Supplier invoice
|
||||
*/
|
||||
function __construct($db,$object)
|
||||
{
|
||||
@ -105,7 +105,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - 16; // width of images
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxpicture-=20;
|
||||
@ -225,6 +225,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -279,7 +288,39 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1);
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We found a page break
|
||||
$showpricebeforepagebreak=0;
|
||||
}
|
||||
}
|
||||
else // No pagebreak
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
@ -288,7 +329,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
if ($pageposafter > $pageposbefore) {
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
|
||||
@ -299,7 +340,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
{
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit price before discount
|
||||
@ -320,7 +361,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
// Total HT line
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
$tvaligne=$object->lines[$i]->total_tva;
|
||||
@ -342,6 +383,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
@ -366,6 +408,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
@ -382,6 +425,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - 16; // width of images
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxpicture-=20;
|
||||
@ -233,6 +233,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxtva+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxup+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxqty+=($this->postotalht - $this->posxdiscount);
|
||||
$this->posxdiscount+=($this->postotalht - $this->posxdiscount);
|
||||
//$this->postotalht;
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
@ -307,7 +316,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -401,6 +410,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
|
||||
@ -6,6 +6,11 @@
|
||||
|
||||
-- Requests to clean corrupted database
|
||||
|
||||
-- delete foreign key that should never exists
|
||||
ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency;
|
||||
ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency;
|
||||
ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency;
|
||||
|
||||
delete from llx_facturedet where fk_facture in (select rowid from llx_facture where facnumber in ('(PROV)','ErrorBadMask'));
|
||||
delete from llx_facture where facnumber in ('(PROV)','ErrorBadMask');
|
||||
delete from llx_commandedet where fk_commande in (select rowid from llx_commande where ref in ('(PROV)','ErrorBadMask'));
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
"Name* (s.nom)";"Status (s.status)";"Customer* (s.client)";"Supplier* (s.fournisseur)";"DateCreation (s.datec)";"CustomerCode (s.code_client)";"SupplierCode (s.code_fournisseur)";"Address (s.address)";"Zip (s.cp)";"Town (s.ville)";"Phone (s.tel)";"Fax (s.fax)";"Url (s.url)";"Email (s.email)";"IdProf1 (s.siret)";"IdProf2 (s.siren)";"IdProf3 (s.ape)";"IdProf4 (s.idprof4)";"VATIntraShort (s.tva_intra)";"Capital (s.capital)";"Note (s.note)";"ThirdPartyType (s.fk_typent)";"Effectif (s.fk_effectif)";"JuridicalStatus (s.fk_forme_juridique)";"ProspectLevel (s.fk_prospectlevel)";"ProspectStatus (s.fk_stcomm)";"DefaultLanguage (s.default_lang)";"BarCode (s.barcode)"
|
||||
"MyBigCompanyImport1";1;3;1;01/01/00;"CU01-0001";"SU01-0001";"61 jump street";123456;"Big town";101010101;101010102;"http://mycompany.com";"test@mycompany.com";;;;;"FR0123456789";10000;"This is an example of note for record";2;3;1;"PL_MEDIUM";1;"en_US";123456789
|
||||
"MyBigCompanyImport1";1;3;1;01/01/00;"CU01-0001";"SU01-0001";"61 jump street";123456;"Big town";101010101;101010111;"http://mycompany.com";"test@mycompany.com";;;;;"FR0123456781";10000;"This is an example of note for record 1";2;3;1;"PL_MEDIUM";1;"en_US";123456781
|
||||
"MyBigCompanyImport2";1;3;1;01/01/00;"auto";;"62 jump street";123456;"Big town";101010102;101010112;"http://mycompany2.com";"test@mycompany2.com";;;;;"FR0123456782";10000;"This is an example of note for record 2";2;3;1;"PL_MEDIUM";1;"en_US";auto
|
||||
|
||||
|
@ -162,7 +162,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
$file=dirname(__FILE__).'/Example_import_company_1.csv';
|
||||
$result=dol_count_nb_of_line($file);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(2,$result);
|
||||
$this->assertEquals(3,$result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -125,7 +125,10 @@ class ImportTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$file=dirname(__FILE__).'/Example_import_company_1.csv';
|
||||
|
||||
//if (! preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i','2012-03-23')) print 'eeeeeeeeeeee';
|
||||
// TODO
|
||||
// Run import on file and check the record with field "auto" are filled
|
||||
// according to option
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user