Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-05-21 19:35:26 +02:00
commit c141c3ecfd
46 changed files with 1074 additions and 413 deletions

View File

@ -20,6 +20,12 @@ source_file = htdocs/langs/en_US/agenda.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.assets]
file_filter = htdocs/langs/<lang>/assets.lang
source_file = htdocs/langs/en_US/assets.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.banks]
file_filter = htdocs/langs/<lang>/banks.lang
source_file = htdocs/langs/en_US/banks.lang

View File

@ -160,6 +160,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -240,6 +240,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -157,6 +157,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -168,6 +168,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -600,6 +600,7 @@ if ($id)
if (empty($reshook))
{
$langs->load("accountancy");
foreach ($fieldlist as $field => $value)
{
@ -610,10 +611,12 @@ if ($id)
$valuetoshow=$langs->trans('All');
}
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
$langs->loadLangs(array("accountancy"));
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature))?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow=$langs->trans($obj->label);
}
$class='tddict';
// Show value for field

View File

@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/receiptprinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$langs->load("admin");
$langs->load("receiptprinter");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","receiptprinter"));
if (! $user->admin) accessforbidden();
@ -232,7 +232,6 @@ if ($mode == 'config' && $user->admin)
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
@ -248,10 +247,11 @@ if ($mode == 'config' && $user->admin)
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
for ($line=0; $line < $nbofprinters; $line++) {
$var = !$var;
for ($line=0; $line < $nbofprinters; $line++)
{
print '<tr class="oddeven">';
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) {
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid)
{
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
@ -329,11 +329,11 @@ if ($mode == 'config' && $user->admin)
print $langs->trans("ReceiptPrinterTypeDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
@ -342,11 +342,11 @@ if ($mode == 'config' && $user->admin)
dol_fiche_head();
print $langs->trans("ReceiptPrinterProfileDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
}
@ -365,7 +365,6 @@ if ($mode == 'template' && $user->admin)
print $langs->trans("ReceiptPrinterTemplateDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Template").'</th>';
@ -379,8 +378,8 @@ if ($mode == 'template' && $user->admin)
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
$max = count($printer->listprinterstemplates);
for ($line=0; $line < $max; $line++) {
$var = !$var;
for ($line=0; $line < $max; $line++)
{
print '<tr class="oddeven">';
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
@ -419,14 +418,13 @@ if ($mode == 'template' && $user->admin)
print '</form>';
print '<div><p></div>';
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Tag").'</th>';
print '<th>'.$langs->trans("Description").'</th>';
print "</tr>\n";
$max = count($printer->tags);
for ($tag=0; $tag < $max; $tag++) {
$var = !$var;
for ($tag=0; $tag < $max; $tag++)
{
print '<tr class="oddeven">';
print '<td>&lt;'.$printer->tags[$tag].'&gt;</td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
print '</tr>';

View File

@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
if (! empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
$langs->load("admin");
$langs->load("resource");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","resource"));
// Security check
if (!$user->admin)
@ -76,7 +76,6 @@ print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateoptions">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -85,7 +84,6 @@ print '<td></td>';
// Utilisation formulaire Ajax sur choix produit
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
if (empty($conf->use_javascript_ajax))

View File

@ -29,9 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$action=GETPOST('action','aZ09');
$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("users","admin","other"));
if (!$user->admin) accessforbidden();
@ -178,10 +177,6 @@ if ($action == 'maj_pattern')
/*
* View
*/
@ -201,9 +196,6 @@ $head=security_prepare_head();
dol_fiche_head($head, 'passwords', $langs->trans("Security"), -1);
$var=false;
// Choix du gestionnaire du generateur de mot de passe
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -250,7 +242,6 @@ foreach ($arrayhandler as $key => $module)
if ($module->isEnabled())
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print ucfirst($key);
print "</td><td>\n";
@ -395,7 +386,6 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
// Cryptage mot de passe
print '<br>';
$var=true;
print "<form method=\"post\" action=\"" . $_SERVER["PHP_SELF"] . "\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">";

View File

@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("users","admin","other"));
if (! $user->admin)
accessforbidden();
@ -107,8 +106,6 @@ dol_fiche_head($head, 'misc', $langs->trans("Security"), -1);
// Other Options
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
@ -116,7 +113,6 @@ print '<td align="right" width="100">'.$langs->trans("Status").'</td>';
print '</tr>';
// Enable Captcha code
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="right">';
@ -146,7 +142,6 @@ else
print '</td></tr>';
// Enable advanced perms
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
print '<td align="right">';
@ -174,8 +169,6 @@ print '<br>';
// Timeout
$var=true;
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';

View File

@ -25,12 +25,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("companies");
$langs->load("products");
$langs->load("admin");
$langs->load("sms");
$langs->load("other");
$langs->load("errors");
// Load traductions files requiredby by page
$langs->loadLangs(array("companies","admin","products","sms","other","errors"));
if (!$user->admin)
accessforbidden();
@ -169,30 +165,25 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="update">';
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_ALL_SMS',$conf->global->MAIN_DISABLE_ALL_SMS,1);
print '</td></tr>';
// Separator
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
if (count($listofmethods)) print $form->selectarray('MAIN_SMS_SENDMODE',$listofmethods,$conf->global->MAIN_SMS_SENDMODE,1);
else print '<font class="error">'.$langs->trans("None").'</font>';
print '</td></tr>';
// From
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_SMS_FROM" size="32" value="' . $conf->global->MAIN_MAIL_SMS_FROM;
print '"></td></tr>';
@ -216,31 +207,26 @@ if ($action == 'edit')
}
else
{
$var=true;
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_SMS).'</td></tr>';
// Separator
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_SMS_SENDMODE];
if (empty($text)) $text=$langs->trans("Undefined").' '.img_warning();
print $text;
print '</td></tr>';
// From
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM;
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print ' '.img_warning($langs->trans("ErrorBadPhone"));

View File

@ -32,9 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("admin");
$langs->load("members");
$langs->load("mailmanspip");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "members", "mailmanspip"));
if (! $user->admin) accessforbidden();
@ -118,8 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head();
$var=true;
/*
* Spip
*/

View File

@ -3,7 +3,7 @@
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -28,8 +28,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("stocks");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "stocks"));
// Securit check
if (!$user->admin) accessforbidden();
@ -162,11 +162,9 @@ print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var=true;
$found=0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DeStockOnBill").'</td>';
print '<td align="right">';
@ -266,11 +264,9 @@ print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var=true;
$found=0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td align="right">';
@ -362,8 +358,8 @@ print "</td>\n";
print "</tr>\n";
// Option to force stock to be enough before adding a line into document
if($conf->invoice->enabled) {
$var = !$var;
if($conf->invoice->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td align="right">';
@ -377,8 +373,8 @@ if($conf->invoice->enabled) {
print "</tr>\n";
}
if($conf->order->enabled) {
$var = !$var;
if($conf->order->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td align="right">';
@ -392,8 +388,8 @@ if($conf->order->enabled) {
print "</tr>\n";
}
if($conf->expedition->enabled) {
$var = !$var;
if($conf->expedition->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td align="right">';
@ -408,7 +404,6 @@ if($conf->expedition->enabled) {
}
print '</table>';
print '<br>';
$virtualdiffersfromphysical=0;
@ -423,7 +418,7 @@ if ($virtualdiffersfromphysical)
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var = !$var;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
print '<td align="right">';

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@ -34,9 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->load("admin");
$langs->load("other");
$langs->load("orders");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "orders"));
if (!$user->admin)
accessforbidden();
@ -233,7 +232,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@ -34,9 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$langs->load("admin");
$langs->load("other");
$langs->load("orders");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "orders"));
if (!$user->admin)
accessforbidden();
@ -262,7 +261,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{

View File

@ -27,12 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('bills');
$langs->load('orders');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "errors", "other", "bills", "orders"));
if (! $user->admin) accessforbidden();
@ -217,7 +213,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
@ -249,7 +244,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
echo preg_replace('/\-.*$/','',preg_replace('/mod_supplier_payment_/','',preg_replace('/\.php$/','',$file)));
print "</td><td>\n";
@ -360,7 +354,6 @@ foreach ($dirmodels as $reldir)
require_once $dir.'/'.$file;
$module = new $classname($db, new PaiementFourn($db));
print "<tr class=\"oddeven\">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);

View File

@ -28,10 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('supplier_proposal');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "errors", "other", "supplier_proposal"));
if (! $user->admin) accessforbidden();
@ -247,7 +246,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
@ -366,7 +364,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@ -403,7 +400,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
@ -492,7 +488,6 @@ print '<br>';
*/
print load_fiche_titre($langs->trans("OtherOptions"),'','');
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n";
@ -506,7 +501,6 @@ $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
$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_SUPPLIER_PROPOSAL_FREE_TEXT">';
@ -585,7 +579,7 @@ print "<tr class=\"liste_titre\">\n";
print " <td>".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Value")."</td>\n";
print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
print "<tr class=\"oddeven\">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
print "</table>\n<br>";
llxFooter();

