Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2013-07-14 13:25:20 +02:00
commit 4fd1b5364e
30 changed files with 206 additions and 63 deletions

View File

@ -120,7 +120,7 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier)
{ {
$accline=new AccountLine($db); $accline=new AccountLine($db);
$accline->fetch($_GET["rowid"]); $result=$accline->fetch(GETPOST("rowid"));
$result=$accline->delete(); $result=$accline->delete();
} }
@ -295,6 +295,14 @@ if ($id > 0 || ! empty($ref))
*/ */
$param.='&account='.$object->id.'&vline='.$vline; $param.='&account='.$object->id.'&vline='.$vline;
// Confirmation delete
if ($action == 'delete')
{
$text=$langs->trans('ConfirmDeleteTransaction');
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete');
if ($ret == 'html') print '<br>';
}
// Define transaction list navigation string // Define transaction list navigation string
print '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -318,16 +326,9 @@ if ($id > 0 || ! empty($ref))
{ {
$navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>'; $navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>';
} }
$navig.='</fieldset></div>'; $navig.='</div>';
//var_dump($navig);
// Confirmation delete //var_dump($navig);
if ($action == 'delete')
{
$text=$langs->trans('ConfirmDeleteTransaction');
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete');
if ($ret == 'html') print '<br>';
}
print '<table class="notopnoleftnoright" width="100%">'; print '<table class="notopnoleftnoright" width="100%">';

View File

