Skip to content

Commit

Permalink
Merge branch '3.4' of https://github.com/Dolibarr/dolibarr.git into 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 24, 2013
2 parents 06f36fb + bdafcb6 commit b6d5ebf
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 62 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/action/fiche.php
Expand Up @@ -53,7 +53,7 @@
$socid = GETPOST('socid','int');
$id = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');

$error=GETPOST("error");
$mesg='';
Expand Down
94 changes: 51 additions & 43 deletions htdocs/compta/facture.php
@@ -1,28 +1,28 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* \file htdocs/compta/facture.php
Expand Down Expand Up @@ -100,7 +100,7 @@

/*
* Actions
*/
*/

$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
Expand Down Expand Up @@ -872,34 +872,39 @@

if ($id > 0)
{
//If deposit invoice
if ($_POST['type'] == 3) {
// If deposit invoice
if ($_POST['type'] == 3)
{
$typeamount=GETPOST('typedeposit','alpha');
$valuedeposit=GETPOST('valuedeposit','int');

if ($typeamount=='amount') {
if ($typeamount=='amount')
{
$amountdeposit=$valuedeposit;
}else {
}
else
{
$amountdeposit=0;

dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');

$classname = ucfirst($subelement);
$srcobject = new $classname($db);

dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit line");
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit lines");
$result=$srcobject->fetch($object->origin_id);
if ($result > 0)
{
$totalamount=0;
$lines = $srcobject->lines;
$num=count($lines);
for ($i=0;$i<$num;$i++)
$numlines=count($lines);
for ($i=0; $i<$numlines; $i++)
{
$totalamount=+$lines[$i]->subprice;
$totalamount += $lines[$i]->subprice;
}

if ($totalamount!=0) {
if ($totalamount!=0)
{
$amountdeposit=($totalamount*$valuedeposit)/100;
}
}
Expand Down Expand Up @@ -1537,7 +1542,7 @@

/*
* Add file in email form
*/
*/
if (GETPOST('addfile'))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
Expand All @@ -1552,7 +1557,7 @@

/*
* Remove file in email form
*/
*/
if (! empty($_POST['removedfile']))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
Expand All @@ -1568,7 +1573,7 @@

/*
* Send mail
*/
*/
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
Expand Down Expand Up @@ -1742,7 +1747,7 @@

/*
* Generate document
*/
*/
else if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
Expand Down Expand Up @@ -2000,8 +2005,7 @@
// Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';

// Tiers
print '<tr>';
// Thirdparty
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($soc->id > 0)
{
Expand All @@ -2018,7 +2022,7 @@
}
print '</tr>'."\n";

// Factures predefinies
// Predefined invoices
if (empty($origin) && empty($originid) && $socid > 0)
{
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
Expand Down Expand Up @@ -2125,10 +2129,13 @@
print '</td><td valign="middle" class="nowrap">';
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print '<table class="nobordernopadding"><tr><td>'.$desc.'</td>';
if (($origin=='propal') ) {
print '<td><select name="typedeposit"><option value="amount">'.$langs->trans('FixAmount').'</option>';
print '<option value="variable">'.$langs->trans('VarAmount').'</option></select></td>';
print '<td>'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
if (($origin=='propal'))
{
print '<td class="nowrap" style="padding-left: 5px">';
$arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount');
print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
print '</td>';
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
}
print '</td></tr></table>';
print '</td></tr>'."\n";
Expand Down Expand Up @@ -2395,6 +2402,7 @@
print '</table>';
}

print '<br>';
}
else if ($id > 0 || ! empty($ref))
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/action/rapport.pdf.php
Expand Up @@ -145,7 +145,7 @@ function write_file($socid = 0, $catid = 0, $outputlangs='')

$nbpage = $this->_pages($pdf, $outputlangs);

$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

$pdf->Output($file,'F');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
Expand Up @@ -161,7 +161,7 @@ function write_file($_dir, $number, $outputlangs)

// Pied de page
$this->_pagefoot($pdf,'',$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -467,7 +467,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
Expand Up @@ -169,7 +169,7 @@ function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hi
$pagenb=0;
$pdf->SetDrawColor(128,128,128);

$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
Expand Down Expand Up @@ -323,7 +323,7 @@ function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hi

// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -469,7 +469,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
Expand Up @@ -319,7 +319,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
}

$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
Expand Up @@ -432,7 +432,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

// Check product remaining to be delivered
// TODO doit etre modifie
Expand Down Expand Up @@ -492,7 +492,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
}*/

$pdf->Close();
Expand Down Expand Up @@ -728,7 +728,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date,"day",false,$outputlangs,true), 0, 'R');
}
}

$posy=$Yoff;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/project/pdf/pdf_baleine.modules.php
Expand Up @@ -287,7 +287,7 @@ function write_file($object,$outputlangs)
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -468,7 +468,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/rapport/pdf_paiement.class.php
Expand Up @@ -210,7 +210,7 @@ function write_file($_dir, $month, $year, $outputlangs)

$this->Body($pdf, 1, $lines, $outputlangs);

$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
Expand Up @@ -407,7 +407,7 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=

// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down
Expand Up @@ -466,9 +466,9 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();

$pdf->Close();

Expand Down Expand Up @@ -576,7 +576,7 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$posy=$pdf->GetY()+2;
}


return $posy;
}

Expand Down

0 comments on commit b6d5ebf

Please sign in to comment.