View File

@ -279,7 +279,6 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
print '<td align="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=true;
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogLevel").'</td>';
print '<td colspan="2"><select class="flat" name="level" '.$option.'>';

View File

@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("admin");
$langs->load("members");
$langs->load("users");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "members", "users"));
if (! $user->admin) accessforbidden();
$extrafields = new ExtraFields($db);
@ -165,7 +165,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@ -202,7 +201,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";

View File

@ -78,8 +78,9 @@ class Asset extends CommonObject
'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
'amount' => array('type'=>'double(24,8)', 'label'=>'Amount', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),

View File

@ -73,14 +73,23 @@ class AssetType extends CommonObject
$error=0;
$this->label=trim($this->label);
$this->accountancy_code_asset = trim($this->accountancy_code_asset);
$this->accountancy_code_depreciation_asset = trim($this->accountancy_code_depreciation_asset);
$this->accountancy_code_depreciation_expense = trim($this->accountancy_code_depreciation_expense);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
$sql.= "label";
$sql.= ", accountancy_code_asset";
$sql.= ", accountancy_code_depreciation_asset";
$sql.= ", accountancy_code_depreciation_expense";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= "'".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_asset)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
$sql.= ", ".$conf->entity;
$sql.= ")";
@ -411,4 +420,14 @@ class AssetType extends CommonObject
);
}
/**
* getLibStatut
*
* @return string Return status of a type of asset
*/
function getLibStatut()
{
return '';
}
}

View File

