Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/contrat/card.php
	htdocs/core/class/html.form.class.php
	htdocs/product/stock/card.php
This commit is contained in:
Laurent Destailleur 2014-12-14 12:35:13 +01:00
commit 711b033844
36 changed files with 386 additions and 288 deletions

View File

@ -1,20 +1,20 @@
#!/usr/bin/php
<?php
/* Copyright (C) 2014 by FromDual GmbH, licensed under GPL v2
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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/>.
*
* -----
*
@ -270,8 +270,8 @@ foreach($filesToProcess as $fileToProcess)
print "Output can be found at $output.\n";
print "To rename all .delta files, you can do\n";
print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
print "To rename all .delta files, you can do\n";
print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
}

View File

@ -182,30 +182,15 @@ else if ($action == 'setmod')
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
}
else if ($action == 'set_CONTRACT_FREE_TEXT')
else if ($action == 'set_other')
{
$freetext= GETPOST('CONTRACT_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
$res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
else if ($action == 'set_CONTRACT_DRAFT_WATERMARK')
{
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha');
$res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $res1 > 0 || ! $res2 > 0) $error++;
if (! $error)
{
@ -217,6 +202,7 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK')
}
}
/*
* View
*/
@ -506,44 +492,43 @@ print "<br>";
*
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$var=true;
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_CONTRACT_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="CONTRACT_FREE_TEXT" class="flat" cols="120">'.$conf->global->CONTRACT_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</td></tr>'."\n";
print '</form>';
//Use draft Watermark
$var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_CONTRACT_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftContractCards").'<br>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</td></tr>'."\n";
print '</table>';
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
dol_fiche_end();
$db->close();
llxFooter();
$db->close();

View File

@ -525,6 +525,13 @@ else
print '<td><a href="'.$url.'" target="_blank">'.$url.'</a></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">\n";
$url='http://partners.dolibarr.org';
print '<td align="left"><a href="'.$url.'" target="_blank"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
print '<td><a href="'.$url.'" target="_blank">'.$url.'</a></td>';
print '</tr>';
print "</table>\n";
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
*
@ -153,7 +153,7 @@ print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEME
print '</td></tr>';
// ICS
print '<tr class="impair"><td>'.$langs->trans("ICS").'</td>';
print '<tr class="pair"><td>'.$langs->trans("ICS").'</td>';
print '<td align="left">';
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="9" ></td>';
print '</td></tr>';

View File

@ -905,7 +905,7 @@ if ($id > 0)
}
// Assigned to
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
print '<tr><td class="nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
$listofuserid=array();
if (empty($donotclearsession))
{
@ -1077,7 +1077,7 @@ if ($id > 0)
}
// Assigned to
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
$listofuserid=array();
if (empty($donotclearsession))
{

View File

@ -2837,6 +2837,8 @@ class Facture extends CommonInvoice
*/
function demande_prelevement($user)
{
$error=0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > 0 && $this->paye == 0)
@ -2882,21 +2884,32 @@ class Facture extends CommonInvoice
$sql .= ",'".$bac->cle_rib."')";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->db->query($sql))
$resql=$this->db->query($sql);
if (! $resql)
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
return -1;
$error++;
}
if (! $error)
{
// Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement');
if ($payment_mode_id > 0)
{
$result=$this->setPaymentMethods($payment_mode_id);
}
}
if ($error) return -1;
return 1;
}
else
{
$this->error="A request already exists";
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
return 0;
}
}
else

View File