@ -1159,7 +1159,7 @@ class AccountLine extends CommonObject
$this->db->begin(); $this->db->begin();
// Delete urls // Delete urls
$result=$this->delete_urls(); $result=$this->delete_urls($user);
if ($result < 0) if ($result < 0)
{ {
$nbko++; $nbko++;

View File

@ -309,10 +309,10 @@ else
print img_next().'</a>'; print img_next().'</a>';
print "</td>\n"; print "</td>\n";
// Num cheque // Type and num
print '<td class="nowrap">'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').'</td>'; print '<td class="nowrap">'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').'</td>';
// Libelle // Description
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">'; print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
$reg=array(); $reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
@ -355,7 +355,7 @@ else
{ {
$paymentvatstatic->id=$links[$key]['url_id']; $paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$langs->trans("Payment"); $paymentvatstatic->ref=$langs->trans("Payment");
print ' '.$paymentvatstatic->getNomUrl(2); print ' '.$paymentvatstatic->getNomUrl(1);
} }
elseif ($links[$key]['type']=='banktransfert') { elseif ($links[$key]['type']=='banktransfert') {
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.

View File

@ -146,7 +146,7 @@ class FormFile
{ {
print $out; print $out;
} }
print $hookmanager->resprint; print $hookmanager->resPrint;
return 1; return 1;
} }
@ -774,7 +774,7 @@ class FormFile
print '<table width="100%" class="nobordernopadding">'; print '<table width="100%" class="nobordernopadding">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$sortref="fullname"; $sortref="fullname";
if ($modulepart == 'invoice_supplier') $sortref=''; // No sort for supplier invoices as path name is not if ($modulepart == 'invoice_supplier') $sortref='level1name';
print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
@ -852,7 +852,7 @@ class FormFile
// To show ref or specific information according to view to show (defined by $module) // To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }

View File

@ -135,8 +135,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file
{ {
preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg);
$level1name=(isset($reg[1])?$reg[1]:'');
$file_list[] = array( $file_list[] = array(
"name" => $file, "name" => $file,
"level1name" => $level1name,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize, "size" => $filesize,
@ -159,8 +162,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file
{ {
preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg);
$level1name=(isset($reg[1])?$reg[1]:'');
$file_list[] = array( $file_list[] = array(
"name" => $file, "name" => $file,
"level1name" => $level1name,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize, "size" => $filesize,

View File

@ -1553,4 +1553,31 @@ function pdf_getLinkedObjects($object,$outputlangs)
return $linkedobjects; return $linkedobjects;
} }
/**
* Return dimensions to use for images onto PDF
*
* @param string $realpath Full path to photo file to use
* @return array Height/Width to use to output image (in pixel)
*/
function pdf_getHeightForImage($realpath)
{
$maxheight=12; $maxwidth=16;
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$tmp=dol_getImageSize($realpath);
if ($tmp['height'])
{
$width=(int) round($maxheight*$tmp['width']/$tmp['height']);
if ($width > $maxwidth)
{
$height=(int) round($height*$maxwidth/$width);
$width=$maxwidth;
}
else
{
$height=$maxheight;
}
}
return array('width'=>$width,'height'=>$height);
}
?> ?>

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/** /**
* Classe permettant de generer les propales au modele Azur * Class to generate PDF proposal Azur
*/ */
class pdf_azur extends ModelePDFPropales class pdf_azur extends ModelePDFPropales
{ {
@ -102,6 +102,7 @@ class pdf_azur extends ModelePDFPropales
// Define position of columns // Define position of columns
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxpicture=95;
$this->posxtva=111; $this->posxtva=111;
$this->posxup=126; $this->posxup=126;
$this->posxqty=145; $this->posxqty=145;
@ -281,7 +282,15 @@ class pdf_azur extends ModelePDFPropales
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
$pdf->startTransaction(); $pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
}
else
{
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
}
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -289,7 +298,15 @@ class pdf_azur extends ModelePDFPropales
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $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); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
}
else
{
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
}
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY(); $posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
@ -326,6 +343,60 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Photo
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
$curX = $this->posxpicture-1;
if ($object->lines[$i]->fk_product)
{
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
$realpath='';
if ($object->ref == 'SPECIMEN')
{
$realpath = DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg';
}
else
{
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{
if ($obj['photo_vignette'])
{
$filename='thumbs/'.$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
$realpath = $dir.$filename;
break;
}
}
if (!empty($realpath))
{
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$tmp=pdf_getHeightForImage($realpath);
//var_dump(constant('PDF_IMAGE_SCALE_RATIO'));var_dump($pdf->getImageScale());var_dump($tmp['width']);var_dump($pdf->pixelsToUnits($tmp['width']));exit;
// measures 1/72 of an inch, i.e. approximately 0.0139 inch or 25.4/72 = 0.3528 mm
var_dump($this->page_largeur);exit;
//var_dump(tmp['height']);exit;
$pdf->Line($this->posxtva,10,$this->posxtva+0.5,10);
$pdf->Image($realpath, $this->posxtva, 10, $tmp['width'], $tmp['height'],'','','',2,0); // Use 300 dpi
$pdf->Line($this->posxtva+$pdf->pixelsToUnits($tmp['width']),10,$this->posxtva+$pdf->pixelsToUnits($tmp['width'])+0.5,10);
$pdf->Image($realpath, $curX + ($this->posxtva-$this->posxpicture-($pdf->pixelsToUnits($tmp['width'])))/2, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi
//$nexY += 7; // +7 for height = 12
$nexY += round($pdf->pixelsToUnits($tmp['height']));
//var_dump($nexY);exit;
}
}
}
// VAT Rate // VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
@ -744,7 +815,7 @@ class pdf_azur extends ModelePDFPropales
//{ //{
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) foreach( $this->localtax1 as $localtax_type => $localtax_rate )
{ {
if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; if (in_array((string) $localtax_type, array('1','3','5'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
@ -776,7 +847,7 @@ class pdf_azur extends ModelePDFPropales
//{ //{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) foreach( $this->localtax2 as $localtax_type => $localtax_rate )
{ {
if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; if (in_array((string) $localtax_type, array('1','3','5'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
@ -1009,6 +1080,16 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
} }
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
$pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxpicture-1, $tab_top+1);
$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
}
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);

View File

@ -63,6 +63,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="fullname"; if (! $sortfield) $sortfield="fullname";
if ($module == 'invoice_supplier' && $sortfield == "fullname") $sortfield="level1name";
$ecmdir = new EcmDirectory($db); $ecmdir = new EcmDirectory($db);
if ($section) if ($section)

View File

@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
/** /**
* \class Fournisseur * Class to manage suppliers
* \brief Class to manage suppliers
*/ */
class Fournisseur extends Societe class Fournisseur extends Societe
{ {

View File

@ -120,7 +120,8 @@ class FactureFournisseur extends CommonInvoice
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
// Clear parameters // Clean parameters
if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (empty($this->date)) $this->date=$now; if (empty($this->date)) $this->date=$now;
$socid = $this->socid; $socid = $this->socid;

View File

@ -51,7 +51,7 @@ $object = new FactureFournisseur($db);
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
{ {
$result = $object->fetch($id); $result = $object->fetch($id, $ref);
if ($result > 0 && $id > 0) if ($result > 0 && $id > 0)
{ {
@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref))
// Reference du facture // Reference du facture
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print "</td></tr>"; print "</td></tr>";
// Ref supplier // Ref supplier

View File

@ -39,6 +39,7 @@ $langs->load("companies");
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'); $id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$ref = GETPOST('ref','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -58,7 +59,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new FactureFournisseur($db); $object = new FactureFournisseur($db);
if ($object->fetch($id)) if ($object->fetch($id, $ref))
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$ref=dol_sanitizeFileName($object->ref); $ref=dol_sanitizeFileName($object->ref);
@ -130,7 +131,7 @@ if ($object->id > 0)
// Ref // Ref
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref'); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -73,7 +73,7 @@ if ($mode == 'search')
if ($modesearch == 'soc') if ($modesearch == 'soc')
{ {
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
$sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'"; $sql.= " WHERE s.nom LIKE '%".$db->escape($socname)."%'";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")";
} }
@ -127,7 +127,8 @@ if (GETPOST('filtre'))
if (GETPOST("search_ref")) if (GETPOST("search_ref"))
{ {
$sql .= " AND fac.rowid = ".$db->escape(GETPOST("search_ref")); if (is_numeric(GETPOST("search_ref"))) $sql .= " AND (fac.rowid = ".GETPOST("search_ref",'int')." OR fac.ref = '".$db->escape(GETPOST("search_ref"))."')"; // For backward compatibility
else $sql .= " AND fac.ref LIKE '%".$db->escape(GETPOST("search_ref"))."%'";
} }
if (GETPOST("search_ref_supplier")) if (GETPOST("search_ref_supplier"))
{ {

View File

@ -41,7 +41,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db); $object = new FactureFournisseur($db);
$object->fetch($id,$ref); $object->fetch($id, $ref);
@ -71,13 +71,13 @@ if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
llxHeader(); llxHeader();
if ($id) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -92,7 +92,7 @@ if ($id)
// Ref // Ref
print '<tr><td width="20%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="20%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -60,9 +60,10 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[3]) || ! $argv[3]) { if (! isset($argv[3]) || ! $argv[3]) {
print "Usage: ".$script_file." bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n"; print "Usage: ".$script_file." bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
exit(-1); exit(-1);
} }
$bankref=$argv[1]; $bankref=$argv[1];
@ -172,26 +173,31 @@ $array_export_TypeFields=array(
); );
// Recherche les ecritures pour le releve // Build request to find records for a bank account/receipt
$listofnum="'"; $listofnum="";
$arraynum=explode(',',$num); if (! empty($num) && $num != "all")
foreach($arraynum as $val)
{ {
if ($listofnum != "'") $listofnum.="','"; $listofnum.="'";
$listofnum.=$val; $arraynum=explode(',',$num);
foreach($arraynum as $val)
{
if ($listofnum != "'") $listofnum.="','";
$listofnum.=$val;
}
$listofnum.="'";
} }
$listofnum.="'";
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve IN (".$listofnum.")"; $sql.= " WHERE b.fk_account = ".$acct->id;
if (!isset($num)) $sql.= " OR b.num_releve is null"; if ($listofnum) $sql.= " AND b.num_releve IN (".$listofnum.")";
$sql.= " AND b.fk_account = ".$acct->id; if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND b.fk_account = ba.rowid";
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
//print $sql; //print $sql;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -401,7 +407,6 @@ if ($resql)
$rec->accountelem=$accountelem; $rec->accountelem=$accountelem;
$rec->debit=$debit; $rec->debit=$debit;
$rec->credit=$credit; $rec->credit=$credit;
$rec->sold=$sold;
$rec->comment=$comment; $rec->comment=$comment;
$rec->soldbefore=price2num($totalbefore); $rec->soldbefore=price2num($totalbefore);
$rec->soldafter=price2num($total); $rec->soldafter=price2num($total);

View File

@ -60,6 +60,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$fname = DOL_DATA_ROOT.'/export-contacts.xls'; $fname = DOL_DATA_ROOT.'/export-contacts.xls';

View File

@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
print "Mails sending disabled (useless in batch mode)\n"; print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails $conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -67,6 +67,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[3])?$argv[3]:'none'; $duration_value=isset($argv[3])?$argv[3]:'none';

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// Check parameters // Check parameters
if (! isset($argv[1])) if (! isset($argv[1]))
@ -124,7 +125,7 @@ foreach ($argv as $key => $value)
$paymentdatebefore=dol_stringtotime($argv[$key+2]); $paymentdatebefore=dol_stringtotime($argv[$key+2]);
if (empty($paymentdateafter) || empty($paymentdatebefore)) if (empty($paymentdateafter) || empty($paymentdatebefore))
{ {
print 'Error: Bad date format'."\n"; print 'Error: Bad date format or value'."\n";
exit(-1); exit(-1);
} }
print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n"; print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n";

View File

@ -52,6 +52,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[1]) || ! $argv[1]) { if (! isset($argv[1]) || ! $argv[1]) {
print "Usage: $script_file now\n"; print "Usage: $script_file now\n";

View File

@ -57,6 +57,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
/* /*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE) if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -57,7 +57,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
/* /*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE) if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -55,6 +55,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -51,8 +51,9 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$datetimeprev = time(); $datetimeprev = dol_now();
$month = strftime("%m", $datetimeprev); $month = strftime("%m", $datetimeprev);
$year = strftime("%Y", $datetimeprev); $year = strftime("%Y", $datetimeprev);
@ -60,8 +61,6 @@ $year = strftime("%Y", $datetimeprev);
$user = new user($db); $user = new user($db);
$user->fetch($conf->global->PRELEVEMENT_USER); $user->fetch($conf->global->PRELEVEMENT_USER);
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1])) { // Check parameters if (! isset($argv[1])) { // Check parameters
print "This script check invoices with a withdrawal request and\n"; print "This script check invoices with a withdrawal request and\n";
print "then create payment and build a withdraw file.\n"; print "then create payment and build a withdraw file.\n";

View File

@ -301,7 +301,21 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$stime='1970-01-01T02:00:00Z'; $conf->global->MAIN_OLD_DATE=1;
$stime='19700102';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(86400,$result);
$conf->global->MAIN_OLD_DATE=0;
$stime='19700102';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(86400,$result);
$stime='1970-01-01T02:00:00Z';
$result=dol_stringtotime($stime); $result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result); $this->assertEquals(7200,$result);
@ -321,11 +335,6 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result); $this->assertEquals(7200,$result);
$stime='19700101';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(0,$result);
return $result; return $result;
} }