Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.4' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/compta/facture.php
	htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
	htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
	htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
  • Loading branch information
eldy committed Sep 22, 2013
2 parents 44d2fbc + c2ba795 commit b57ed72
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion htdocs/compta/bank/fiche.php
Expand Up @@ -71,7 +71,7 @@

$account->currency_code = trim($_POST["account_currency_code"]);

$account->state_id = $_POST["account_departement_id"];
$account->state_id = $_POST["account_state_id"];
$account->country_id = $_POST["account_country_id"];

$account->min_allowed = $_POST["account_min_allowed"];
Expand Down
80 changes: 44 additions & 36 deletions htdocs/compta/facture.php
Expand Up @@ -875,34 +875,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 @@ -1585,7 +1590,7 @@

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

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

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

/*
* Generate document
*/
*/
else if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
Expand Down Expand Up @@ -2019,7 +2024,7 @@
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;

//Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options=$objectsrc->array_options;
Expand Down Expand Up @@ -2058,8 +2063,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 @@ -2076,7 +2080,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 @@ -2183,10 +2187,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') || ($origin=='commande')) {
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') || ($origin=='commande'))
{
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 @@ -2455,6 +2462,7 @@
print '</table>';
}

print '<br>';
}
else if ($id > 0 || ! empty($ref))
{
Expand Down Expand Up @@ -3722,24 +3730,24 @@

if (empty($somethingshown) && $object->statut > 0)
{

print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';

print '<div id="commande" style="display:none">';
{

$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';

$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;


print_titre($langs->trans("LinkedOrder"));
print '<table><tr class="liste_titre">';
print '<td class="nowrap"></td>';
Expand All @@ -3762,30 +3770,30 @@
print '<td>'.$objp->ref_client.'</td>';
print '<td>'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</td>';
print '</td>';
}
$i++;

$i++;
}
print '</table>';
print '</br>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans('OK').'"></center>';


print '</form>';
}
else
{
dol_print_error($db);
}
}
$result=$object->add_object_linked('commande',$_POST['linkedOrder']);
if($result>0)
{
echo '<meta http-equiv="refresh" content="0;URL=facture.php?facid='.$object->id.'">';
}
}
print '</div>';

print '</div>';
}
// Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0)
Expand Down Expand Up @@ -3944,7 +3952,7 @@

function lier_commande(commande)
{

if(commande.style.display=='none')
{
commande.style.display='inline';
Expand Down
Expand Up @@ -377,7 +377,7 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
if (! empty($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
Expand Down Expand Up @@ -470,8 +470,8 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}

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

$pdf->Close();
Expand Down Expand Up @@ -963,7 +963,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
}

$posy+=2;
$pdf->SetFont('','', $default_font_size -1);

Expand Down

0 comments on commit b57ed72

Please sign in to comment.