@ -58,6 +58,7 @@ if ($id > 0 || ! empty($ref))
}
}
/*
* Actions
*/
@ -69,14 +70,14 @@ if ($action == "new")
$result = $object->demande_prelevement($user);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
setEventMessage($langs->trans("RecordSaved"));
}
else
{
setEventMessage($object->error, 'errors');
}
}
$action='';
}
if ($action == "delete")
@ -307,6 +308,31 @@ if ($object->id > 0)
print '</td>';
print '</tr>';
// Conditions de reglement
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
{
if ($action == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
// Date payment term
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -333,32 +359,7 @@ if ($object->id > 0)
}
print '</td></tr>';
// Conditions de reglement
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE)
{
if ($action == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
}
}
else
{
print '&nbsp;';
}
print '</td></tr>';
// Mode de reglement
// Payment mode
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
@ -376,6 +377,26 @@ if ($object->id > 0)
}
print '</td></tr>';
// Bank Account
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editbankaccount')
{
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
}
else
{
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
// Montants
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';

View File

@ -56,7 +56,9 @@ class BonPrelevement extends CommonObject
var $statut; // 0-Wait, 1-Trans, 2-Done
var $labelstatut=array();
var $invoice_in_error=array();
/**
* Constructor
*
@ -835,7 +837,7 @@ class BonPrelevement extends CommonObject
else
{
dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->name;
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
}
}
else
@ -1814,21 +1816,21 @@ class BonPrelevement extends CommonObject
if ($mode == 1)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 3)
{
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
}

View File

@ -138,20 +138,20 @@ class LignePrelevement
if ($mode == 1)
{
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1');
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8');
}
if ($mode == 3)
{
if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1');
if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8');
}

View File

@ -70,6 +70,10 @@ if ($action == 'create')
if ($result == 0)
{
$mesg='<div class="error">'.$langs->trans("NoInvoiceCouldBeWithdrawed").'</div>';
foreach($bprev->invoice_in_error as $key => $val)
{
$mesg.=$val."<br>\n";
}
}
}
@ -179,6 +183,7 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Invoice").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("RIB").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("DateRequest").'</td>';
print '</tr>';
@ -190,16 +195,22 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<tr '.$bc[$var].'>';
print '<td>';
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';
// Thirdparty
print '<td>';
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
print $thirdpartystatic->getNomUrl(1,'customer');
$thirdpartystatic->fetch($obj->socid);
print $thirdpartystatic->getNomUrl(1,'card');
print '</td>';
// RIB
print '<td>';
print $thirdpartystatic->display_rib();
print '</td>';
// Amount
print '<td align="right">';
print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency);
print '</td>';
@ -211,7 +222,7 @@ if ($resql)
$i++;
}
}
else print '<tr><td colspan="4">'.$langs->trans("None").'</td></tr>';
else print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
print "</table>";
print "<br>\n";
}

View File

@ -106,7 +106,6 @@ if ($prev_id)
/*
* Stats
*
*/
$ligne=new LignePrelevement($db,$user);
@ -121,6 +120,8 @@ if ($prev_id)
$num = $db->num_rows($resql);
$i = 0;
print_fiche_titre($langs->trans("StatisticsByLineStatus"),'','');
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';

View File

@ -134,7 +134,7 @@ if ($id)
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print '<a href="card.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>';
print $bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut,1).'</td></tr>';

View File

