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

@ -182,30 +182,15 @@ else if ($action == 'setmod')
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); 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'); $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'); $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 (! $res1 > 0 || ! $res2 > 0) $error++;
if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
@ -217,6 +202,7 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK')
} }
} }
/* /*
* View * 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_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>'; print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$var=! $var; $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 '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')<br>'; 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 '<textarea name="CONTRACT_FREE_TEXT" class="flat" cols="120">'.$conf->global->CONTRACT_FREE_TEXT.'</textarea>';
print '</td><td align="right">'; print '</td></tr>'."\n";
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>'; print '</form>';
//Use draft Watermark //Use draft Watermark
$var=!$var; $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 '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftContractCards").'<br>'; print $langs->trans("WatermarkOnDraftContractCards").'<br>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">'; print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td><td align="right">'; print '</td></tr>'."\n";
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>'; 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(); llxFooter();
$db->close();

View File

@ -525,6 +525,13 @@ else
print '<td><a href="'.$url.'" target="_blank">'.$url.'</a></td>'; print '<td><a href="'.$url.'" target="_blank">'.$url.'</a></td>';
print '</tr>'; 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"; print "</table>\n";
} }

View File

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

View File

@ -905,7 +905,7 @@ if ($id > 0)
} }
// Assigned to // 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(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
@ -1077,7 +1077,7 @@ if ($id > 0)
} }
// Assigned to // 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(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {

View File

@ -2837,6 +2837,8 @@ class Facture extends CommonInvoice
*/ */
function demande_prelevement($user) function demande_prelevement($user)
{ {
$error=0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > 0 && $this->paye == 0) if ($this->statut > 0 && $this->paye == 0)
@ -2882,21 +2884,32 @@ class Facture extends CommonInvoice
$sql .= ",'".$bac->cle_rib."')"; $sql .= ",'".$bac->cle_rib."')";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); 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(); $this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur'); 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 else
{ {
$this->error="A request already exists"; $this->error="A request already exists";
dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
return 0;
} }
} }
else else

View File

@ -58,6 +58,7 @@ if ($id > 0 || ! empty($ref))
} }
} }
/* /*
* Actions * Actions
*/ */
@ -69,14 +70,14 @@ if ($action == "new")
$result = $object->demande_prelevement($user); $result = $object->demande_prelevement($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); setEventMessage($langs->trans("RecordSaved"));
exit;
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
$action='';
} }
if ($action == "delete") if ($action == "delete")
@ -307,6 +308,31 @@ if ($object->id > 0)
print '</td>'; print '</td>';
print '</tr>'; 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 // Date payment term
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -333,32 +359,7 @@ if ($object->id > 0)
} }
print '</td></tr>'; print '</td></tr>';
// Conditions de reglement // Payment mode
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
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
@ -376,6 +377,26 @@ if ($object->id > 0)
} }
print '</td></tr>'; 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 // Montants
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>'; print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';

View File

@ -56,6 +56,8 @@ class BonPrelevement extends CommonObject
var $statut; // 0-Wait, 1-Trans, 2-Done var $statut; // 0-Wait, 1-Trans, 2-Done
var $labelstatut=array(); var $labelstatut=array();
var $invoice_in_error=array();
/** /**
* Constructor * Constructor
@ -835,7 +837,7 @@ class BonPrelevement extends CommonObject
else else
{ {
dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR); 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 else
@ -1814,21 +1816,21 @@ class BonPrelevement extends CommonObject
if ($mode == 1) if ($mode == 1)
{ {
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$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]),'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 ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
} }
if ($mode == 2) if ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) 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 ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0'); 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]),'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'); 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 ($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==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 ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]);
} }
if ($mode == 2) 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==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8');
} }
if ($mode == 3) 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==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'); 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) if ($result == 0)
{ {
$mesg='<div class="error">'.$langs->trans("NoInvoiceCouldBeWithdrawed").'</div>'; $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 '<tr class="liste_titre">';
print '<td>'.$langs->trans("Invoice").'</td>'; print '<td>'.$langs->trans("Invoice").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</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("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("DateRequest").'</td>'; print '<td align="right">'.$langs->trans("DateRequest").'</td>';
print '</tr>'; print '</tr>';
@ -190,16 +195,22 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'>';
print '<td>';
$invoicestatic->id=$obj->rowid; $invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber; $invoicestatic->ref=$obj->facnumber;
print $invoicestatic->getNomUrl(1,'withdraw'); print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>'; print '</td>';
// Thirdparty
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->fetch($obj->socid);
$thirdpartystatic->name=$obj->name; print $thirdpartystatic->getNomUrl(1,'card');
print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>'; print '</td>';
// RIB
print '<td>';
print $thirdpartystatic->display_rib();
print '</td>';
// Amount
print '<td align="right">'; print '<td align="right">';
print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency); print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency);
print '</td>'; print '</td>';
@ -211,7 +222,7 @@ if ($resql)
$i++; $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 "</table>";
print "<br>\n"; print "<br>\n";
} }

View File

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

View File

@ -134,7 +134,7 @@ if ($id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalsReceipts").'</td><td>'; 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("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("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>'; 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 * Liste des lignes de prelevement
*
*
*/ */
$sql = "SELECT pl.rowid, pl.statut, pl.amount"; $sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom as name"; $sql.= ", s.rowid as socid, s.nom as name";
@ -175,7 +173,11 @@ if ($result)
print substr('000000'.$obj->rowid, -6); print substr('000000'.$obj->rowid, -6);
print '</a></td>'; 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"; print '<td align="center">'.price($obj->amount)."</td>\n";

