Hello ,

Ca faisait un moment que je voulais faire remonté les quelques lignes 
nécessaire au fonctionnement du paiement des avoirs.


Ci-joint le fichier diff qui est basé sur la 3.1.1. 

Pour l'affichage sur la fiche , je n'ai pas ajouté de ligne te juste commenté 
la 
limitation du calcul du reste a payer , qui ne s'effectuer pas pour les avoirs.

Pur finir , j'ai déjà eu la remarque de mes clients, que la valeur négative 
prêtait à confusion.. 


Aurelien 


-- 
Aurélien Imhof
Consultant 

Conseils - Maintenance - Infogérance - Audit 
Développement - Programmation

Sites :
- http://www.oscim.fr
- http://www.com-hedon.com

bureau 02 85 52 60 32
portable 06 07 60 82 37

Hébergement ( dédie - virtualisé - mutualisé ) -  backup - Cloud 
téléphonie VOIP  

Assistance technique hébergement 
 08 25 59 50 80 (0.15€/min)


Sites extra/perso 
- http://oscss.org
- http://oscim.net





Index: /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/facture.php
===================================================================
--- /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/facture.php	(révision 8)
+++ /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/facture.php	(copie de travail)
@@ -2373,8 +2373,8 @@
                 $num = $db->num_rows($result);
                 $i = 0;
 
-                if ($object->type != 2)
-                {
+//                 if ($object->type != 2)
+//                 {
                     while ($i < $num)
                     {
                         $objp = $db->fetch_object($result);
@@ -2389,7 +2389,7 @@
                         print '</tr>';
                         $i++;
                     }
-                }
+//                 }
                 $db->free($result);
             }
             else
@@ -2397,8 +2397,8 @@
                 dol_print_error($db);
             }
 
-            if ($object->type != 2)
-            {
+//             if ($object->type != 2)
+//             {
                 // Total already paid
                 print '<tr><td colspan="2" align="right">';
                 if ($object->type != 3) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
@@ -2488,13 +2488,13 @@
                 print ' :</td>';
                 print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price($resteapayeraffiche).'</b></td>';
                 print '<td nowrap="nowrap">&nbsp;</td></tr>';
-            }
-            else
-            {
-                // Sold credit note
-                print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTC').' :</td>';
-                print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($object->total_ttc)).'</b></td><td>&nbsp;</td></tr>';
-            }
+//             }
+//             else
+//             {
+//                 // Sold credit note
+//                 print '<tr><td colspan="2" align="right">'.$langs->trans('TotalTTC').' :</td>';
+//                 print '<td align="right" style="border: 1px solid;" bgcolor="#f0f0f0"><b>'.price(abs($object->total_ttc)).'</b></td><td>&nbsp;</td></tr>';
+//             }
 
             print '</table>';
 


Index: /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement.php
===================================================================
--- /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement.php	(révision 8)
+++ /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement.php	(copie de travail)
@@ -83,6 +83,7 @@
             $totalpaiement = $totalpaiement + $amounts[$cursorfacid];
             $tmpfacture=new Facture($db);
             $tmpfacture->fetch($cursorfacid);