@ -26,6 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$langs->load("assets");
@ -232,8 +235,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th align="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th align="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeAsset").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationAsset").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationExpense").'</th>';
print '<th>&nbsp;</th>';
print "</tr>\n";
@ -253,9 +257,44 @@ if (! $rowid && $action != 'create' && $action != 'edit')
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td align="center">'.yn($objp->subscription).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
if ($user->rights->asset->configurer)
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
print $accountingaccount2->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount3 = new AccountingAccount($db);
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
print $accountingaccount3->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_expense;
}
print '</td>';
if ($user->rights->asset->write)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
else
print '<td align="right">&nbsp;</td>';
@ -282,8 +321,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
if ($action == 'create')
{
$object = new AssetType($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
print load_fiche_titre($langs->trans("NewMemberType"));
print load_fiche_titre($langs->trans("NewAssetType"));
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -296,23 +336,48 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription",1,1);
print '</td></tr>';
if (! empty($conf->accounting->enabled))
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",0,1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
print '</td></tr>';
}
else // For external software
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
print '</td></tr>';
}
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
$doleditor->Create();
print '</td></tr>';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
@ -356,9 +421,9 @@ if ($rowid > 0)
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1);
}
$head = member_type_prepare_head($object);
$head = asset_type_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
dol_fiche_head($head, 'card', $langs->trans("AssetType"), -1, 'setup');
$linkback = '<a href="'.DOL_URL_ROOT.'/asset/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -369,20 +434,45 @@ if ($rowid > 0)
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($object->subscription);
print '</tr>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($object->vote);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
print $accountingaccount2->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount3 = new AccountingAccount($db);
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
print $accountingaccount3->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_expense;
}
print '</tr>';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->note)."</td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($object->mail_valid)."</td></tr>";
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -398,7 +488,7 @@ if ($rowid > 0)
print '<div class="tabsAction">';
// Edit
if ($user->rights->asset->configurer)
if ($user->rights->asset->write)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
}
@ -407,7 +497,7 @@ if ($rowid > 0)
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
// Delete
if ($user->rights->asset->configurer)
if ($user->rights->asset->write)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
}
@ -415,8 +505,7 @@ if ($rowid > 0)
print "</div>";
// Show list of members (nearly same code than in page list.php)
// Show list of assets (nearly same code than in page list.php)
$assettypestatic=new AssetType($db);
$now=dol_now();
@ -426,7 +515,7 @@ if ($rowid > 0)
$sql.= " a.fk_asset_type as type_id,";
$sql.= " t.label as type";
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a, ".MAIN_DB_PREFIX."asset_type as t";
$sql.= " WHERE a.fk_asset_type = t.rowid ";
$sql.= " WHERE a.fk_asset_type = t.rowid";
$sql.= " AND a.entity IN (".getEntity('asset').")";
$sql.= " AND t.rowid = ".$object->id;
if ($sall)
@ -441,8 +530,8 @@ if ($rowid > 0)
{
if (GETPOST('search','alpha'))
{
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}
}
if (! empty($search_lastname))
{
@ -612,35 +701,6 @@ if ($rowid > 0)
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// Date end subscription
if ($datefin)
{
print '<td align="center" class="nowrap">';
if ($datefin < dol_now() && $objp->statut > 0)
{
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
else
{
print dol_print_date($datefin,'day');
}
print '</td>';
}
else
{
print '<td align="left" class="nowrap">';
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
// Actions
print '<td align="center">';
if ($user->rights->asset->creer)
@ -685,15 +745,16 @@ if ($rowid > 0)
$object = new AssetType($db);
$object->fetch($rowid);
$object->fetch_optionals();
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$head = member_type_prepare_head($object);
$head = asset_type_prepare_head($object);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
dol_fiche_head($head, 'card', $langs->trans("AssetsType"), -1, 'setup');
print '<table class="border" width="100%">';
@ -701,23 +762,48 @@ if ($rowid > 0)
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription",$object->subscription,1);
print '</td></tr>';
if (! empty($conf->accounting->enabled))
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",$object->vote,1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
print '</td></tr>';
}
else // For external software
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
print '</td></tr>';
}
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
$doleditor->Create();
print "</td></tr>";
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook

View File

@ -68,8 +68,6 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table summary="bookmarklist" class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';

View File

@ -38,8 +38,8 @@ if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id']))
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("cashdesk");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "cashdesk"));
/*
@ -91,7 +91,6 @@ print '<br>';
// Mode
$var=true;
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">';
@ -162,7 +161,6 @@ if (! empty($conf->stock->enabled))
if (! empty($conf->service->enabled))
{
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("CashdeskShowServices");
print '<td colspan="2">';
@ -173,7 +171,6 @@ if (! empty($conf->service->enabled))
// Use Dolibarr Receipt Printer
if (! empty($conf->receiptprinter->enabled))
{
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
print '<td colspan="2">';

View File

@ -93,7 +93,6 @@ print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
$var=true;
$form = new Form($db);
// Mail required for members

View File

@ -82,7 +82,7 @@ print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>';
print '<tr '.$bc[0].'><td>';
print '<tr class="oddeven"><td>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
/*
// faire une rech dans une sous categorie uniquement
@ -111,7 +111,6 @@ if ($catname || $id > 0)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
$var=true;
foreach ($cats as $cat)
{
print "\t".'<tr class="oddeven">'."\n";

View File

@ -42,12 +42,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("commercial");
$langs->load("other");
$langs->load("bills");
$langs->load("orders");
$langs->load("agenda");
// Load traductions files requiredby by page
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda"));
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel','alpha');
@ -1603,7 +1599,6 @@ if ($id > 0)
$genallowed=$user->rights->agenda->myactions->read;
$delallowed=$user->rights->agenda->myactions->create;
$var=true;
print $formfile->showdocuments('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang);

View File

@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php';
$langs->load("agenda");
$langs->load("commercial");
// Load traductions files requiredby by page
$langs->loadLangs(array("agenda", "commercial"));
$action=GETPOST('action','alpha');
$month=GETPOST('month');
@ -138,7 +138,6 @@ if ($resql)
print '<td align="center">'.$langs->trans("Size").'</td>';
print "</tr>\n";
$var=true;
while ($i < min($num,$limit))
{
$obj=$db->fetch_object($resql);

View File

@ -2278,7 +2278,7 @@ if ($action == 'create')
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
// Form to add new line
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer)
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer && $action != 'selectlines')
{
if ($action != 'editline')
{

View File

@ -53,7 +53,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?>
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
?>
</td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>

View File

@ -720,7 +720,6 @@ if (empty($reshook))
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$sql.= ' AND pf.fk_paiement = p.rowid';
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
$sql.= ' ORDER BY p.datep, p.tms';
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -914,12 +913,21 @@ if (empty($reshook))
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
$object->type = Facture::TYPE_CREDIT_NOTE;
$facture_source = new Facture($db); // fetch origin object
if ($facture_source->fetch($object->fk_facture_source)>0)
{
if ($facture_source->type == Facture::TYPE_SITUATION)
{
$object->situation_counter = $facture_source->situation_counter;
$object->situation_cycle_ref = $facture_source->situation_cycle_ref;
$facture_source->fetchPreviousNextSituationInvoice();
}
}
$id = $object->create($user);
$facture_source = new Facture($db); // fetch origin object
if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
{
if ($facture_source->fetch($object->fk_facture_source)>0)
if (!empty($facture_source->lines))
{
$fk_parent_line = 0;
@ -935,6 +943,61 @@ if (empty($reshook))
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0;
}
if($facture_source->type == Facture::TYPE_SITUATION)
{
if(!empty($facture_source->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while( $searchPreviousInvoice )
{
if($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
{
$searchPreviousInvoice=false; // find, exit;
break;
}
else
{
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
//$line->subprice = $line->subprice - $prevLine->subprice;
$line->total_ht = $line->total_ht - $prevLine->total_ht;
$line->total_tva = $line->total_tva - $prevLine->total_tva;
$line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
$line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
$line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
$line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
$line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
$line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
$line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
}
}
// prorata
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
}
}
$line->fk_facture = $object->id;
$line->fk_parent_line = $fk_parent_line;
@ -1960,7 +2023,25 @@ if (empty($reshook))
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress($object->id);
if (GETPOST('progress') < $percent)
if($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0)
{
// in case of situation credit note
if(GETPOST('progress') >= 0 )
{
$mesg = $langs->trans("CantBeNullOrPositive");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
}
elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result
{
$mesg = $langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
}
}
elseif (GETPOST('progress') < $percent)
{
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
setEventMessages($mesg, null, 'warnings');
@ -2105,6 +2186,126 @@ if (empty($reshook))
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
exit();
}
// Outing situation invoice from cycle
elseif ($action == 'confirm_situationout' && $confirm == 'yes' && $user->rights->facture->creer)
{
$object->fetch($id,'', '','', true);
if ($object->statut == Facture::STATUS_VALIDATED
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
$outingError = 0;
$newCycle = $object->newCycle(); // we need to keep the "situation behavior" so we place it on a new situation cycle
if($newCycle > 1)
{
// Search credit notes
$lastCycle = $object->situation_cycle_ref;
$lastSituationCounter = $object->situation_counter;
$linkedCreditNotesList = array();
if (count($object->tab_next_situation_invoice) > 0) {
foreach ($object->tab_next_situation_invoice as $next_invoice) {
if($next_invoice->type == Facture::TYPE_CREDIT_NOTE
&& $next_invoice->situation_counter == $object->situation_counter
&& $next_invoice->fk_facture_source == $object->id
)
{
$linkedCreditNotesList[] = $next_invoice->id ;
}
}
}
$object->situation_cycle_ref = $newCycle;
$object->situation_counter = 1;
$object->situation_final = 0;
if($object->update($user) > 0)
{
$errors = 0;
if(count($linkedCreditNotesList) > 0)
{
// now, credit note must follow
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture ';
$sql.= ' SET situation_cycle_ref='.$newCycle;
$sql.= ' , situation_final=0';
$sql.= ' , situation_counter='.$object->situation_counter;
$sql.= ' WHERE rowid IN ('.implode(',',$linkedCreditNotesList).')';
$resql=$db->query($sql);
if (!$resql) $errors++;
// Change each progression persent on each lines
foreach($object->lines as $line)
{
// no traitement for special product
if ($line->product_type == 9 ) continue;
if(!empty($object->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($object->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while( $searchPreviousInvoice )
{
if($object->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
{
$searchPreviousInvoice=false; // find, exit;
break;
}
else
{
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach($object->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
}
}
$line->situation_percent = $line->situation_percent - $maxPrevSituationPercent;
if($line->update()<0) $errors++;
}
}
}
if (!$errors)
{
setEventMessages($langs->trans('Updated'));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
}
else
{
setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors');
}
}
else
{
setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors');
}
}
else
{
setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors');
}
}
}
// add lines from objectlinked
elseif($action == 'import_lines_from_object'
@ -2115,14 +2316,19 @@ if (empty($reshook))
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class');
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
}
elseif($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
@ -2162,26 +2368,27 @@ if (empty($reshook))
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
if($res > 0){
$importCount++;
}else{
$error++;
}
}
else{
$error++;
else{
$error++;
}
}
if($error)
{
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
}
}
}
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -3135,6 +3342,24 @@ else if ($id > 0 || ! empty($ref))
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
}
}
// Confirmation to remove invoice from cycle
if ($action == 'situationout') {
$text = $langs->trans('ConfirmRemoveSituationFromCycle', $object->ref);
$label = $langs->trans("ConfirmOuting");
$formquestion = array();
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $label, $text, 'confirm_situationout', $formquestion, "yes", 1);
}
}
// Confirmation of validation
if ($action == 'valid')
@ -3617,54 +3842,10 @@ else if ($id > 0 || ! empty($ref))
print "</td>";
print '</tr>';
// Situations
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if ($object->type == 5 && ($object->situation_counter > 1))
{
$prevsits = $object->get_prev_sits();
print '<tr><td>';
print $langs->trans('SituationAmount');
print ' ';
print $prevsits[0]->situation_counter;
$cprevsits = count($prevsits);
for ($i = 1; $i < $cprevsits; $i++) {
print ' + ';
print $prevsits[$i]->situation_counter;
}
print ' + ';
print $object->situation_counter;
print '</td>';
print '<td class="nowrap">';
$prevsits_total_amount = 0;
foreach ($prevsits as $situation) {
$prevsits_total_amount += $situation->total_ht;
}
$prevsits_total_amount += $object->total_ht;
print price($prevsits_total_amount, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td></tr>';
// Previous situation(s) deduction(s)
for ($i = 0; $i < $cprevsits; $i++) {
print '<tr><td>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
print $langs->trans('SituationDeduction');
print ' ';
print $prevsits[$i]->situation_counter;
print '</a></td>';
print '<td class="nowrap">';
print '- ' . price($prevsits[$i]->total_ht, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td></tr>';
}
}
}
// Incoterms
if (!empty($conf->incoterm->enabled))
@ -3823,88 +4004,129 @@ else if ($id > 0 || ! empty($ref))
if (! empty($conf->incoterm->enabled))
$nbrows += 1;
if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
// List of previous situation invoices
if (($object->situation_cycle_ref > 0) && ! empty($conf->global->INVOICE_USE_SITUATION))
{
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '<table class="noborder situationstable" width="100%">';
if (count($object->tab_previous_situation_invoice) > 0) {
// List of previous invoices
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
$total_prev_ht = $total_prev_ttc = 0;
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye = $prev_invoice->getSommePaiement();
$total_prev_ht += $prev_invoice->total_ht;
$total_prev_ttc += $prev_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $prev_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
print '<tr class="oddeven">';
print '<td></td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td></td>';
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_prev_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
if (count($object->tab_next_situation_invoice) > 0) {
// List of next invoices
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
print '<tr class="oddeven">';
print '<td colspan="2" align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '</table>';
print '<table class="noborder situationstable" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfSituationInvoices') . '</td>';
print '<td></td>';
print '<td align="center">' . $langs->trans('Situation') . '</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
$total_prev_ht = $total_prev_ttc = 0;
$total_global_ht = $total_global_ttc = 0;
if (count($object->tab_previous_situation_invoice) > 0) {
// List of previous invoices
$current_situation_counter = array();
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye = $prev_invoice->getSommePaiement();
$total_prev_ht += $prev_invoice->total_ht;
$total_prev_ttc += $prev_invoice->total_ttc;
$current_situation_counter[] = (($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?-1:1) * $prev_invoice->situation_counter;
print '<tr class="oddeven">';
print '<td>' . $prev_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center" >'.(($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $prev_invoice->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
}
$total_global_ht += $total_prev_ht ;
$total_global_ttc += $total_prev_ttc ;
$total_global_ht += $object->total_ht;
$total_global_ttc += $object->total_ttc;
$current_situation_counter[] = (($object->type == Facture::TYPE_CREDIT_NOTE)?-1:1) * $object->situation_counter;
print '<tr class="oddeven">';
print '<td>' . $object->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center">'.(($object->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $object->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($object->total_ht) . '</td>';
print '<td align="right">' . price($object->total_ttc) . '</td>';
print '<td align="right">' . $object->getLibStatut(3, $object->getSommePaiement()) . '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="2" align="left"><b>' . $langs->trans('CurrentSituationTotal') . '</b></td>';
print '<td>';
$i =0;
foreach ($current_situation_counter as $sit)
{
$curSign = $sit>0?'+':'-';
$curType = $sit>0?$langs->trans('situationInvoiceShortcode_S'):$langs->trans('situationInvoiceShortcode_AS');
if($i>0) print ' '.$curSign.' ';
print $curType . abs($sit);
$i++;
}
print '</td>';
if (! empty($conf->banque->enabled)) print '<td></td>';
print '<td align="right"><b>' . price($total_global_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_global_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
if (count($object->tab_next_situation_invoice) > 0) {
// List of next invoices
/*print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';*/
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center">'.(($next_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $next_invoice->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
$total_global_ht += $total_next_ht;
$total_global_ttc += $total_next_ttc;
print '<tr class="oddeven">';
print '<td colspan="3" align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right"><b>' . price($total_global_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_global_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
print '</table>';
}
@ -4460,6 +4682,45 @@ else if ($id > 0 || ! empty($ref))
}
}
// For situation invoice with excess received
if ($object->statut == Facture::STATUS_VALIDATED
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE
)
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&amp;fac_avoir=' . $object->id . '&amp;invoiceAvoirWithLines=1&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
} else {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans("CreateCreditNote") . '</span></div>';
}
}
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->situation_counter > 1
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
if(($object->total_ttc - $totalcreditnotes ) == 0 )
{
print '<div class="inline-block divButAction"><a id="butSituationOut" class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&amp;action=situationout">' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a id="butSituationOutRefused" class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotEnouthCreditNote") . '" >' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
}
}
// Create next situation invoice
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
@ -4528,16 +4789,16 @@ else if ($id > 0 || ! empty($ref))
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
$compatibleImportElementsList = false;
if($user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
if($user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
{
$compatibleImportElementsList = array('commande'); // import from linked elements
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
// Show online payment link
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));

View File

@ -1348,8 +1348,8 @@ class Facture extends CommonInvoice
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
if ($this->type == self::TYPE_SITUATION && $fetch_situation)
if (($this->type == self::TYPE_SITUATION || ($this->type == self::TYPE_CREDIT_NOTE && $this->situation_cycle_ref > 0)) && $fetch_situation)
{
$this->fetchPreviousNextSituationInvoice();
}
@ -1521,8 +1521,16 @@ class Facture extends CommonInvoice
$invoice = new Facture($this->db);
if ($invoice->fetch($objp->rowid) > 0)
{
if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice;
else $this->tab_next_situation_invoice[] = $invoice;
if ($objp->situation_counter < $this->situation_counter
|| ($objp->situation_counter == $this->situation_counter && $objp->rowid < $this->id) // This case appear when there are credit notes
)
{
$this->tab_previous_situation_invoice[] = $invoice;
}
else
{
$this->tab_next_situation_invoice[] = $invoice;
}
}
}
}
@ -3493,6 +3501,7 @@ class Facture extends CommonInvoice
$return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
@ -3504,6 +3513,23 @@ class Facture extends CommonInvoice
// $sql.= " OR f.close_code IS NOT NULL)"; // Classee payee partiellement
$sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir
if($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE){
// Select the last situation invoice
$sqlSit = 'SELECT MAX(fs.rowid)';
$sqlSit.= " FROM ".MAIN_DB_PREFIX."facture as fs";
$sqlSit.= " WHERE fs.entity = ".$conf->entity;
$sqlSit.= " AND fs.type = ".self::TYPE_SITUATION;
$sqlSit.= " AND fs.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
$sqlSit.= " GROUP BY fs.situation_cycle_ref";
$sqlSit.= " ORDER BY fs.situation_counter";
$sql.= " AND ( f.type != ".self::TYPE_SITUATION . " OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir
}
else
{
$sql.= " AND f.type != ".self::TYPE_SITUATION ; // Type non 5 si facture non avoir
}
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber";