View File

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

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * 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); $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 // service prédéfini
if ($lines[$i]->fk_product > 0) if ($lines[$i]->fk_product > 0)
{ {
@ -847,7 +847,7 @@ $formfile = new FormFile($db);
$objectlignestatic=new ContratLigne($db); $objectlignestatic=new ContratLigne($db);
// Load object modContract // 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') if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php')
{ {
$module = substr($module, 0, dol_strlen($module)-4); $module = substr($module, 0, dol_strlen($module)-4);
@ -1020,13 +1020,18 @@ if ($action == 'create')
print "</table>\n"; print "</table>\n";
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
if (is_object($objectsrc)) if (is_object($objectsrc))
{ {
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">'; print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">'; 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"; print "</form>\n";
@ -1043,6 +1048,8 @@ else
if ($object->id > 0) if ($object->id > 0)
{ {
$object->fetch_thirdparty();
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);

View File

@ -1701,6 +1701,8 @@ class Form
$outqty=1; $outqty=1;
$outdiscount=0; $outdiscount=0;
$maxlengtharticle=(empty($conf->global->PRODUCT_MAX_LENGTH_COMBO)?48:$conf->global->PRODUCT_MAX_LENGTH_COMBO);
$label=$objp->label; $label=$objp->label;
if (! empty($objp->label_translated)) $label=$objp->label_translated; 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); 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"'; else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
} }
$opt.= '>'; $opt.= '>';
$opt.= $objp->ref.' - '.dol_trunc($label, 99, '', '', 1).' - '; $opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - ';
$objRef = $objp->ref; $objRef = $objp->ref;
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1); 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; $found=0;

View File

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

View File

@ -492,7 +492,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
* @param int $curx X * @param int $curx X
* @param int $cury Y * @param int $cury Y
* @param Account $account Bank account object * @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 * @param int $default_font_size Default font size
* @return float The Y PDF position * @return float The Y PDF position
*/ */
@ -513,10 +513,14 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$outputlangs->load("banks"); $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 // Get format of bank account according to its country
$usedetailedbban=$account->useDetailedBBAN(); $usedetailedbban=$account->useDetailedBBAN();
//$onlynumber=0; $usedetailedbban=0; // For tests $onlynumber=0; $usedetailedbban=1; // For tests
if ($usedetailedbban) if ($usedetailedbban)
{ {
$savcurx=$curx; $savcurx=$curx;
@ -529,27 +533,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$cury+=3; $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 (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8);
if ($usedetailedbban == 1) if ($usedetailedbban == 1)
@ -612,7 +595,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
} }
$curx=$savcurx; $curx=$savcurx;
$cury+=10; $cury+=9;
} }
else else
{ {
@ -629,10 +612,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
if ($diffsizecontent <= 2) $cury+=1; 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); $pdf->SetFont('','',$default_font_size - $diffsizecontent);
if (empty($onlynumber) && ! empty($account->domiciliation)) 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; 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)) if (! empty($account->bic))
{ {
$pdf->SetFont('','B',$default_font_size - 3);
$pdf->SetXY($curx, $cury); $pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0); $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->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Batch number, eat-by and sell-by date management module"; $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 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'experimental'; $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) // 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

@ -254,7 +254,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
// End of object creation, we show it // End of object creation, we show it
if ($id > 0 && ! $error) { if ($id > 0 && ! $error) {
$db->commit(); $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(); exit();
} else { } else {
$db->rollback(); $db->rollback();

View File

@ -33,7 +33,7 @@ create table llx_entrepot
fk_departement integer, fk_departement integer,
fk_pays integer DEFAULT 0, fk_pays integer DEFAULT 0,
statut tinyint DEFAULT 1, -- 1 open, 0 close 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, fk_user_author integer,
import_key varchar(14) import_key varchar(14)
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -25,7 +25,7 @@ create table llx_product_stock
fk_product integer NOT NULL, fk_product integer NOT NULL,
fk_entrepot integer NOT NULL, fk_entrepot integer NOT NULL,
reel real, -- physical stock 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 import_key varchar(14) -- Import key
)ENGINE=innodb; )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... ModulesMarketPlaceDesc=You can find more modules to download on external web sites on the Internet...
ModulesMarketPlaces=More modules... ModulesMarketPlaces=More modules...
DoliStoreDesc=DoliStore, the official market place for Dolibarr ERP/CRM external 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... WebSiteDesc=Web site providers you can search to find more modules...
URL=Link URL=Link
BoxesAvailable=Boxes available BoxesAvailable=Boxes available
@ -446,7 +447,7 @@ Module55Desc=Barcode management
Module56Name=Telephony Module56Name=Telephony
Module56Desc=Telephony integration Module56Desc=Telephony integration
Module57Name=Standing orders 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 Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...) Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u Module59Name=Bookmark4u