@ -124,8 +124,6 @@ $pagenext = $page + 1;
/*
* Liste des lignes de prelevement
*
*
*/
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom as name";
@ -175,7 +173,11 @@ if ($result)
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
$thirdparty=new Societe($db);
$thirdparty->fetch($obj->socid);
print '<td>';
print $thirdparty->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.price($obj->amount)."</td>\n";

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/compta/prelevement/stats.php
* \ingroup prelevement
* \brief Page de stats des prelevements
* \brief Page with statistics on withdrawals
*/
require('../../main.inc.php');
@ -96,7 +96,7 @@ if ($resql)
print '<td width="30%">'.$langs->trans("Status").'</td><td align="center">'.$langs->trans("Number").'</td><td align="right">%</td>';
print '<td align="right">'.$langs->trans("Amount").'</td><td align="right">%</td></tr>';
$var=True;
$var=false;
while ($i < $num)
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
@ -273,7 +273,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
{
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
if ($product_type == 1) { //only services // TODO Exclude also deee
if ($product_type == 1 || (! empty($conf->global->CONTRACT_SUPPORT_PRODUCTS) && in_array($product_type, array(0,1)))) { // TODO Exclude also deee
// service prédéfini
if ($lines[$i]->fk_product > 0)
{
@ -538,7 +538,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
}
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
@ -847,7 +847,7 @@ $formfile = new FormFile($db);
$objectlignestatic=new ContratLigne($db);
// Load object modContract
$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive');
$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis');
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
@ -1020,13 +1020,18 @@ if ($action == 'create')
print "</table>\n";
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
if (is_object($objectsrc))
{
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
}
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))
{
print '<br>'.$langs->trans("Note").': '.$langs->trans("OnlyLinesWithTypeServiceAreUsed");
}
}
print "</form>\n";
@ -1043,6 +1048,8 @@ else
if ($object->id > 0)
{
$object->fetch_thirdparty();
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
if ($result < 0) dol_print_error($db,$object->error);

View File

@ -837,7 +837,7 @@ class Form
});
</script>';
}
if (count($events)) // Add management of event
{
$out.='<script type="text/javascript">
@ -1355,7 +1355,7 @@ class Form
$out.= '<option value="">'.$langs->trans("None").'</option>';
}
$out.= '</select>';
$out.= '<script type="text/javascript">
$(document).ready(function() {
@ -1701,6 +1701,8 @@ class Form
$outqty=1;
$outdiscount=0;
$maxlengtharticle=(empty($conf->global->PRODUCT_MAX_LENGTH_COMBO)?48:$conf->global->PRODUCT_MAX_LENGTH_COMBO);
$label=$objp->label;
if (! empty($objp->label_translated)) $label=$objp->label_translated;
if (! empty($filterkey) && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
@ -1720,11 +1722,11 @@ class Form
else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
}
$opt.= '>';
$opt.= $objp->ref.' - '.dol_trunc($label, 99, '', '', 1).' - ';
$opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - ';
$objRef = $objp->ref;
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
$outval.=$objRef.' - '.dol_trunc($label, 99, '', '', 1).' - ';
$outval.=$objRef.' - '.dol_trunc($label,$maxlengtharticle).' - ';
$found=0;

View File

@ -856,7 +856,7 @@ class FormFile
}
if ($nboffiles == 0)
{
print '<tr '.$bc[$var].'><td colspan="'.(empty($useinecm)?'5':'4').'">';
print '<tr '.$bc[false].'><td colspan="'.(empty($useinecm)?'5':'4').'">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
print '</td></tr>';
@ -1044,7 +1044,7 @@ class FormFile
if (count($filearray) == 0)
{
print '<tr '.$bc[$var].'><td colspan="4">';
print '<tr '.$bc[false].'><td colspan="4">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
print '</td></tr>';
@ -1211,7 +1211,7 @@ class FormFile
}
if ($nboflinks == 0)
{
print '<tr ' . $bc[$var] . '><td colspan="5">';
print '<tr ' . $bc[false] . '><td colspan="5">';
print $langs->trans("NoLinkFound");
print '</td></tr>';
}

View File

@ -492,7 +492,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
* @param int $curx X
* @param int $cury Y
* @param Account $account Bank account object
* @param int $onlynumber Output only number
* @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation)
* @param int $default_font_size Default font size
* @return float The Y PDF position
*/
@ -513,10 +513,14 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$outputlangs->load("banks");
// Use correct name of bank id according to country
$bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// Get format of bank account according to its country
$usedetailedbban=$account->useDetailedBBAN();
//$onlynumber=0; $usedetailedbban=0; // For tests
$onlynumber=0; $usedetailedbban=1; // For tests
if ($usedetailedbban)
{
$savcurx=$curx;
@ -529,27 +533,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$cury+=3;
}
// Use correct name of bank id according to country
$ibankey="IBANNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if (! empty($account->iban))
{
$ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban);
$ibanDisplay = "";
for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++){
$ibanDisplay .= $ibanDisplay_temp[$i];
if($i%4 == 3 && $i > 0){
$ibanDisplay .= " ";
}
}
$pdf->SetFont('','B',$default_font_size - 3);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0);
$cury+=3;
}
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8);
if ($usedetailedbban == 1)
@ -612,7 +595,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
}
$curx=$savcurx;
$cury+=10;
$cury+=9;
}
else
{
@ -629,10 +612,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
if ($diffsizecontent <= 2) $cury+=1;
}
// Use correct name of bank id according to country
$bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
$pdf->SetFont('','',$default_font_size - $diffsizecontent);
if (empty($onlynumber) && ! empty($account->domiciliation))
@ -647,8 +626,29 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
}
else if (! $usedetailedbban) $cury+=1;
// Use correct name of bank id according to country
$ibankey="IBANNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if (! empty($account->iban))
{
$ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban);
$ibanDisplay = "";
for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++)
{
$ibanDisplay .= $ibanDisplay_temp[$i];
if($i%4 == 3 && $i > 0) $ibanDisplay .= " ";
}
$pdf->SetFont('','B',$default_font_size - 3);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0);
$cury+=3;
}
if (! empty($account->bic))
{
$pdf->SetFont('','B',$default_font_size - 3);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
}

View File

@ -49,7 +49,7 @@ class modProductBatch extends DolibarrModules
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Batch number, eat-by and sell-by date management module";
$this->rights_class = 'stock';
$this->rights_class = 'productbatch';
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'experimental';
// Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase)

View File

