diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a813a34135a..0101042fd74 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -53,7 +53,7 @@ $contactid=GETPOST('contactid','int'); $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=''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index bd058a9418e..02a60d4764a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1,28 +1,28 @@ * Copyright (C) 2004 Eric Seigne -* Copyright (C) 2004-2013 Laurent Destailleur -* Copyright (C) 2005 Marc Barilley / Ocebo -* Copyright (C) 2005-2012 Regis Houssin -* Copyright (C) 2006 Andre Cianfarani -* Copyright (C) 2010-2013 Juanjo Menent -* Copyright (C) 2012 Christophe Battarel -* Copyright (C) 2013 Jean-Francois FERRY -* Copyright (C) 2013 Florian Henry -* -* 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 . -*/ + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2013 Jean-Francois FERRY + * Copyright (C) 2013 Florian Henry + * + * 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 . + */ /** * \file htdocs/compta/facture.php @@ -100,7 +100,7 @@ $hookmanager->initHooks(array('invoicecard')); /* * Actions -*/ + */ $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -872,14 +872,18 @@ else if ($action == 'add' && $user->rights->facture->creer) 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'); @@ -887,19 +891,20 @@ else if ($action == 'add' && $user->rights->facture->creer) $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; } } @@ -1537,7 +1542,7 @@ else if ($action == 'down' && $user->rights->facture->creer) /* * Add file in email form -*/ + */ if (GETPOST('addfile')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1552,7 +1557,7 @@ if (GETPOST('addfile')) /* * Remove file in email form -*/ + */ if (! empty($_POST['removedfile'])) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1568,7 +1573,7 @@ if (! empty($_POST['removedfile'])) /* * Send mail -*/ + */ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) { $langs->load('mails'); @@ -1742,7 +1747,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO /* * Generate document -*/ + */ else if ($action == 'builddoc') // En get ou en post { $object->fetch($id); @@ -2000,8 +2005,7 @@ if ($action == 'create') // Ref print ''.$langs->trans('Ref').''.$langs->trans('Draft').''; - // Tiers - print ''; + // Thirdparty print ''.$langs->trans('Customer').''; if($soc->id > 0) { @@ -2018,7 +2022,7 @@ if ($action == 'create') } print ''."\n"; - // Factures predefinies + // Predefined invoices if (empty($origin) && empty($originid) && $socid > 0) { $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; @@ -2125,10 +2129,13 @@ if ($action == 'create') print ''; $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); print ''; - if (($origin=='propal') ) { - print ''; - print ''; + print '
'.$desc.''.$langs->trans('Value').':'; + if (($origin=='propal')) + { + print ''; + $arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount'); + print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); + print ''.$langs->trans('Value').':'; } print '
'; print ''."\n"; @@ -2395,6 +2402,7 @@ if ($action == 'create') print ''; } + print '
'; } else if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index bdb85af0add..d595dfe5579 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -145,7 +145,7 @@ class CommActionRapport $nbpage = $this->_pages($pdf, $outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); $pdf->Output($file,'F'); diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index bc190ab0f5b..bb759d590b9 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -161,7 +161,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Pied de page $this->_pagefoot($pdf,'',$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f5815e7b493..5f69ce4b21c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -467,7 +467,7 @@ class pdf_einstein extends ModelePDFCommandes // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 4f6f04cc742..50bde366d00 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -169,7 +169,7 @@ class pdf_expedition_merou extends ModelePdfExpedition $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")); @@ -323,7 +323,7 @@ class pdf_expedition_merou extends ModelePdfExpedition // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 78b2a2eccfa..3988c5a0ee8 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -469,7 +469,7 @@ class pdf_crabe extends ModelePDFFactures // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index cc1b5994026..6a0feda2e9d 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -319,7 +319,7 @@ class pdf_soleil extends ModelePDFFicheinter } $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index fe17d077185..a881a8f7cdd 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -432,7 +432,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // 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 @@ -492,7 +492,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); }*/ $pdf->Close(); @@ -728,7 +728,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->MultiCell(60, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date,"day",false,$outputlangs,true), 0, 'R'); } } - + $posy=$Yoff; } diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index 2ccd63ab81a..cca049cba92 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -287,7 +287,7 @@ class pdf_baleine extends ModelePDFProjects * Pied de page */ $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 83d0265cd7f..e38d9518668 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -468,7 +468,7 @@ class pdf_azur extends ModelePDFPropales // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 8ef322a0a0c..b7e2f8e5d91 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -210,7 +210,7 @@ class pdf_paiement $this->Body($pdf, 1, $lines, $outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 75af2b06b99..523354adb23 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -407,7 +407,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); - $pdf->AliasNbPages(); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 86ac23db3aa..3079949efa3 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -466,9 +466,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $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(); @@ -576,7 +576,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $posy=$pdf->GetY()+2; } - + return $posy; }