View File

@ -29,6 +29,7 @@ ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by ActionsDoneBy=Events done by
ActionsForUser=Events for user ActionsForUser=Events for user
ActionsForUsersGroup=Events for all users of group ActionsForUsersGroup=Events for all users of group
ActionAssignedTo=Event assigned to
AllMyActions= All my events/tasks AllMyActions= All my events/tasks
AllActions= All events/tasks AllActions= All events/tasks
ViewList=List view 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. NoteListOfYourExpiredServices=This list contains only services of contracts for third parties you are linked to as a sale representative.
StandardContractsTemplate=Standard contracts template StandardContractsTemplate=Standard contracts template
ContactNameAndSignature=For %s, name and signature: ContactNameAndSignature=For %s, name and signature:
OnlyLinesWithTypeServiceAreUsed=Only lines with type "Service" will be cloned.
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract 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) WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported)
ShowWithdraw=Show Withdraw 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. 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 WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent" SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid" ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid"
StatisticsByLineStatus=Statistics by status of lines
### Notifications ### Notifications
InfoCreditSubject=Payment of standing order %s by the bank 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 ActionsDoneBy=Événements réalisés par
ActionsForUser=Evénements de l'utilisateur ActionsForUser=Evénements de l'utilisateur
ActionsForUsersGroup=Evénements de tous les utilisateurs du groupe ActionsForUsersGroup=Evénements de tous les utilisateurs du groupe
ActionAssignedTo=Événement assigné à
AllMyActions= Tous mes événements AllMyActions= Tous mes événements
AllActions= Tous les événements AllActions= Tous les événements
ViewList=Vue liste ViewList=Vue liste

View File

@ -445,10 +445,10 @@ else
$totalunit+=$objp->value; $totalunit+=$objp->value;
// Price buy PMP // 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 // Total PMP
print '<td align="right">'.price(price2num($objp->pmp*$objp->value,'MT')).'</td>'; print '<td align="right">'.price(price2num($objp->ppmp*$objp->value,'MT')).'</td>';
$totalvalue+=price2num($objp->pmp*$objp->value,'MT'); $totalvalue+=price2num($objp->ppmp*$objp->value,'MT');
// Price sell min // Price sell min
if (empty($conf->global->PRODUIT_MULTIPRICES)) if (empty($conf->global->PRODUIT_MULTIPRICES))

View File