@ -73,7 +73,7 @@ $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["
if ($action == 'create') {
if (is_array($selected) == false) {
$mesgs = array (
'<div class="error">' . $langs->trans('Error_OrderNotChecked') . '</div>'
'<div class="error">' . $langs->trans('Error_OrderNotChecked') . '</div>'
);
} else {
$origin = GETPOST('origin');
@ -91,11 +91,11 @@ $hookmanager->initHooks(array('orderstoinvoicesupplier'));
*/
if (($action == 'create' || $action == 'add') && empty($mesgs)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php';
if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$langs->load('bills');
$langs->load('products');
$langs->load('main');
@ -103,7 +103,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$orders_id = $_GET['orders_to_invoice'];
$n = count($orders_id);
$i = 0;
$originid = $orders_id[0];
$_GET['originid'] = $orders_id[0];
}
@ -111,30 +111,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$orders_id = $_POST['orders_to_invoice'];
$nn = count($orders_id);
$ii = 0;
$originid = $orders_id[0];
$_POST['originid'] = $orders_id[0];
}
$projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0;
$lineid = GETPOST('lineid', 'int');
$userid = GETPOST('userid', 'int');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref');
// Security check
if ($user->societe_id)
$socid = $user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$object = new FactureFournisseur($db);
// Insert new invoice in database
if ($action == 'add' && $user->rights->fournisseur->facture->creer) {
$object->socid = GETPOST('socid');
$db->begin();
$error = 0;
// Standard or deposit or proforma invoice
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) {
@ -154,17 +154,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$projectid = GETPOST('projectid');
if ($projectid > 0)
$object->fk_project = $projectid;
// Auto calculation of date due if not filled by user
if (empty($object->date_echeance))
$object->date_echeance = $object->calculate_date_lim_reglement();
if ($_POST['origin'] && $_POST['originid']) {
$object->origin = $_POST['origin'];
$object->origin_id = $orders_id[$ii];
$object->linked_objects = $orders_id;
$id = $object->create($user);
if ($id > 0) {
foreach ( $orders_id as $origin => $origin_id ) {
$origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id);
@ -180,14 +180,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$sql .= ", " . $id;
$sql .= ", '" . $object->element . "'";
$sql .= ")";
if ($db->query($sql)) {
$db->commit();
} else {
$db->rollback();
}
}
while ( $ii < $nn ) {
$objectsrc = new CommandeFournisseur($db);
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
@ -202,10 +202,10 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$num = count($lines);
for($i = 0; $i < $num; $i ++) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Dates
// TODO mutualiser
$date_start = $lines[$i]->date_debut_prevue;
@ -218,14 +218,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type);
if ($result > 0) {
$lineid = $result;
} else {
@ -250,11 +250,11 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
}
}
}
// End of object creation, we show it
if ($id > 0 && ! $error) {
$db->commit();
header('Location: ' . DOL_URL_ROOT . '/fourn/facture/fiche.php?facid=' . $id);
header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id);
exit();
} else {
$db->rollback();
@ -277,10 +277,10 @@ $companystatic = new Societe($db);
// Mode creation
if ($action == 'create' && empty($mesgs)) {
llxHeader();
print_fiche_titre($langs->trans('NewBill'));
$soc = new Societe($db);
if ($socid)
$res = $soc->fetch($socid);
@ -289,7 +289,7 @@ if ($action == 'create' && empty($mesgs)) {
$mode_reglement_id = $soc->mode_reglement_id;
}
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : '';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
@ -300,21 +300,21 @@ if ($action == 'create' && empty($mesgs)) {
print '<input type="hidden" name="origin" value="' . GETPOST('origin') . '">';
print '<input type="hidden" name="originid" value="' . GETPOST('originid') . '">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
// Ref supplier
print '<tr><td class="fieldrequired">' . $langs->trans('RefSupplier') . '</td><td><input name="ref_supplier" value="' . (isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : '') . '" type="text"></td>';
print '</tr>';
// Third party
print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td><td colspan="2">';
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
print '</td>';
print '</tr>' . "\n";
// Date invoice
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$html->select_date('', '', '', '', '', "add", 1, 1);
@ -330,13 +330,13 @@ if ($action == 'create' && empty($mesgs)) {
// Project
if (! empty($conf->projet->enabled)) {
$formproject = new FormProjets($db);
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects($soc->id, $projectid, 'projectid');
print '</td></tr>';
}
$objectsrc = new CommandeFournisseur($db);
$listoforders = array ();
foreach ( $selected as $sel ) {
@ -345,30 +345,30 @@ if ($action == 'create' && empty($mesgs)) {
$listoforders[] = $objectsrc->ref;
}
}
// Other attributes
$parameters = array (
'objectsrc' => $objectsrc,
'idsrc' => $listoforders,
'colspan' => ' colspan="3"'
'colspan' => ' colspan="3"'
);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// Modele PDF
print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>';
$liste = ModelePDFSuppliersInvoices::liste_modeles($db);
print $html->selectarray('model', $liste, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
print "</td></tr>";
// Public note
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note_public" wrap="soft" cols="70" rows="' . ROWS_3 . '">';
print $langs->trans("Orders") . ": " . implode(', ', $listoforders);
print '</textarea></td></tr>';
// Private note
if (empty($user->societe_id)) {
@ -376,22 +376,22 @@ if ($action == 'create' && empty($mesgs)) {
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note" wrap="soft" cols="70" rows="' . ROWS_3 . '">';
print '</textarea></td></tr>';
}
print '</table>';
while ( $i < $n ) {
print '<input type="hidden" name="orders_to_invoice[]" value="' . $orders_id[$i] . '">';
$i ++;
}
// Button "Create Draft"
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '" /></div>';
print "</form>\n";
print '</td></tr>';
print "</table>\n";
}
@ -411,7 +411,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
});
</script>
<?php
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
$sql .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s';
@ -420,13 +420,13 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql .= ' WHERE c.entity = ' . $conf->entity;
$sql .= ' AND c.fk_soc = s.rowid';
// Show orders with status validated, shipping started and delivered (well any order we can bill)
$sql .= " AND c.fk_statut IN (5)";
// Find order that are not already invoiced
$sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
if ($socid)
$sql .= ' AND s.rowid = ' . $socid;
if (! $user->rights->societe->client->voir && ! $socid)
@ -437,20 +437,20 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
if ($sall) {
$sql .= " AND (c.ref LIKE '%" . $db->escape($sall) . "%' OR c.note LIKE '%" . $db->escape($sall) . "%')";
}
// Date filter
if ($date_start && $date_end)
$sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'";
if ($date_starty && $date_endy)
$sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'";
if (! empty($sref_client)) {
$sql .= ' AND c.ref_supplier LIKE \'%' . $db->escape($sref_client) . '%\'';
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
dol_syslog('fourn/commande/ordertoinvoice.php sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
if ($socid) {
$soc = new Societe($db);
@ -463,14 +463,14 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
$i = 0;
$period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
$periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1);
if (! empty($socid)) {
// Company
$companystatic->id = $socid;
$companystatic->nom = $soc->nom;
print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&amp;socid=' . $socid, '', $sortfield, $sortorder);
@ -480,7 +480,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
print_liste_field_titre($langs->trans('Status'), '', '', '', '', 'align="right"');
print_liste_field_titre($langs->trans('GenerateBill'), '', '', '', '', 'align="center"');
print '</tr>';
// Lignes des champs de filtre
print '<form method="get" action="orderstoinvoice.php">';
print '<input type="hidden" name="socid" value="' . $socid . '">';
@ -492,48 +492,48 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
// print '<td class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="sref_client" value="' . $sref_client . '">';
// DATE ORDER
print '<td class="liste_titre" align="center">';
print $period;
print '</td>';
// DATE DELIVERY
print '<td class="liste_titre" align="center">';
print $periodely;
print '</td>';
// SEARCH BUTTON
print '</td><td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
// ALL/NONE
print '<td class="liste_titre" align="center">';
if ($conf->use_javascript_ajax)
print '<a href="#" id="checkall">' . $langs->trans("All") . '</a> / <a href="#" id="checknone">' . $langs->trans("None") . '</a>';
print '</td>';
print '</td></tr>';
print '</form>';
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
$var = True;
$generic_commande = new CommandeFournisseur($db);
while ( $i < $num ) {
$objp = $db->fetch_object($resql);
$var = ! $var;
print '<tr ' . $bc[$var] . '>';
print '<td class="nowrap">';
$generic_commande->id = $objp->rowid;
$generic_commande->ref = $objp->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $generic_commande->getNomUrl(1, $objp->fk_statut);
print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename = dol_sanitizeFileName($objp->ref);
$filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
@ -541,35 +541,35 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
print '</td></tr></table>';
print '</td>';
print '<td>' . $objp->ref_supplier . '</td>';
// Order date
print '<td align="center" nowrap>';
print dol_print_date($db->jdate($objp->date_commande), 'day');
print '</td>';
// Delivery date
print '<td align="center" nowrap>';
print dol_print_date($db->jdate($objp->date_livraison), 'day');
print '</td>';
// Statut
print '<td align="right" class="nowrap">' . $generic_commande->LibStatut($objp->fk_statut, 5) . '</td>';
// Checkbox
print '<td class="center">';
print '<input class="flat checkformerge" type="checkbox" name="orders_to_invoice[]" value="' . $objp->rowid . '">';
print '</td>';
print '</tr>';
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
$i ++;
}
print '</table>';
/*
* Boutons actions
*/

View File

@ -33,7 +33,7 @@ create table llx_entrepot
fk_departement integer,
fk_pays integer DEFAULT 0,
statut tinyint DEFAULT 1, -- 1 open, 0 close
valo_pmp float(12,4), -- valoristaion du stock en PMP
valo_pmp float(12,4), -- PMP value for this warehouse (deprecated. No sens for a warehouse)
fk_user_author integer,
import_key varchar(14)
)ENGINE=innodb;

View File

@ -25,7 +25,7 @@ create table llx_product_stock
fk_product integer NOT NULL,
fk_entrepot integer NOT NULL,
reel real, -- physical stock
pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse
pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse (deprecated. no sens for warehouse)
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -210,6 +210,7 @@ ModulesJobDesc=Business modules provide simple predefined setup of Dolibarr for
ModulesMarketPlaceDesc=You can find more modules to download on external web sites on the Internet...
ModulesMarketPlaces=More modules...
DoliStoreDesc=DoliStore, the official market place for Dolibarr ERP/CRM external modules
DoliPartnersDesc=List with some companies that can provide/develop on-demand modules or features (Note: any Open Source company knowning PHP language can provide you specific development)
WebSiteDesc=Web site providers you can search to find more modules...
URL=Link
BoxesAvailable=Boxes available
@ -446,7 +447,7 @@ Module55Desc=Barcode management
Module56Name=Telephony
Module56Desc=Telephony integration
Module57Name=Standing orders
Module57Desc=Standing orders and withdrawal management
Module57Desc=Standing orders and withdrawal management. Also includes generation of SEPA file for european countries.
Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u

View File

@ -29,6 +29,7 @@ ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by
ActionsForUser=Events for user
ActionsForUsersGroup=Events for all users of group
ActionAssignedTo=Event assigned to
AllMyActions= All my events/tasks
AllActions= All events/tasks
ViewList=List view

View File

@ -91,6 +91,7 @@ ListOfServicesToExpire=List of Services to expire
NoteListOfYourExpiredServices=This list contains only services of contracts for third parties you are linked to as a sale representative.
StandardContractsTemplate=Standard contracts template
ContactNameAndSignature=For %s, name and signature:
OnlyLinesWithTypeServiceAreUsed=Only lines with type "Service" will be cloned.
##### Types de contacts #####
TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract

View File

@ -79,10 +79,11 @@ CreditDate=Credit on
WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported)
ShowWithdraw=Show Withdraw
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management.
DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once it is complete, you can type the payment to close the invoice.
DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once donee, go into menu Bank->Withdrawal to manage the standing order. When standing order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid"
StatisticsByLineStatus=Statistics by status of lines
### Notifications
InfoCreditSubject=Payment of standing order %s by the bank

View File

@ -29,6 +29,7 @@ ActionsToDoBy=Événements affectés à
ActionsDoneBy=Événements réalisés par
ActionsForUser=Evénements de l'utilisateur
ActionsForUsersGroup=Evénements de tous les utilisateurs du groupe
ActionAssignedTo=Événement assigné à
AllMyActions= Tous mes événements
AllActions= Tous les événements
ViewList=Vue liste

View File

@ -73,13 +73,13 @@ if ($action == 'add' && $user->rights->stock->creer)
$object->town = GETPOST("town");
$object->country_id = GETPOST("country_id");
if (! empty($object->libelle))
if (! empty($object->libelle))
{
$id = $object->create($user);
if ($id > 0)
{
setEventMessage($langs->trans("RecordSaved"));
if (! empty($backtopage))
{
header("Location: ".$backtopage);
@ -180,9 +180,9 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head();
print '<table class="border" width="100%">';
// Ref
@ -225,7 +225,7 @@ if ($action == 'create')
print '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
print '</form>';
@ -445,10 +445,10 @@ else
$totalunit+=$objp->value;
// Price buy PMP
print '<td align="right">'.price(price2num($objp->pmp,'MU')).'</td>';
print '<td align="right">'.price(price2num($objp->ppmp,'MU')).'</td>';
// Total PMP
print '<td align="right">'.price(price2num($objp->pmp*$objp->value,'MT')).'</td>';
$totalvalue+=price2num($objp->pmp*$objp->value,'MT');
print '<td align="right">'.price(price2num($objp->ppmp*$objp->value,'MT')).'</td>';
$totalvalue+=price2num($objp->ppmp*$objp->value,'MT');
// Price sell min
if (empty($conf->global->PRODUIT_MULTIPRICES))

View File

@ -163,21 +163,40 @@ class MouvementStock extends CommonObject
{
$newpmp=0;
$newpmpwarehouse=0;
// Note: PMP is calculated on stock input only (type = 0 or 3). If type == 0 or 3, qty should be > 0.
// Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0.
// Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input)
if (($type == 0 || $type == 3) && $price > 0)
{
// If we will change PMP for the warehouse we edit and the product, we must first check/clean that PMP is defined
// on every stock entry with old value (so global updated value will match recalculated value from product_stock)
$sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET pmp = ".($oldpmp?$oldpmp:'0');
$sql.= " WHERE pmp = 0 AND fk_product = ".$fk_product;
dol_syslog(get_class($this)."::_create", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$error = -4;
}
$oldqtytouse=($oldqty >= 0?$oldqty:0);
// We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined
if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
else $newpmp=$price;
$oldqtywarehousetouse=($oldqtywarehouse >= 0?$oldqtywarehouse:0);
else
{
$newpmp=$price; // For this product, PMP was not yet set. We will set it later.
}
$oldqtywarehousetouse=$oldqtywarehouse;
if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU');
else $newpmpwarehouse=$price;
//print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
//print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
//exit;
/*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
exit;*/
}
else if ($type == 1 || $type == 2)
{
// After a stock decrease, we don't change value of PMP for product.
}
else
{
@ -207,14 +226,17 @@ class MouvementStock extends CommonObject
{
$this->error=$this->db->lasterror();
$error = -3;
} else if(empty($fk_product_stock)){
}
else if(empty($fk_product_stock))
{
$fk_product_stock = $this->db->last_insert_id(MAIN_DB_PREFIX."product_stock");
}
}
}
// Update detail stock for sell-by date
if (($product->hasbatch()) && (! $error) && (! $skip_sellby)){
if (($product->hasbatch()) && (! $error) && (! $skip_sellby))
{
$param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby,'sellby'=>$sellby,'batchnumber'=>$batch);
$result=$this->_create_batch($param_batch, $qty);
if ($result<0) $error++;
@ -245,7 +267,6 @@ class MouvementStock extends CommonObject
if ($movestock && ! $error)
{
$this->product_id = $fk_product;
$this->entrepot_id = $entrepot_id;
$this->qty = $qty;

View File

@ -52,7 +52,7 @@ $year = strftime("%Y",time());
*/
$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";

View File

@ -122,10 +122,11 @@ if ($action == "correct_stock" && ! $cancel)
if (is_numeric(GETPOST("nbpiece")) && $id)
{
if (empty($product)) {
$product = new Product($db);
$result=$product->fetch($id);
$product = new Product($db);
$result=$product->fetch($id);
}
if ($product->hasbatch()) {
if ($product->hasbatch())
{
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$result=$product->correct_stock_batch(
@ -139,15 +140,17 @@ if ($action == "correct_stock" && ! $cancel)
$d_sellby,
GETPOST('batch_number')
); // We do not change value of stock for a correction
} else {
$result=$product->correct_stock(
$user,
GETPOST("id_entrepot"),
GETPOST("nbpiece"),
GETPOST("mouvement"),
GETPOST("label"),
$priceunit
); // We do not change value of stock for a correction
}
else
{
$result=$product->correct_stock(
$user,
GETPOST("id_entrepot"),
GETPOST("nbpiece"),
GETPOST("mouvement"),
GETPOST("label"),
$priceunit
); // We do not change value of stock for a correction
}
if ($result > 0)
@ -636,9 +639,9 @@ if ($resql)
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>';
// PMP
print '<td align="right">'.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').'</td>'; // Ditto : Show PMP from movement or from product
print '<td align="right">'.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').'</td>'; // Ditto : Show PMP from movement or from product
// Value purchase
print '<td align="right">'.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').'</td>'; // Ditto : Show PMP from movement or from product
print '<td align="right">'.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').'</td>'; // Ditto : Show PMP from movement or from product
// Sell price
print '<td align="right">';
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1);
@ -650,15 +653,15 @@ if ($resql)
else print $langs->trans("Variable");
print '</tr>'; ;
$total += $obj->reel;
if (price2num($obj->pmp)) $totalwithpmp += $obj->reel;
$totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
$totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
if (price2num($product->pmp)) $totalwithpmp += $obj->reel;
$totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product
$totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product
//Batch Detail
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
{
$details=Productbatch::findAll($db,$obj->product_stock_id);
if ($details<0) dol_print_error($db);
foreach ($details as $pdluo)
foreach ($details as $pdluo)
{
print "\n".'<tr><td></td>';
print '<td align="right">'.$pdluo->batch.'</td>';
@ -673,14 +676,15 @@ if ($resql)
}
}
else dol_print_error($db);
print '<tr class="liste_total"><td align="right" class="liste_total" colspan="4">'.$langs->trans("Total").':</td>';
print '<td class="liste_total" align="right">'.$total.'</td>';
print '<td class="liste_total" align="right">';
print ($totalwithpmp?price($totalvalue/$totalwithpmp):'&nbsp;');
print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):'&nbsp;'); // This value may have rounding errors
print '</td>';
// Value purchase
print '<td class="liste_total" align="right">';
print price(price2num($totalvalue,'MT'),1);
print $totalvalue?price(price2num($totalvalue,'MT'),1):'&nbsp;';
print '</td>';
print '<td class="liste_total" align="right">';
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):'&nbsp;');

View File

@ -791,7 +791,7 @@ class Task extends CommonObject
{
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
$sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'";
$sql.= ", progress = " . $this->progress;
if (isset($this->progress)) $sql.= ", progress = " . $this->progress; // Do not overwrite value if not provided
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);
@ -803,7 +803,7 @@ class Task extends CommonObject
}
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time";
$sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")";
$sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user
$sql.= " WHERE rowid = ".$tasktime_id;
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
*
@ -185,6 +185,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
}
}
/*
* View
*/
@ -317,8 +318,13 @@ if ($socid && $action != 'edit' && $action != "create")
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
}
print "<br />";
print "<br>";
/*
* List of bank accounts
*/
print_titre($langs->trans("AllRIB"));
$rib_list = $soc->get_all_rib();
@ -339,7 +345,7 @@ if ($socid && $action != 'edit' && $action != "create")
foreach ($rib_list as $rib)
{
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
// Label
print '<td>'.$rib->label.'</td>';
// Bank name
@ -382,7 +388,7 @@ if ($socid && $action != 'edit' && $action != "create")
}
if (count($rib_list) == 0) {
print '<tr><td colspan="5" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
print '<tr '.$bc[0].'><td colspan="7" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
}
print '</table>';
@ -458,7 +464,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
if ($val == 'AccountNumber')
{
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
print '<td class="fieldrequired">'.$langs->trans("BankAccountNumber").'</td>';
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
print '</tr>';
}
@ -475,10 +481,10 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
}
// IBAN
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("IBAN").'</td>';
print '<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';

View File

@ -168,6 +168,10 @@ if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->
$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1));
$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2));
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1));
$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2));
// Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');

View File

@ -1795,7 +1795,7 @@ class User extends CommonObject
$result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin);
if ($withpicto != 2) $result.=' ';
}
$result.=$lien.$this->getFullName($langs,'','',16).$lienfin;
$result.=$lien.$this->getFullName($langs,'','',24).$lienfin;
return $result;
}

View File

@ -114,6 +114,10 @@ if ($result)
print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_societe",$param,"","",$sortfield,$sortorder);
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))
{
print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER['PHP_SELF'],"u.datec",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder);
@ -165,9 +169,20 @@ if ($result)
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1);
}
// Multicompany enabled
else if (! empty($conf->multicompany->enabled))
else if ($obj->ldap_sid)
{
print $langs->trans("DomainUser");
}
else
{
print $langs->trans("InternalUser");
}
print '</td>';
// Multicompany enabled
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))
{
print '<td>';
if (! $obj->entity)
{
print $langs->trans("AllEntities");
@ -181,16 +196,8 @@ if ($result)
print $mc->label;
}
}
print '</td>';
}
else if ($obj->ldap_sid)
{
print $langs->trans("DomainUser");
}
else
{
print $langs->trans("InternalUser");
}
print '</td>';
// Date creation
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datec),"dayhour").'</td>';