+						$ArrType[$cursorfacid] =$tmpfacture->type ;
             $amountsresttopay[$cursorfacid]=price2num($tmpfacture->total_ttc-$tmpfacture->getSommePaiement());
             if ($amounts[$cursorfacid] && $amounts[$cursorfacid] > $amountsresttopay[$cursorfacid])
             {
@@ -156,6 +157,7 @@
     $paiement->num_paiement = $_POST['num_paiement'];
     $paiement->note         = $_POST['comment'];
 
+
     if (! $error)
     {
         $paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
@@ -168,7 +170,13 @@
 
     if (! $error)
     {
-        $result=$paiement->addPaymentToBank($user,'payment','(CustomerInvoicePayment)',$_POST['accountid'],$_POST['chqemetteur'],$_POST['chqbank']);
+
+			if (!in_array(2,$ArrType))
+		    $result=$paiement->addPaymentToBank($user,'payment','(CustomerInvoicePayment)',$_POST['accountid'],$_POST['chqemetteur'],$_POST['chqbank']);
+			elseif (in_array(2,$ArrType))
+				$result=$paiement->addPaymentToBank($user,'payment_avoir','(CustomerInvoicePaymentRemboursement)',$_POST['accountid'],'','');
+
+
         if ($result < 0)
         {
             $errmsg=$paiement->error;
@@ -231,213 +239,260 @@
         // Bouchon
         if ($facture->type == 2)
         {
-            print $langs->trans("FeatureNotYetAvailable");
-            llxFooter();
-            exit;
-        }
+						print '<form name="add_paiement" action="paiement.php" method="post">';
+						print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+						print '<input type="hidden" name="action" value="add_paiement">';
+						print '<input type="hidden" name="facid" value="'.$facture->id.'">';
+						print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
+						print '<input type="hidden" name="type" value="'.$facture->type.'">';
 
-        // Initialize data for confirmation (this is used because data can be change during confirmation)
-        if ($action == 'add_paiement')
-        {
-            $i=0;
+						print '<table class="border" width="100%">';
 
-            $formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
-            $formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
-            $formquestion[$i++]=array('type' => 'hidden','name' => 'type',  'value' => $facture->type);
+						print '<tr><td><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
+
+						// Date payment
+						print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
+						$datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+						$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
+						$html->select_date($datepayment,'','','',0,"add_paiement",1,1);
+						print '</td>';
+						print '<td>'.$langs->trans('Comments').'</td></tr>';
+
+						print '<tr><td><span class="fieldrequired">'.$langs->trans('PaymentMode').'</span></td><td>';
+						$html->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):''),'paiementcode','',2);
+						print "</td>\n";
+
+						print '<td rowspan="5" valign="top">';
+						print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>';
+
+						print '<tr><td>'.$langs->trans('Numero');
+						print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
+						print '</td>';
+						print '<td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>';
+
+						print '<tr>';
+						if ($conf->banque->enabled)
+						{
+							if ($facture->type != 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToCredit').'</span></td>';
+							if ($facture->type == 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
+							print '<td>';
+							$html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1);
+							print '</td>';
+						}
+						else
+						{
+							print '<td colspan="2">&nbsp;</td>';
+						}
+						print "</tr>\n";
+
+
+						print '</table>';
+// 						llxFooter();
+//             exit;
         }
+				else {
+					// Initialize data for confirmation (this is used because data can be change during confirmation)
+					if ($action == 'add_paiement')
+					{
+							$i=0;
 
-        // Invoice with Paypal transaction
-        if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
-        {
-        	if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
-        	$paymentnum=$facture->ref_int;
-        }
-        if ($conf->use_javascript_ajax)
-		{
-			print "\n".'<script type="text/javascript" language="javascript">';
-			print '$(document).ready(function () {
-            			setPaiementCode();
-            			
-            			$("#selectpaiementcode").change(function() {
-            				setPaiementCode();
-            			});
-            			
-            			function setPaiementCode()
-            			{
-            				var code = $("#selectpaiementcode option:selected").val();
-            				
-            				if (code == \'CHQ\')
-            				{
-            					$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
-            					if ($(\'#fieldchqemetteur\').val() == \'\')
-            					{
-            						$(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
-            					}
-            				}
-            				else
-            				{
-            					$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
-            					$(\'#fieldchqemetteur\').val(\'\');
-            				}
-            			}';
-			// For paiement auto-completion
-			if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
+							$formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
+							$formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
+							$formquestion[$i++]=array('type' => 'hidden','name' => 'type',  'value' => $facture->type);
+					}
+
+					// Invoice with Paypal transaction
+					if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
+					{
+						if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
+						$paymentnum=$facture->ref_int;
+					}
+					if ($conf->use_javascript_ajax)
 			{
-				print "\n".'
-						function elemToJson(selector)
-						{
-							var subJson = {};
-							$.map(selector.serializeArray(), function(n,i)
+				print "\n".'<script type="text/javascript" language="javascript">';
+				print '$(document).ready(function () {
+										setPaiementCode();
+										
+										$("#selectpaiementcode").change(function() {
+											setPaiementCode();
+										});
+										
+										function setPaiementCode()
+										{
+											var code = $("#selectpaiementcode option:selected").val();
+											
+											if (code == \'CHQ\')
+											{
+												$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
+												if ($(\'#fieldchqemetteur\').val() == \'\')
+												{
+													$(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
+												}
+											}
+											else
+											{
+												$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
+												$(\'#fieldchqemetteur\').val(\'\');
+											}
+										}';
+				// For paiement auto-completion
+				if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
+				{
+					print "\n".'
+							function elemToJson(selector)
 							{
-								subJson[n["name"]] = n["value"];
-							});
-							return subJson;
-						}
-						function callForResult(imgId)
-						{
-							var json = {};
-							var form = $("#payment_form");
-							
-							json["amountPayment"] = $("#amountpayment").attr("value");
-							json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
-							json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
-							
-							if (imgId != null) {
-								json["imgClicked"] = imgId;
+								var subJson = {};
+								$.map(selector.serializeArray(), function(n,i)
+								{
+									subJson[n["name"]] = n["value"];
+								});
+								return subJson;
 							}
-							
-							$.post("ajaxpayment.php", json, function(data)
+							function callForResult(imgId)
 							{
-								json = $.parseJSON(data);
+								var json = {};
+								var form = $("#payment_form");
 								
-								form.data(json);
+								json["amountPayment"] = $("#amountpayment").attr("value");
+								json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
+								json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
 								
-								for (var key in json)
+								if (imgId != null) {
+									json["imgClicked"] = imgId;
+								}
+								
+								$.post("ajaxpayment.php", json, function(data)
 								{
-									if (key == "result")	{
-										if (json["makeRed"]) {
-											$("#"+key).css("color", "red");
+									json = $.parseJSON(data);
+									
+									form.data(json);
+									
+									for (var key in json)
+									{
+										if (key == "result")	{
+											if (json["makeRed"]) {
+												$("#"+key).css("color", "red");
+											} else {
+												$("#"+key).removeAttr("style");
+											}
+											json[key]=json["label"]+" "+json[key];
+											$("#"+key).text(json[key]);
 										} else {
-											$("#"+key).removeAttr("style");
+											form.find("input[name*=\""+key+"\"]").each(function() {
+												$(this).attr("value", json[key]);
+											});
 										}
-										json[key]=json["label"]+" "+json[key];
-										$("#"+key).text(json[key]);
-									} else {
-										form.find("input[name*=\""+key+"\"]").each(function() {
-											$(this).attr("value", json[key]);
-										});
 									}
-								}
+								});
+							}
+							function callToBreakdown(imgSelector) {
+								var form = $("#payment_form"), imgId;
+								
+								imgId =  imgSelector.attr("id");
+								callForResult(imgId);
+							}
+							
+							$("#payment_form").find("img").click(function() {
+								callToBreakdown(jQuery(this));
 							});
-						}
-						function callToBreakdown(imgSelector) {
-							var form = $("#payment_form"), imgId;
 							
-							imgId =  imgSelector.attr("id");
-							callForResult(imgId);
-						}
-						
-						$("#payment_form").find("img").click(function() {
-							callToBreakdown(jQuery(this));
-						});
-						
-						$("#payment_form").find("input[name*=\"amount_\"]").change(function() {
-							callForResult();
-						});
-						
-						$("#amountpayment").change(function() {
-							callForResult();
-						});';
+							$("#payment_form").find("input[name*=\"amount_\"]").change(function() {
+								callForResult();
+							});
+							
+							$("#amountpayment").change(function() {
+								callForResult();
+							});';
+				}
+				print '});
+				</script>'."\n";
 			}
-			print '});
-			</script>'."\n";
-		}
 
-        print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
-        print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
-        print '<input type="hidden" name="action" value="add_paiement">';
-        print '<input type="hidden" name="facid" value="'.$facture->id.'">';
-        print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
-        print '<input type="hidden" name="type" value="'.$facture->type.'">';
-        print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
+					print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
+					print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+					print '<input type="hidden" name="action" value="add_paiement">';
+					print '<input type="hidden" name="facid" value="'.$facture->id.'">';
+					print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
+					print '<input type="hidden" name="type" value="'.$facture->type.'">';
+					print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
 
-        print '<table class="border" width="100%">';
+					print '<table class="border" width="100%">';
 
-        // Third party
-        print '<tr><td><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
+					// Third party
+					print '<tr><td><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
 
-        // Date payment
-        print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
-        $datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
-        $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
-        $html->select_date($datepayment,'','','',0,"add_paiement",1,1);
-        print '</td>';
-        print '<td>'.$langs->trans('Comments').'</td></tr>';
+					// Date payment
+					print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
+					$datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+					$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
+					$html->select_date($datepayment,'','','',0,"add_paiement",1,1);
+					print '</td>';
+					print '<td>'.$langs->trans('Comments').'</td></tr>';
 
-        $rowspan=5;
-        if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++;
+					$rowspan=5;
+					if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++;
 
-        // Payment mode
-        print '<tr><td><span class="fieldrequired">'.$langs->trans('PaymentMode').'</span></td><td>';
-        $html->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2);
-        print "</td>\n";
-        print '<td rowspan="'.$rowspan.'" valign="top">';
-        print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td>';
-        print '</tr>';
+					// Payment mode
+					print '<tr><td><span class="fieldrequired">'.$langs->trans('PaymentMode').'</span></td><td>';
+					$html->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2);
+					print "</td>\n";
+					print '<td rowspan="'.$rowspan.'" valign="top">';
+					print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td>';
+					print '</tr>';
 
-        // Payment amount
-        if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT))
-        {
-            print '<tr><td><span class="fieldrequired">'.$langs->trans('AmountPayment').'</span></td>';
-            print '<td>';
-            if ($action == 'add_paiement')
-            {
-                print '<input id="amountpayment" name="amountpaymenthidden" size="8" type="text" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'" disabled="true">';
-                print '<input name="amountpayment" type="hidden" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'">';
-            }
-            else
-            {
-                print '<input id="amountpayment" name="amountpayment" size="8" type="text" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'">';
-            }
-            print '</td>';
-            print '</tr>';
-        }
+					// Payment amount
+					if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT))
+					{
+							print '<tr><td><span class="fieldrequired">'.$langs->trans('AmountPayment').'</span></td>';
+							print '<td>';
+							if ($action == 'add_paiement')
+							{
+									print '<input id="amountpayment" name="amountpaymenthidden" size="8" type="text" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'" disabled="true">';
+									print '<input name="amountpayment" type="hidden" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'">';
+							}
+							else
+							{
+									print '<input id="amountpayment" name="amountpayment" size="8" type="text" value="'.(empty($_POST['amountpayment'])?'':$_POST['amountpayment']).'">';
+							}
+							print '</td>';
+							print '</tr>';
+					}
 
-        print '<tr>';
-        if ($conf->banque->enabled)
-        {
-            if ($facture->type != 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToCredit').'</span></td>';
-            if ($facture->type == 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
-            print '<td>';
-            $html->select_comptes($accountid,'accountid',0,'',2);
-            print '</td>';
-        }
-        else
-        {
-            print '<td colspan="2">&nbsp;</td>';
-        }
-        print "</tr>\n";
+					print '<tr>';
+					if ($conf->banque->enabled)
+					{
+							if ($facture->type != 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToCredit').'</span></td>';
+							if ($facture->type == 2) print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
+							print '<td>';
+							$html->select_comptes($accountid,'accountid',0,'',2);
+							print '</td>';
+					}
+					else
+					{
+							print '<td colspan="2">&nbsp;</td>';
+					}
+					print "</tr>\n";
 
-        // Cheque number
-        print '<tr><td>'.$langs->trans('Numero');
-        print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
-        print '</td>';
-        print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>';
+					// Cheque number
+					print '<tr><td>'.$langs->trans('Numero');
+					print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
+					print '</td>';
+					print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>';
 
-        // Check transmitter
-        print '<tr><td class="'.(GETPOST('paiementcode')=='CHQ'?'fieldrequired ':'').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
-        print ' <em>('.$langs->trans("ChequeMaker").')</em>';
-        print '</td>';
-        print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur').'"></td></tr>';
+					// Check transmitter
+					print '<tr><td class="'.(GETPOST('paiementcode')=='CHQ'?'fieldrequired ':'').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
+					print ' <em>('.$langs->trans("ChequeMaker").')</em>';
+					print '</td>';
+					print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur').'"></td></tr>';
 
-        // Bank name
-        print '<tr><td>'.$langs->trans('Bank');
-        print ' <em>('.$langs->trans("ChequeBank").')</em>';
-        print '</td>';
-        print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank').'"></td></tr>';
+					// Bank name
+					print '<tr><td>'.$langs->trans('Bank');
+					print ' <em>('.$langs->trans("ChequeBank").')</em>';
+					print '</td>';
+					print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank').'"></td></tr>';
 
-        print '</table>';
-
+					print '</table>';
+				}
         /*
          * List of unpaid invoices
          */


Index: /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement/class/paiement.class.php
===================================================================
--- /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement/class/paiement.class.php	(révision 8)
+++ /home/aurelien/www/dev/dolibarr/dolibarr_311/trunk/htdocs/compta/paiement/class/paiement.class.php	(copie de travail)
@@ -383,6 +383,7 @@
             if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility
             if ($mode == 'payment') $totalamount=$totalamount;
             if ($mode == 'payment_supplier') $totalamount=-$totalamount;
+            if ($mode == 'payment_avoir') $totalamount=-abs($totalamount);
 
             // Insert payment into llx_bank
             $bank_line_id = $acc->addline($this->datepaye,
@@ -410,7 +411,7 @@
                 if ( ! $error)
                 {
                     $url='';
-                    if ($mode == 'payment') $url=DOL_URL_ROOT.'/compta/paiement/fiche.php?id=';
+                    if ($mode == 'payment' || $mode == 'payment_avoir') $url=DOL_URL_ROOT.'/compta/paiement/fiche.php?id=';
                     if ($mode == 'payment_supplier') $url=DOL_URL_ROOT.'/fourn/paiement/fiche.php?id=';
                     if ($url)
                     {
@@ -429,7 +430,7 @@
                     $linkaddedforthirdparty=array();
                     foreach ($this->amounts as $key => $value)  // We should have always same third party but we loop in case of.
                     {
-                        if ($mode == 'payment')
+                        if ($mode == 'payment' || $mode == 'payment_avoir')
                         {
                             $fac = new Facture($this->db);
                             $fac->fetch($key);
_______________________________________________
Dolibarr-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-user

Répondre à