View File

@ -2661,7 +2661,7 @@ abstract class CommonObject
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
// Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits'))
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE )
{
$prev_sits = $this->get_prev_sits();
@ -2705,7 +2705,7 @@ abstract class CommonObject
$sql .= ", multicurrency_total_ttc='".price2num($this->multicurrency_total_ttc, 'MT', 1)."'";
$sql .= ' WHERE rowid = '.$this->id;
//print "xx".$sql;
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)

View File

@ -118,3 +118,32 @@ function AssetsPrepareHead()
return $head;
}
/**
* Return array head with list of tabs to view object informations
*
* @param AssetType $object Asset
* @return array head
*/
function asset_type_prepare_head(AssetType $object)
{
global $langs, $conf, $user;
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
return $head;
}

View File

@ -1144,11 +1144,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("assets");
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy",$langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset');
$newmenu->add("/asset/card.php?leftmenu=asset&amp;action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
$newmenu->add("/asset/type.php?leftmenu=asset",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
$newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create",$langs->trans("MenuNewTypeAssets"), 1, $user->rights->asset->write);
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/list.php?leftmenu=asset",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/card.php?action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create",$langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->write);
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
}
}

View File

@ -219,23 +219,65 @@ class modAsset extends DolibarrModules
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
//--------
$r=1;
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
/*
$langs->load("fixedassets@fixedassets");
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='FixedAssetsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='fixedassets@fixedassets';
$keyforclass = 'FixedAssets'; $keyforclassfile='/mymobule/class/fixedassets.class.php'; $keyforelement='fixedassets';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='fixedassets'; $keyforaliasextra='extra'; $keyforelement='fixedassets';
$this->export_label[$r]='AssetsLines';
$this->export_permission[$r]=array(array("asset","export"));
$this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'AssetTypeId','ta.label'=>'AssetTypeLabel','ta.accountancy_code_asset'=>'AccountancyCodeAsset','ta.accountancy_code_depreciation_asset'=>'AccountancyCodeDepreciationAsset','ta.accountancy_code_depreciation_expense'=>'AccountancyCodeDepreciationExpense');
$this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:asset_type:label','ta.label'=>'Text','ta.accountancy_code_asset'=>'Text','ta.accountancy_code_depreciation_asset'=>'Text','ta.accountancy_code_depreciation_expense'=>'Text');
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'asset_type','ta.label'=>'asset_type''ta.accountancy_code_asset'=>'asset_type''ta.accountancy_code_depreciation_asset'=>'asset_type''ta.accountancy_code_depreciation_expense'=>'asset_type');
// Add extra fields
$keyforselect='asset'; $keyforelement='asset'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fixedassets as t';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('fixedassets').')';
$r++; */
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'asset_type as ta, '.MAIN_DB_PREFIX.'asset as a)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'asset_extrafields as extra ON a.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' WHERE a.fk_asset_type = ta.rowid AND ta.entity IN ('.getEntity('asset_type').') ';
// Imports
//--------
$r=0;
$now=dol_now();
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Assets"; // Translation key
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'asset','extra'=>MAIN_DB_PREFIX.'asset_extrafields');
$this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription');
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'asset' AND entity = ".$conf->entity;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'asset'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
*/
}
/**

View File

@ -354,8 +354,8 @@ class Fichinter extends CommonObject
$this->statut = $obj->fk_statut;
$this->duration = $obj->duree;
$this->datec = $this->db->jdate($obj->datec);
$this->datee = $this->db->jdate($obj->dateo);
$this->dateo = $this->db->jdate($obj->datee);
$this->dateo = $this->db->jdate($obj->dateo);
$this->datee = $this->db->jdate($obj->datee);
$this->datet = $this->db->jdate($obj->datet);
$this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);

View File

@ -508,7 +508,6 @@ if (empty($reshook))
$sql.= ' WHERE pf.fk_facturefourn = '.$object->id;
$sql.= ' AND pf.fk_paiementfourn = p.rowid';
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
$sql.= ' ORDER BY p.datep, p.tms';
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);

View File

@ -389,9 +389,9 @@ CREATE TABLE llx_asset(
ref varchar(128) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
label varchar(255),
amount double(24,8) DEFAULT NULL,
amount_ht double(24,8) DEFAULT NULL,
amount_vat double(24,8) DEFAULT NULL,
fk_asset_type integer NOT NULL,
fk_soc integer,
description text,
note_public text,
note_private text,
@ -406,7 +406,6 @@ CREATE TABLE llx_asset(
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);

View File

@ -17,7 +17,6 @@
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);

View File

@ -19,9 +19,9 @@ CREATE TABLE llx_asset(
ref varchar(128) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
label varchar(255),
amount double(24,8) DEFAULT NULL,
amount_ht double(24,8) DEFAULT NULL,
amount_vat double(24,8) DEFAULT NULL,
fk_asset_type integer NOT NULL,
fk_soc integer,
description text,
note_public text,
note_private text,

View File

@ -18,9 +18,11 @@
#
Assets = Assets
NewAsset = New asset
AccountancyAccountAsset = Accounting code (asset)
AccountancyAccountDepreciationAsset = Accounting code (depreciation asset account)
AccountancyAccountDepreciationExpense = Accounting code (depreciation expense account)
AccountancyCodeAsset = Accounting code (asset)
AccountancyCodeDepreciationAsset = Accounting code (depreciation asset account)
AccountancyCodeDepreciationExpense = Accounting code (depreciation expense account)
NewAssetType=New asset type
AssetsLines=Assets
# Module label 'ModuleAssetsName'
ModuleAssetsName = Assets
@ -44,5 +46,7 @@ AssetsTypes=Assets types
#
MenuAssets = Assets
MenuNewAsset = New asset
MenuTypeAssets = Type
MenuTypeAssets = Type assets
MenuListAssets = List
MenuNewTypeAssets = New type
MenuListTypeAssets = List

View File

@ -339,6 +339,12 @@ PaymentOnDifferentThirdBills=Allow payments on different thirdparties bills but
PaymentNote=Payment note
ListOfPreviousSituationInvoices=List of previous situation invoices
ListOfNextSituationInvoices=List of next situation invoices
ListOfSituationInvoices=List of situation invoices
CurrentSituationTotal=Total current situation
DisabledBecauseNotEnouthCreditNote=To remove a situation invoice from cycle, this invoice's credit note total must cover this invoice total
RemoveSituationFromCycle=Remove this invoice from cycle
ConfirmRemoveSituationFromCycle=Remove this invoice %s from cycle ?
ConfirmOuting=Confirm outing
FrequencyPer_d=Every %s days
FrequencyPer_m=Every %s months
FrequencyPer_y=Every %s years
@ -505,9 +511,14 @@ SituationAmount=Situation invoice amount(net)
SituationDeduction=Situation subtraction
ModifyAllLines=Modify all lines
CreateNextSituationInvoice=Create next situation
ErrorFindNextSituationInvoice=Error unable to find next situation cycle ref
ErrorOutingSituationInvoiceOnUpdate=Unable to outing this situation invoice.
ErrorOutingSituationInvoiceCreditNote=Unable to outing linked credit note.
NotLastInCycle=This invoice is not the latest in cycle and must not be modified.
DisabledBecauseNotLastInCycle=The next situation already exists.
DisabledBecauseFinal=This situation is final.
situationInvoiceShortcode_AS=AS
situationInvoiceShortcode_S=S
CantBeLessThanMinPercent=The progress can't be smaller than its value in the previous situation.
NoSituations=No open situations
InvoiceSituationLast=Final and general invoice

View File

@ -26,6 +26,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@ -64,6 +65,10 @@ $object = new Entrepot($db);
* Actions
*/
$usercanread = (($user->rights->stock->lire));
$usercancreate = (($user->rights->stock->creer));
$usercandelete = (($user->rights->stock->supprimer));
// Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer)
{
@ -164,6 +169,55 @@ if ($cancel == $langs->trans("Cancel"))
$action = '';
}
/*
* Build document
*/
if ($action == 'builddoc') // En get ou en post
{
if ($id > 0 || $ref)
{
$object = new Entrepot($db);
$result = $object->fetch($id, $ref);
if ($result <= 0)
{
print 'No record found';
exit;
}
}
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
$result= $object->generateDocument($object->modelpdf, $outputlangs);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Delete file in doc form
elseif ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->stock->dir_output ;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
/*
@ -174,6 +228,7 @@ $productstatic=new Product($db);
$form=new Form($db);
$formproduct=new FormProduct($db);
$formcompany=new FormCompany($db);
$formfile = new FormFile($db);
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("",$langs->trans("WarehouseCard"),$help_url);
@ -654,6 +709,47 @@ else
}
}
/*
* Documents generes
*/
$modulepart='stock';
if ($action != 'create' && $action != 'edit' && $action != 'delete')
{
print '<br/>';
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$objectref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $objectref . '.pdf';
$filedir = $conf->stock->dir_output . '/' . $objectref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$usercanread;
$delallowed=$usercancreate;
$var=true;
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/product/agenda.php?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product
print '</div></div></div>';
}
llxFooter();

View File

@ -26,6 +26,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@ -68,6 +69,7 @@ $search_inventorycode = trim(GETPOST("search_inventorycode"));
$search_user = trim(GETPOST("search_user"));
$search_batch = trim(GETPOST("search_batch"));
$search_qty = trim(GETPOST("search_qty"));
$search_type_mouvement=GETPOST('search_type_mouvement','int');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int');
@ -84,6 +86,7 @@ $pdluoid=GETPOST('pdluoid','int');
$object = new MouvementStock($db);
$hookmanager->initHooks(array('movementlist'));
$extrafields = new ExtraFields($db);
$formfile = new FormFile($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('movement');
@ -101,6 +104,7 @@ $arrayfields=array(
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
'm.type_mouvement'=>array('label'=>$langs->trans("Type Mouvement"), 'checked'=>1),
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
@ -114,6 +118,10 @@ $arrayfields=array(
* Actions
*/
$usercanread = (($user->rights->stock->mouvement->lire));
$usercancreate = (($user->rights->stock->mouvement->creer));
$usercandelete = (($user->rights->stock->mouvement->supprimer));
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
@ -130,6 +138,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$month='';
$search_ref='';
$search_movement="";
$search_type_mouvement="";
$search_inventorycode="";
$search_product_ref="";
$search_product="";
$search_warehouse="";
@ -389,7 +399,58 @@ if ($action == "transfert_stock" && ! $cancel)
}
}
if (empty($reshook))
/*
* Build document
*/
if ($action == 'builddoc') // En get ou en post
{
if ($id > 0 || $ref)
{
$object = new MouvementStock($db);
$result = $object->fetch($id, $ref);
if ($result <= 0)
{
print 'No record found';
exit;
}
}
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
$result= $object->generateDocument($object->modelpdf, $outputlangs);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Delete file in doc form
elseif ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->stock->dir_output."/mouvement" ;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
if (empty($reshook) && $action != 'remove_file')
{
$objectclass='MouvementStock';
$objectlabel='Movements';
@ -419,6 +480,7 @@ $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.f
$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch, m.price,";
$sql.= " m.type_mouvement,";
$sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,";
$sql.= " u.login, u.photo, u.lastname, u.firstname";
// Add fields from extrafields
@ -460,6 +522,7 @@ if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($searc
if (! empty($search_user)) $sql.= natural_search('u.login', $search_user);
if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch);
if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1);
if ($search_type_mouvement) $sql.= " AND m.type_mouvement = '".$db->escape($search_type_mouvement)."'";
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -480,11 +543,21 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
}
$sql.= $db->plimit($limit+1, $offset);
if(empty($search_inventorycode))
{
$sql.= $db->plimit($limit+1, $offset);
}
else
{
$limit = 0;
}
//print $sql;
$resql = $db->query($sql);
if(!empty($search_inventorycode)) $limit = $db->num_rows($resql);
if ($resql)
{
$product = new Product($db);
@ -663,6 +736,7 @@ if ($resql)
if ($id > 0) $param.='&id='.$id;
if ($search_movement) $param.='&search_movement='.urlencode($search_movement);
if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode);
if ($search_type_mouvement) $param.='&search_type_mouvement='.urlencode($search_type_mouvement);
if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref);
if ($search_product) $param.='&search_product='.urlencode($search_product);
if ($search_batch) $param.='&search_batch='.urlencode($search_batch);
@ -801,6 +875,22 @@ if ($resql)
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).'">';
print '</td>';
}
if (! empty($arrayfields['m.type_mouvement']['checked']))
{
// Type of movement
print '<td class="liste_titre" align="left">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select name="search_type_mouvement">';
print '<option value="" '.(($search_type_mouvement=="")?'selected="selected"':'').'></option>';
print '<option value="0" '.(($search_type_mouvement=="0")?'selected="selected"':'').'>0</option>';
print '<option value="1" '.(($search_type_mouvement=="1")?'selected="selected"':'').'>1</option>';
print '<option value="2" '.(($search_type_mouvement=="2")?'selected="selected"':'').'>2</option>';
print '<option value="3" '.(($search_type_mouvement=="3")?'selected="selected"':'').'>3</option>';
print '</select>';
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';
}
if (! empty($arrayfields['origin']['checked']))
{
@ -824,9 +914,10 @@ if ($resql)
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
@ -862,10 +953,11 @@ if ($resql)
if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'],$_SERVER["PHP_SELF"], "m.type_mouvement","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -981,6 +1073,11 @@ if ($resql)
{
// Label of movement
print '<td class="tdoverflowmax100aaa">'.$objp->label.'</td>';
}
if (! empty($arrayfields['m.type_mouvement']['checked']))
{
// Type of movement
print '<td align="center">'.$objp->type_mouvement.'</td>';
}
if (! empty($arrayfields['origin']['checked']))
{
@ -1059,6 +1156,54 @@ else
dol_print_error($db);
}
/*
* Documents generes
*/
$modulepart='mouvement';
if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
{
print '<br/>';
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$objectref = dol_sanitizeFileName($object->ref);
// Add inventorycode & type_mouvement to filename of the pdf
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
$relativepath = $comref . '/' . $objectref . '.pdf';
$filedir = $conf->stock->dir_output . '/mouvement/' . $objectref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement";
$genallowed=$usercanread;
$delallowed=$usercancreate;
$genallowed=$user->rights->stock->mouvement->lire;
$delallowed=$user->rights->stock->mouvement->creer;
$var=true;
print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/product/agenda.php?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product
print '</div></div></div>';
}
llxFooter();
$db->close();

View File

@ -2939,7 +2939,7 @@ class Societe extends CommonObject
//algorithm checking type code CIF
$sum = $num[2] + $num[4] + $num[6];
for ($i = 1; $i < 8; $i += 2)
$sum += substr((2 * $num[$i]),0,1) + substr((2 * $num[$i]),1,1);
$sum += intval(substr((2 * $num[$i]),0,1)) + intval(substr((2 * $num[$i]),1,1));
$n = 10 - substr($sum, strlen($sum) - 1, 1);
//Chek special NIF