@ -163,21 +163,40 @@ class MouvementStock extends CommonObject
{ {
$newpmp=0; $newpmp=0;
$newpmpwarehouse=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) // Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input)
if (($type == 0 || $type == 3) && $price > 0) 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); $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 // 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'); if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
else $newpmp=$price; else
$oldqtywarehousetouse=($oldqtywarehouse >= 0?$oldqtywarehouse:0); {
$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'); if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU');
else $newpmpwarehouse=$price; else $newpmpwarehouse=$price;
//print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; /*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
//print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
//exit; exit;*/
}
else if ($type == 1 || $type == 2)
{
// After a stock decrease, we don't change value of PMP for product.
} }
else else
{ {
@ -207,14 +226,17 @@ class MouvementStock extends CommonObject
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$error = -3; $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"); $fk_product_stock = $this->db->last_insert_id(MAIN_DB_PREFIX."product_stock");
} }
} }
// Update detail stock for sell-by date // 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); $param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby,'sellby'=>$sellby,'batchnumber'=>$batch);
$result=$this->_create_batch($param_batch, $qty); $result=$this->_create_batch($param_batch, $qty);
if ($result<0) $error++; if ($result<0) $error++;
@ -245,7 +267,6 @@ class MouvementStock extends CommonObject
if ($movestock && ! $error) if ($movestock && ! $error)
{ {
$this->product_id = $fk_product; $this->product_id = $fk_product;
$this->entrepot_id = $entrepot_id; $this->entrepot_id = $entrepot_id;
$this->qty = $qty; $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 = "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.= " 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_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $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 (is_numeric(GETPOST("nbpiece")) && $id)
{ {
if (empty($product)) { if (empty($product)) {
$product = new Product($db); $product = new Product($db);
$result=$product->fetch($id); $result=$product->fetch($id);
} }
if ($product->hasbatch()) { if ($product->hasbatch())
{
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $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']); $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$result=$product->correct_stock_batch( $result=$product->correct_stock_batch(
@ -139,15 +140,17 @@ if ($action == "correct_stock" && ! $cancel)
$d_sellby, $d_sellby,
GETPOST('batch_number') GETPOST('batch_number')
); // We do not change value of stock for a correction ); // We do not change value of stock for a correction
} else { }
$result=$product->correct_stock( else
$user, {
GETPOST("id_entrepot"), $result=$product->correct_stock(
GETPOST("nbpiece"), $user,
GETPOST("mouvement"), GETPOST("id_entrepot"),
GETPOST("label"), GETPOST("nbpiece"),
$priceunit GETPOST("mouvement"),
); // We do not change value of stock for a correction GETPOST("label"),
$priceunit
); // We do not change value of stock for a correction
} }
if ($result > 0) if ($result > 0)
@ -636,9 +639,9 @@ if ($resql)
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>'; print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>'; print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>';
// PMP // 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 // 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 // Sell price
print '<td align="right">'; print '<td align="right">';
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1);
@ -650,9 +653,9 @@ if ($resql)
else print $langs->trans("Variable"); else print $langs->trans("Variable");
print '</tr>'; ; print '</tr>'; ;
$total += $obj->reel; $total += $obj->reel;
if (price2num($obj->pmp)) $totalwithpmp += $obj->reel; if (price2num($product->pmp)) $totalwithpmp += $obj->reel;
$totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product
$totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product
//Batch Detail //Batch Detail
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
{ {
@ -673,14 +676,15 @@ if ($resql)
} }
} }
else dol_print_error($db); else dol_print_error($db);
print '<tr class="liste_total"><td align="right" class="liste_total" colspan="4">'.$langs->trans("Total").':</td>'; 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">'.$total.'</td>';
print '<td class="liste_total" align="right">'; 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>'; print '</td>';
// Value purchase // Value purchase
print '<td class="liste_total" align="right">'; 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>';
print '<td class="liste_total" align="right">'; print '<td class="liste_total" align="right">';
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):'&nbsp;'); 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 = "UPDATE ".MAIN_DB_PREFIX."projet_task";
$sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; $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; $sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); 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 = "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; $sql.= " WHERE rowid = ".$tasktime_id;
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.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) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr> * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
* *
@ -185,6 +185,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
} }
} }
/* /*
* View * View
*/ */
@ -317,7 +318,12 @@ if ($socid && $action != 'edit' && $action != "create")
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>'; print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
} }
print "<br />"; print "<br>";
/*
* List of bank accounts
*/
print_titre($langs->trans("AllRIB")); print_titre($langs->trans("AllRIB"));
@ -339,7 +345,7 @@ if ($socid && $action != 'edit' && $action != "create")
foreach ($rib_list as $rib) foreach ($rib_list as $rib)
{ {
print "<tr $bc[$var]>"; print "<tr ".$bc[$var].">";
// Label // Label
print '<td>'.$rib->label.'</td>'; print '<td>'.$rib->label.'</td>';
// Bank name // Bank name
@ -382,7 +388,7 @@ if ($socid && $action != 'edit' && $action != "create")
} }
if (count($rib_list) == 0) { 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>'; print '</table>';
@ -458,7 +464,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
if ($val == 'AccountNumber') 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 '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
print '</tr>'; print '</tr>';
} }
@ -475,10 +481,10 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
} }
// IBAN // 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 '<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 '<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">'; 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)); $colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1));
$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2)); $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 // Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1); $tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $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); $result.=($lien.img_object($langs->trans("ShowUser"),'user').$lienfin);
if ($withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=' ';
} }
$result.=$lien.$this->getFullName($langs,'','',16).$lienfin; $result.=$lien.$this->getFullName($langs,'','',24).$lienfin;
return $result; 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("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("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); 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("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("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); 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; $companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1); print $companystatic->getNomUrl(1);
} }
// Multicompany enabled else if ($obj->ldap_sid)
else if (! empty($conf->multicompany->enabled))
{ {
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) if (! $obj->entity)
{ {
print $langs->trans("AllEntities"); print $langs->trans("AllEntities");
@ -181,16 +196,8 @@ if ($result)
print $mc->label; print $mc->label;
} }
} }
print '</td>';
} }
else if ($obj->ldap_sid)
{
print $langs->trans("DomainUser");
}
else
{
print $langs->trans("InternalUser");
}
print '</td>';
// Date creation // Date creation
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datec),"dayhour").'</td>'; print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datec),"dayhour").'</td>';