mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge
This commit is contained in:
parent
2ec462dcf4
commit
350bcea183
|
|
@ -4,6 +4,7 @@ English Dolibarr ChangeLog
|
|||
|
||||
***** ChangeLog for 3.4 compared to 3.3 *****
|
||||
For users:
|
||||
- New: Add a tab "consumption" on thirdparties to list products bought/sells.
|
||||
- New: Some performance enhancements.
|
||||
- New: Can attach files onto trip and expenses modules.
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR.
|
||||
|
|
|
|||
|
|
@ -660,6 +660,7 @@ if ($rowid)
|
|||
{
|
||||
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
|
||||
$sql.= " c.rowid as crowid, c.cotisation,";
|
||||
$sql.= " c.datec,";
|
||||
$sql.= " c.dateadh,";
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.fk_bank,";
|
||||
|
|
@ -683,7 +684,8 @@ if ($rowid)
|
|||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateSubscription").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
|
|
@ -701,6 +703,7 @@ if ($rowid)
|
|||
$cotisationstatic->ref=$objp->crowid;
|
||||
$cotisationstatic->id=$objp->crowid;
|
||||
print '<td>'.$cotisationstatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dateadh),'day')."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
|
||||
print '<td align="right">'.price($objp->cotisation).'</td>';
|
||||
|
|
@ -899,16 +902,18 @@ if ($rowid)
|
|||
// Title payments
|
||||
//print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
|
||||
|
||||
// Define a way to write payment
|
||||
// No more action
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('MoreActions');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice)?' checked="checked"':'').'> '.$langs->trans("None").'<br>';
|
||||
// Add entry into bank accoun
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(! empty($bankdirect)?' checked="checked"':'');
|
||||
print '> '.$langs->trans("MoreActionBankDirect").'<br>';
|
||||
}
|
||||
// Add invoice with no payments
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
|
||||
{
|
||||
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(! empty($invoiceonly)?' checked="checked"':'');
|
||||
|
|
@ -916,14 +921,16 @@ if ($rowid)
|
|||
print '> '.$langs->trans("MoreActionInvoiceOnly");
|
||||
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
|
||||
else
|
||||
{
|
||||
{
|
||||
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
|
||||
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty">';
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
|
||||
print '<br>';
|
||||
}
|
||||
// Add invoice with payments
|
||||
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
|
||||
{
|
||||
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(! empty($bankviainvoice)?' checked="checked"':'');
|
||||
|
|
@ -931,12 +938,13 @@ if ($rowid)
|
|||
print '> '.$langs->trans("MoreActionBankViaInvoice");
|
||||
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
|
||||
else
|
||||
{
|
||||
{
|
||||
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
|
||||
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty">';
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
|
||||
print '<br>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
|
@ -1029,4 +1037,4 @@ else
|
|||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 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
|
||||
|
|
@ -18,12 +19,12 @@
|
|||
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/admin/bank.php
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
|
|
@ -87,6 +88,16 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
|||
print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/bank.php";
|
||||
$head[$h][1] = $langs->trans("Miscellanous");
|
||||
$head[$h][2] = 'general';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2013 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
|
||||
|
|
@ -66,7 +66,7 @@ if ($action == 'updateMask')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen')
|
||||
else if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
|
|
@ -111,74 +111,36 @@ if ($action == 'specimen')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'set')
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$type='order';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||
$sql.= ")";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$type='order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE nom = '".$db->escape($value)."'";
|
||||
$sql.= " AND type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
if ($db->query($sql))
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdoc')
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$db->begin();
|
||||
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->COMMANDE_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='order';
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
|
||||
$sql_del.= " AND type = '".$type."'";
|
||||
$sql_del.= " AND entity = ".$conf->entity;
|
||||
dol_syslog("Delete from model table ".$sql_del);
|
||||
$result1=$db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$value."', '".$type."', ".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$scandir."'":"null");
|
||||
$sql.= ")";
|
||||
dol_syslog("Insert into model table ".$sql);
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Error ".$db->lasterror(), LOG_ERR);
|
||||
$db->rollback();
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,10 +202,18 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
|||
print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/commande.php";
|
||||
$head[$h][1] = $langs->trans("Orders");
|
||||
$head[$h][2] = 'Order';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
* Orders Numbering model
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("OrdersNumberingModules"));
|
||||
|
|
@ -276,22 +246,22 @@ foreach ($dirmodels as $reldir)
|
|||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$file.'.php';
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
// Show example of numbering model
|
||||
print '<td nowrap="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
|
|
@ -508,11 +478,14 @@ foreach ($dirmodels as $reldir)
|
|||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
//Autres Options
|
||||
print "<br>";
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 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
|
||||
|
|
@ -35,6 +36,10 @@ accessforbidden();
|
|||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES';
|
||||
|
||||
if ($action == 'setcomptamode')
|
||||
|
|
@ -87,7 +92,7 @@ if ($action == 'update' || $action == 'add')
|
|||
}*/
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
|
@ -97,9 +102,18 @@ $form=new Form($db);
|
|||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('ComptaSetup'),$linkback,'setup');
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/compta.php";
|
||||
$head[$h][1] = $langs->trans("Compta");
|
||||
$head[$h][2] = 'Compta';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Cas du parametre COMPTA_MODE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2013 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
|
||||
|
|
@ -27,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
|||
|
||||
$langs->load("admin");
|
||||
$langs->load("errors");
|
||||
$langs->load("contracts");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
|
@ -88,6 +90,20 @@ print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
|
|||
|
||||
print "<br>";
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/contract.php";
|
||||
$head[$h][1] = $langs->trans("Contracts");
|
||||
$head[$h][2] = 'Contract';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
/*
|
||||
* Contracts Numbering model
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("ContractsNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
|
@ -129,7 +145,7 @@ if (is_resource($handle))
|
|||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
// Show example of numbering model
|
||||
print '<td nowrap="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 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
|
||||
|
|
@ -47,7 +48,7 @@ if ($action == 'specimen')
|
|||
$don = new Don($db);
|
||||
$don->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
// Search template files
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/dons/";
|
||||
$file = $modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
|
|
@ -75,67 +76,39 @@ if ($action == 'specimen')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdoc')
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$db->begin();
|
||||
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->DON_ADDON_MODEL = $value;
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
$conf->global->DON_ADDON_MODEL = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='donation';
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del.= " WHERE nom = '".$db->escape($value)."' AND type = '".$type."'";
|
||||
$result1=$db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||
$sql.= ")";
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set')
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$type='donation';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||
$sql.= ")";
|
||||
$resql=$db->query($sql);
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$value = GETPOST('value','alpha');
|
||||
|
||||
$type='donation';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE nom = '".$value."' AND type = '".$type."'";
|
||||
$resql=$db->query($sql);
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->DON_ADDON_MODEL == "$value") dolibarr_del_const($db, 'DON_ADDON_MODEL',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -147,6 +120,17 @@ llxHeader('',$langs->trans("DonationsSetup"),'DonConfiguration');
|
|||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/dons.php";
|
||||
$head[$h][1] = $langs->trans("Donations");
|
||||
$head[$h][2] = 'Donation';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
|
||||
// Document templates
|
||||
|
|
|
|||
|
|
@ -70,6 +70,17 @@ llxHeader('',$langs->trans("ECMSetup"),$help_url);
|
|||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("ECMSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/ecm.php";
|
||||
$head[$h][1] = $langs->trans("Miscellanous");
|
||||
$head[$h][2] = 'general';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2013 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
|
||||
|
|
@ -67,42 +67,7 @@ if ($action == 'updateMask')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_FICHINTER_FREE_TEXT')
|
||||
{
|
||||
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
|
||||
{
|
||||
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
|
||||
|
||||
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen')
|
||||
else if ($action == 'specimen') // For fiche inter
|
||||
{
|
||||
$modele= GETPOST('module','alpha');
|
||||
|
||||
|
|
@ -147,12 +112,13 @@ if ($action == 'specimen')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'set')
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
|
|
@ -161,7 +127,8 @@ if ($action == 'del')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdoc')
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
|
|
@ -178,7 +145,7 @@ if ($action == 'setdoc')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
|
@ -186,6 +153,41 @@ if ($action == 'setmod')
|
|||
dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
else if ($action == 'set_FICHINTER_FREE_TEXT')
|
||||
{
|
||||
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
|
||||
{
|
||||
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
|
||||
|
||||
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -202,6 +204,17 @@ print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
|
|||
|
||||
print "<br>";
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php";
|
||||
$head[$h][1] = $langs->trans("Interventions");
|
||||
$head[$h][2] = 'Ficheinter';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
// Interventions numbering model
|
||||
|
||||
print_titre($langs->trans("FicheinterNumberingModules"));
|
||||
|
||||
|
|
@ -234,22 +247,22 @@ foreach ($dirmodels as $reldir)
|
|||
$file = $reg[1];
|
||||
$classname = substr($file,4);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/".$file.'.php';
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
// Show example of numbering model
|
||||
print '<td nowrap="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
|
|
@ -295,6 +308,9 @@ foreach ($dirmodels as $reldir)
|
|||
print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Documents models for Interventions
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("TemplatePDFInterventions"));
|
||||
|
||||
|
|
@ -377,7 +393,7 @@ foreach ($dirmodels as $reldir)
|
|||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
// Default
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
|
||||
{
|
||||
|
|
@ -413,11 +429,14 @@ foreach ($dirmodels as $reldir)
|
|||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
//Autres Options
|
||||
print "<br>";
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
|
|
|
|||
|
|
@ -103,6 +103,16 @@ llxHeader('',$langs->trans("MailingSetup"));
|
|||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("MailingSetup"),$linkback,'setup');
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/mailing.php";
|
||||
$head[$h][1] = $langs->trans("Miscellanous");
|
||||
$head[$h][2] = 'general';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2103 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -57,12 +57,12 @@ if ($action == 'update')
|
|||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
|
||||
}
|
||||
// }
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
|
|
@ -224,8 +224,8 @@ if ($action == 'edit') // Edit
|
|||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
|
|
@ -243,7 +243,7 @@ if ($action == 'edit') // Edit
|
|||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// }
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
|
@ -418,8 +418,8 @@ else // Show
|
|||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
// {
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
|
||||
|
|
@ -437,7 +437,7 @@ else // Show
|
|||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// }
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,17 @@ llxHeader('',$langs->trans("WithdrawalsSetup"));
|
|||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print_fiche_titre($langs->trans("WithdrawalsSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/prelevement.php";
|
||||
$head[$h][1] = $langs->trans("Withdrawals");
|
||||
$head[$h][2] = 'Withdrawal';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
print '<form method="post" action="prelevement.php?action=set">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2013 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
|
||||
|
|
@ -66,7 +66,7 @@ if ($action == 'updateMask')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen')
|
||||
else if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
|
|
@ -111,12 +111,13 @@ if ($action == 'specimen')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'set')
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
|
|
@ -125,7 +126,8 @@ if ($action == 'del')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdoc')
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
|
|
@ -142,7 +144,7 @@ if ($action == 'setdoc')
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
|
@ -156,7 +158,7 @@ if ($action == 'setmod')
|
|||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
llxHeader("",$langs->trans("ProjectsSetup"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
|
@ -165,8 +167,20 @@ print_fiche_titre($langs->trans("ProjectsSetup"),$linkback,'setup');
|
|||
|
||||
print "<br>";
|
||||
|
||||
$h = 0;
|
||||
|
||||
// Project numbering module
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/project.php";
|
||||
$head[$h][1] = $langs->trans("Projects");
|
||||
$head[$h][2] = 'Project';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
/*
|
||||
* Projects Numbering model
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("ProjectsNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
|
@ -198,7 +212,7 @@ foreach ($dirmodels as $reldir)
|
|||
$file = $reg[1];
|
||||
$classname = substr($file,4);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$file.'.php';
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
|
@ -213,7 +227,7 @@ foreach ($dirmodels as $reldir)
|
|||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
// Show example of numbering model
|
||||
print '<td nowrap="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
|
|
@ -269,7 +283,7 @@ print '</table><br>';
|
|||
|
||||
|
||||
/*
|
||||
* Modeles documents for projects
|
||||
* Document templates generators
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("ProjectsModelModule"));
|
||||
|
|
@ -352,7 +366,7 @@ foreach ($dirmodels as $reldir)
|
|||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
// Default
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->PROJECT_ADDON_PDF == "$name")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +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 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 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
|
||||
|
|
@ -97,6 +98,16 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
|||
print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/stock.php";
|
||||
$head[$h][1] = $langs->trans("Miscellanous");
|
||||
$head[$h][2] = 'general';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
$form=new Form($db);
|
||||
$var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
|
@ -124,9 +135,12 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<br>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
// Title rule for stock decrease
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
|
|
@ -174,9 +188,11 @@ if (! empty($conf->expedition->enabled))
|
|||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
// Title rule for stock increase
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
|
|
|
|||
|
|
@ -121,6 +121,17 @@ $form=new Form($db);
|
|||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('TaxSetup'),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/taxes.php";
|
||||
$head[$h][1] = $langs->trans("Miscellanous");
|
||||
$head[$h][2] = 'general';
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ if ($action == 'create')
|
|||
$numproject=select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
||||
if ($numproject==0)
|
||||
{
|
||||
print ' <a href="'.DOL_DOCUMENT_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -912,6 +912,12 @@ class Commande extends CommonOrder
|
|||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
|
||||
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
|
||||
$line->pa_ht = $marginInfos[0];
|
||||
$line->marge_tx = $marginInfos[1];
|
||||
$line->marque_tx = $marginInfos[2];
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,192 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file /htdocs/admin/commissions.php
|
||||
* \ingroup commissions
|
||||
* \brief Page to setup advanced commissions module
|
||||
*/
|
||||
|
||||
include '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commissions/lib/commissions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("bills");
|
||||
$langs->load("commissions");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (GETPOST('commissionBase'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
$conf->global->COMMISSION_BASE = GETPOST('commissionBase');
|
||||
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('productCommissionRate'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', GETPOST('productCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('serviceCommissionRate'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', GETPOST('serviceCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('AGENT_CONTACT_TYPE'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
$conf->global->AGENT_CONTACT_TYPE = GETPOST('AGENT_CONTACT_TYPE');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("CommissionsSetup"));
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
$head = commissions_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td align="left">'.$langs->trans("Details").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
$form = new Form($db);
|
||||
|
||||
print '<form method="post">';
|
||||
|
||||
// COMMISSION BASE (TURNOVER / MARGIN)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("CommissionBase").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="radio" name="commissionBase" value="TURNOVER" ';
|
||||
if (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print 'checked';
|
||||
print ' />';
|
||||
print $langs->trans("CommissionBasedOnTurnover");
|
||||
print '<br/>';
|
||||
print '<input type="radio" name="commissionBase" value="MARGIN" ';
|
||||
if (empty($conf->margin->enabled))
|
||||
print 'disabled';
|
||||
elseif (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print 'checked';
|
||||
print ' />';
|
||||
print $langs->trans("CommissionBasedOnMargins");
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('CommissionBaseDetails');
|
||||
print '<br/>';
|
||||
print $langs->trans('CommissionBasedOnMarginsDetails');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// PRODUCT COMMISSION RATE
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("ProductCommissionRate").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="productCommissionRate" value="'.(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:'').'" size=6 /> %';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('ProductCommissionRateDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// SERVICE COMMISSION RATE
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("ServiceCommissionRate").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="serviceCommissionRate" value="'.(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:'').'" size=6 /> %';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('ServiceCommissionRateDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("AgentContactType").'</td>';
|
||||
print '<td align="left">';
|
||||
$formcompany = new FormCompany($db);
|
||||
$facture = new Facture($db);
|
||||
print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE","internal","code",1);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('AgentContactTypeDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td align="center" colspan="3">';
|
||||
print '<input type="submit" class="button" />';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
|
@ -1,329 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/commissions/index.php
|
||||
* \ingroup commissions
|
||||
* \brief Page des commissions par agent commercial
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->margin->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
$langs->load("commissions");
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load("margins");
|
||||
|
||||
// Security check
|
||||
$agentid = GETPOST('agentid','int');
|
||||
|
||||
$mesg = '';
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$userstatic = new User($db);
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Commissions"));
|
||||
|
||||
$text=$langs->trans("Commissions");
|
||||
print_fiche_titre($text);
|
||||
|
||||
print '<form method="post" name="sel">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($agentid > 0) {
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers($agentid,'agentid',1,'',0,'','');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
}
|
||||
else {
|
||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers('','agentid',1,'',0,'','');
|
||||
print '</td></tr>';
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="u.login";
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td style="text-align: center;">';
|
||||
print '<input type="submit" value="'.$langs->trans('Launch').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
// Include unpayed invoices
|
||||
print '<tr><td>'.$langs->trans("IncludeUnpayedInvoices").'</td><td colspan="4">';
|
||||
print '<input id="selIncluded" type="checkbox" name="unpayed" ';
|
||||
if (GETPOST('unpayed') == 'on')
|
||||
print 'checked ';
|
||||
print '/>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Total Margin
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TurnoverTotal").'</td><td colspan="4">';
|
||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total Commission
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalCommission").'</td><td colspan="4">';
|
||||
print '<span id="totalCommission"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
|
||||
$sql.= " u.login,";
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ;
|
||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase" ;
|
||||
}
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ;
|
||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase" ;
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND sc.fk_soc = f.fk_soc";
|
||||
if (! empty($conf->global->AGENT_CONTACT_TYPE))
|
||||
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
|
||||
else
|
||||
$sql .= " AND sc.fk_user = u.rowid";
|
||||
if (GETPOST('unpayed') == 'on')
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
else
|
||||
$sql.= " AND f.fk_statut > 1";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($agentid > 0) {
|
||||
if (! empty($conf->global->AGENT_CONTACT_TYPE))
|
||||
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))";
|
||||
else
|
||||
$sql .= " AND sc.fk_user = ".$agentid;
|
||||
}
|
||||
if (!empty($startdate))
|
||||
$sql.= " AND f.datef >= '".$startdate."'";
|
||||
if (!empty($enddate))
|
||||
$sql.= " AND f.datef <= '".$enddate."'";
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (($conf->global->COMMISSION_BASE == "MARGIN") && isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
if ($agentid > 0)
|
||||
$sql.= " GROUP BY s.rowid";
|
||||
else
|
||||
$sql.= " GROUP BY u.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if ($agentid > 0)
|
||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
else
|
||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
|
||||
// product commission
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print_liste_field_titre($langs->trans("ProductTurnover"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
// service commission
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print_liste_field_titre($langs->trans("ServiceTurnover"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
// total commission
|
||||
print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$cumul_base_produit = 0;
|
||||
$cumul_base_service = 0;
|
||||
$cumul_commission_produit = 0;
|
||||
$cumul_commission_service = 0;
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
if ($agentid > 0) {
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->nom=$objp->nom;
|
||||
$companystatic->client=$objp->client;
|
||||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||
}
|
||||
else {
|
||||
$userstatic->id=$objp->agent;
|
||||
$userstatic->login=$objp->login;
|
||||
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
||||
}
|
||||
|
||||
// product commission
|
||||
$productCommissionRate=(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0);
|
||||
$productBase=(! empty($objp->productBase)?$objp->productBase:0);
|
||||
$productCommission = (! empty($productBase)?($productCommissionRate * $productBase / 100):0);
|
||||
print "<td align=\"right\">".price($productBase)."</td>\n";
|
||||
print "<td align=\"right\">".price($productCommissionRate)."</td>\n";
|
||||
print "<td align=\"right\">".price($productCommission)."</td>\n";
|
||||
|
||||
// service commission
|
||||
$serviceCommissionRate=(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0);
|
||||
$serviceBase=(! empty($objp->serviceBase)?$objp->serviceBase:0);
|
||||
$serviceCommission = (! empty($serviceBase)?($serviceCommissionRate * $serviceBase / 100):0);
|
||||
print "<td align=\"right\">".price($serviceBase)."</td>\n";
|
||||
print "<td align=\"right\">".price($serviceCommissionRate)."</td>\n";
|
||||
print "<td align=\"right\">".price($serviceCommission)."</td>\n";
|
||||
|
||||
// total commission
|
||||
print "<td align=\"right\">".price($productCommission + $serviceCommission)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
$cumul_base_produit += round($productBase, $rounding);
|
||||
$cumul_base_service += round($serviceBase, $rounding);
|
||||
$cumul_commission_produit += round($productCommission, $rounding);
|
||||
$cumul_commission_service += round($serviceCommission, $rounding);
|
||||
}
|
||||
}
|
||||
|
||||
// affichage totaux commission
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<td>';
|
||||
print $langs->trans('Total');
|
||||
print "</td>";
|
||||
// product commission
|
||||
print "<td align=\"right\">".price($cumul_base_produit)."</td>\n";
|
||||
print "<td align=\"right\">".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_commission_produit)."</td>\n";
|
||||
// service commission
|
||||
print "<td align=\"right\">".price($cumul_base_service)."</td>\n";
|
||||
print "<td align=\"right\">".price((! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0))."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_commission_service)."</td>\n";
|
||||
// total commission
|
||||
print "<td align=\"right\">".price($cumul_commission_produit + $cumul_commission_service)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print "</td>";
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#agentid").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#selIncluded").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#totalBase").html("<?php echo price($cumul_base_produit + $cumul_base_service); ?>");
|
||||
$("#totalCommission").html("<?php echo price($cumul_commission_produit + $cumul_commission_service); ?>");
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file /htdocs/commissions/lib/commissions.lib.php
|
||||
* \ingroup commissions
|
||||
* \brief Library for common commissions functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define head array for tabs of marges tools setup pages
|
||||
*
|
||||
* @return Array of head
|
||||
*/
|
||||
function commissions_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commissions/admin/commissions.php';
|
||||
$head[$h][1] = $langs->trans("Parameters");
|
||||
$head[$h][2] = 'parameters';
|
||||
$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); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -336,7 +336,6 @@ class FactureRec extends Facture
|
|||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_ttc = $objp->total_ttc;
|
||||
$line->export_compta = $objp->fk_export_compta;
|
||||
$line->code_ventilation = $objp->fk_code_ventilation;
|
||||
$line->rang = $objp->rang;
|
||||
$line->special_code = $objp->special_code;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
|
|
@ -866,7 +866,7 @@ class Facture extends CommonInvoice
|
|||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
// fetch optionals attributes and labels
|
||||
if(!class_exists('Extrafields'))
|
||||
|
|
@ -925,7 +925,7 @@ class Facture extends CommonInvoice
|
|||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
|
|
@ -970,7 +970,6 @@ class Facture extends CommonInvoice
|
|||
$line->total_localtax1 = $objp->total_localtax1;
|
||||
$line->total_localtax2 = $objp->total_localtax2;
|
||||
$line->total_ttc = $objp->total_ttc;
|
||||
$line->export_compta = $objp->fk_export_compta;
|
||||
$line->code_ventilation = $objp->fk_code_ventilation;
|
||||
$line->fk_fournprice = $objp->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
|
||||
|
|
@ -1860,7 +1859,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$old_statut=$this->statut;
|
||||
|
|
@ -1870,8 +1869,8 @@ class Facture extends CommonInvoice
|
|||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('BILL_UNVALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors=$interface->errors;
|
||||
$this->statut=$old_statut;
|
||||
$this->brouillon=0;
|
||||
|
|
@ -1881,7 +1880,7 @@ class Facture extends CommonInvoice
|
|||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
|
@ -3196,7 +3195,6 @@ class FactureLigne
|
|||
var $total_ttc;
|
||||
|
||||
var $fk_code_ventilation = 0;
|
||||
var $fk_export_compta = 0;
|
||||
|
||||
var $date_start;
|
||||
var $date_end;
|
||||
|
|
@ -3237,7 +3235,7 @@ class FactureLigne
|
|||
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
|
||||
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
|
||||
$sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
|
||||
$sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,';
|
||||
$sql.= ' fd.fk_code_ventilation,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||
|
|
@ -3271,7 +3269,6 @@ class FactureLigne
|
|||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->fk_code_ventilation = $objp->fk_code_ventilation;
|
||||
$this->fk_export_compta = $objp->fk_export_compta;
|
||||
$this->rang = $objp->rang;
|
||||
$this->fk_fournprice = $objp->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
|
||||
|
|
@ -3338,7 +3335,7 @@ class FactureLigne
|
|||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
|
||||
$sql.= ' (fk_facture, fk_parent_line, label, description, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
||||
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
|
||||
$sql.= ' date_start, date_end, fk_code_ventilation, fk_export_compta, ';
|
||||
$sql.= ' date_start, date_end, fk_code_ventilation, ';
|
||||
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
|
||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2)';
|
||||
$sql.= " VALUES (".$this->fk_facture.",";
|
||||
|
|
@ -3357,7 +3354,6 @@ class FactureLigne
|
|||
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").",";
|
||||
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").",";
|
||||
$sql.= ' '.$this->fk_code_ventilation.',';
|
||||
$sql.= ' '.$this->fk_export_compta.',';
|
||||
$sql.= ' '.$this->rang.',';
|
||||
$sql.= ' '.$this->special_code.',';
|
||||
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ if ($user->societe_id > 0)
|
|||
* View
|
||||
*/
|
||||
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($socid > 0)
|
||||
|
|
@ -135,7 +137,7 @@ if ($socid > 0)
|
|||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n";
|
||||
print "<td align=\"center\">".dol_print_date($fac->date,'day')."</td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id.'">'.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
|
||||
|
||||
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
|
||||
|
|
@ -146,8 +148,12 @@ if ($socid > 0)
|
|||
print '<td align="right"> </td>';
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objf->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'</a></td>';
|
||||
// Author
|
||||
$userstatic->id=$objf->userid;
|
||||
$userstatic->login=$objf->login;
|
||||
print '<td nowrap="nowrap" align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -172,7 +178,7 @@ if ($socid > 0)
|
|||
$objp = $db->fetch_object($resqlp);
|
||||
//$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
print '<td>';
|
||||
print ' '; // Decalage
|
||||
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
||||
|
|
@ -182,8 +188,12 @@ if ($socid > 0)
|
|||
$solde = $solde - $objp->amount;
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
||||
// Author
|
||||
$userstatic->id=$objp->userid;
|
||||
$userstatic->login=$objp->login;
|
||||
print '<td nowrap="nowrap" align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -214,5 +224,4 @@ else
|
|||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ print '<tr><td valign="top" width="30%">';
|
|||
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql .= " WHERE fk_export_compta = 0";
|
||||
$sql .= " WHERE fk_code_ventilation = 0";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@ if ($result)
|
|||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiement";
|
||||
$sql .= " WHERE fk_export_compta = 0";
|
||||
$sql .= " WHERE fk_code_ventilation = 0";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -62,7 +62,7 @@ if ($result)
|
|||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql .= " WHERE fk_export_compta = 0";
|
||||
$sql .= " WHERE fk_code_ventilation = 0";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -73,7 +73,7 @@ if ($result)
|
|||
}
|
||||
|
||||
/*$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiementfourn";
|
||||
$sql .= " WHERE fk_export_compta = 0";
|
||||
$sql .= " WHERE fk_code_ventilation = 0";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ if ($page < 0) $page = 0;
|
|||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total_ttc as price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
|
||||
|
|
@ -72,7 +72,7 @@ if ($result)
|
|||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de facture ventil<69>es",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
print_barre_liste($langs->trans("InvoiceDispatched"),$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
print '<form method="GET" action="lignes.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
|
@ -136,7 +136,7 @@ else
|
|||
|
||||
print "</table></form>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ $pageprev = $page - 1;
|
|||
$pagenext = $page + 1;
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.rowid, l.fk_code_ventilation,";
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facturedet as l";
|
||||
|
|
|
|||
|
|
@ -649,14 +649,16 @@ class Contrat extends CommonObject
|
|||
// Insert contract
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
|
||||
$sql.= " ref, entity)";
|
||||
$sql.= " ref, entity, note, note_public)";
|
||||
$sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id;
|
||||
$sql.= ",".$this->db->idate($this->date_contrat);
|
||||
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
||||
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
|
||||
$sql.= ",".($this->fk_projet>0?$this->fk_projet:"NULL");
|
||||
$sql.= ",".($this->fk_project>0?$this->fk_project:"NULL");
|
||||
$sql.= ", ".(dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".(!empty($this->note)?("'".$this->db->escape($this->note)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
|
@ -694,6 +696,12 @@ class Contrat extends CommonObject
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
// Add linked object
|
||||
if (! $error && $this->origin && $this->origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked();
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,27 +176,158 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->socid = $socid;
|
||||
$object->date_contrat = $datecontrat;
|
||||
|
||||
$object->commercial_suivi_id = GETPOST('commercial_suivi_id','int');
|
||||
$object->commercial_signature_id = GETPOST('commercial_signature_id','int');
|
||||
|
||||
$object->note = GETPOST('note','alpha');
|
||||
$object->note_public = GETPOST('note_public','alpha');
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
$object->remise_percent = GETPOST('remise_percent','alpha');
|
||||
$object->ref = GETPOST('ref','alpha');
|
||||
|
||||
$result = $object->create($user,$langs,$conf);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
$action='create';
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if ($_POST['origin'] && $_POST['originid'])
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $_POST['origin'];
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
|
||||
{
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if ($element == 'order') { $element = $subelement = 'commande'; }
|
||||
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
|
||||
|
||||
$object->origin = $_POST['origin'];
|
||||
$object->origin_id = $_POST['originid'];
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$object->linked_objects[$object->origin] = $object->origin_id;
|
||||
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects']))
|
||||
{
|
||||
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
|
||||
}
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id < 0) {
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||
|
||||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result=$srcobject->fetch($object->origin_id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$srcobject->fetch_thirdparty();
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
|
||||
if ($product_type == 1) { //only services
|
||||
// service prédéfini
|
||||
if ($lines[$i]->fk_product > 0)
|
||||
{
|
||||
$product_static = new Product($db);
|
||||
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
{
|
||||
$prod = new Product($db, $lines[$i]->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang)) $newlang=$srcobject->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
|
||||
}
|
||||
else
|
||||
{
|
||||
$label = $lines[$i]->product_label;
|
||||
}
|
||||
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
|
||||
}
|
||||
else {
|
||||
$desc = dol_htmlentitiesbr($lines[$i]->desc);
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start =0,
|
||||
$date_end =0,
|
||||
'HT',
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$srcobject->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $object->create($user,$langs,$conf);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -622,6 +753,51 @@ if ($action == 'create')
|
|||
$soc = new Societe($db);
|
||||
if ($socid>0) $soc->fetch($socid);
|
||||
|
||||
if (GETPOST('origin') && GETPOST('originid'))
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = GETPOST('origin');
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',GETPOST('origin'),$regs))
|
||||
{
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
if ($element == 'project')
|
||||
{
|
||||
$projectid=GETPOST('originid');
|
||||
}
|
||||
else
|
||||
{
|
||||
// For compatibility
|
||||
if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; }
|
||||
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
|
||||
|
||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||
|
||||
$classname = ucfirst($subelement);
|
||||
$objectsrc = new $classname($db);
|
||||
$objectsrc->fetch(GETPOST('originid'));
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
|
||||
$objectsrc->fetch_thirdparty();
|
||||
|
||||
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
|
||||
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
|
||||
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
|
||||
|
||||
// Object source contacts list
|
||||
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$projectid = GETPOST('projectid','int');
|
||||
$note_private = GETPOST("note");
|
||||
$note_public = GETPOST("note_public");
|
||||
}
|
||||
|
||||
$object->date_contrat = dol_now();
|
||||
|
||||
$numct = $object->getNextNumRef($soc);
|
||||
|
|
@ -687,18 +863,18 @@ if ($action == 'create')
|
|||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
select_projects($soc->id,GETPOST("projectid"),"projectid");
|
||||
select_projects($soc->id,$projectid,"projectid");
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note_public', GETPOST('note_public'), '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
$doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
/*
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print GETPOST("note_public");
|
||||
print $note_public;
|
||||
print '</textarea></td></tr>';
|
||||
*/
|
||||
|
||||
|
|
@ -706,11 +882,11 @@ if ($action == 'create')
|
|||
{
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note', GETPOST('note'), '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
$doleditor=new DolEditor('note', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
/*
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print GETPOST("note");
|
||||
print $note_private;
|
||||
print '</textarea>';*/
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
@ -721,6 +897,12 @@ if ($action == 'create')
|
|||
|
||||
print "</table>\n";
|
||||
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
}
|
||||
|
||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
||||
|
||||
print "</form>\n";
|
||||
|
|
|
|||
|
|
@ -2141,7 +2141,7 @@ abstract class CommonObject
|
|||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
// Add field of attribut
|
||||
if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
|
||||
$sql.=",".$attributeKey;
|
||||
$sql.=",".$attributeKey;
|
||||
}
|
||||
$sql .= ") VALUES (".$this->id;
|
||||
foreach($this->array_options as $key => $value)
|
||||
|
|
@ -2695,7 +2695,8 @@ abstract class CommonObject
|
|||
global $form,$bc,$bcdd;
|
||||
|
||||
$element=$this->element;
|
||||
$text='';
|
||||
|
||||
$text=''; $description=''; $type=0;
|
||||
|
||||
// Show product and description
|
||||
$type=(! empty($line->product_type)?$line->product_type:$line->fk_product_type);
|
||||
|
|
@ -2703,27 +2704,25 @@ abstract class CommonObject
|
|||
if (! empty($line->date_start)) $type=1; // deprecated
|
||||
if (! empty($line->date_end)) $type=1; // deprecated
|
||||
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
$product_static = new Product($this->db);
|
||||
|
||||
$product_static->type=$line->fk_product_type;
|
||||
$product_static->id=$line->fk_product;
|
||||
$product_static->ref=$line->ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
}
|
||||
|
||||
// Ligne en mode visu
|
||||
if ($action != 'editline' || $selected != $line->id)
|
||||
{
|
||||
// Produit
|
||||
// Product
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
// Define output language
|
||||
$product_static = new Product($this->db);
|
||||
|
||||
$product_static->type=$line->fk_product_type;
|
||||
$product_static->id=$line->fk_product;
|
||||
$product_static->ref=$line->ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
|
||||
// Define output language (TODO Does this works ?)
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
{
|
||||
$this->fetch_thirdparty();
|
||||
$prod = new Product($this->db);
|
||||
$prod->fetch($line->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
|
|
|
|||
93
htdocs/core/class/html.formcron.class.php
Normal file
93
htdocs/core/class/html.formcron.class.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cron/class/html.formcron.class.php
|
||||
* \brief Fichier de la classe des fonctions predefinie de composants html cron
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage building of HTML components
|
||||
*/
|
||||
class FormCron extends Form
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display On Off selector
|
||||
*
|
||||
* @param string $htmlname Html control name
|
||||
* @param string $selected selected value
|
||||
* @param string $readonly Select is read only or not
|
||||
* @return string HTML select field
|
||||
*/
|
||||
function select_typejob($htmlname,$selected=0,$readonly=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load('cron@cron');
|
||||
if (!empty($readonly)) {
|
||||
if ($selected=='command') {
|
||||
$out= $langs->trans('CronType_command');
|
||||
$out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
|
||||
$out.= '<OPTION value="command" selected=\"selected\">'.$langs->trans('CronType_command').'</OPTION>';
|
||||
$out.='</SELECT>';
|
||||
} elseif ($selected=='method') {
|
||||
$out= $langs->trans('CronType_method');
|
||||
$out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
|
||||
$out.= '<OPTION value="method" selected=\"selected\">'.$langs->trans('CronType_method').'</OPTION>';
|
||||
$out.='</SELECT>';
|
||||
}
|
||||
}else {
|
||||
|
||||
$out='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" />';
|
||||
|
||||
if ($selected=='command') {
|
||||
$selected_attr=' selected=\"selected\" ';
|
||||
} else {
|
||||
$selected_attr='';
|
||||
}
|
||||
$out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
|
||||
|
||||
if ($selected=='method') {
|
||||
$selected_attr=' selected=\"selected\" ';
|
||||
} else {
|
||||
$selected_attr='';
|
||||
}
|
||||
$out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
|
||||
|
||||
$out.='</SELECT>';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +90,11 @@ function societe_prepare_head($object)
|
|||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Referers");
|
||||
$head[$h][2] = 'consumption';
|
||||
$h++;
|
||||
|
||||
// Attached files
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
|
|
|
|||
71
htdocs/core/lib/cron.lib.php
Normal file
71
htdocs/core/lib/cron.lib.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@opn-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* \file cron/lib/cron.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module jobs
|
||||
* \ingroup jobs
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return array of tabs to used on pages for third parties cards.
|
||||
*
|
||||
* @param Object $object Object company shown
|
||||
* @return array Array of tabs
|
||||
*/
|
||||
|
||||
function cronadmin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/cron/admin/cron.php', 1);
|
||||
$head[$h][1] = $langs->trans("CronSetup");
|
||||
$head[$h][2] = 'setup';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin', 'remove');
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
function cron_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/cron/card.php', 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CronTask");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath('/cron/info.php', 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CronInfoPage");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cron');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cron', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
|
@ -805,17 +805,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||
}
|
||||
|
||||
// Compta simple
|
||||
if (! empty($conf->comptabilite->enabled) && ! empty($conf->global->FACTURE_VENTILATION))
|
||||
if (! empty($conf->comptabilite->enabled) && ($conf->global->MAIN_FEATURES_LEVEL >= 2))
|
||||
{
|
||||
$newmenu->add("/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Dispatch"),0,$user->rights->compta->ventilation->lire, '', $mainmenu, 'ventil');
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/export/",$langs->trans("Export"),1,$user->rights->compta->ventilation->lire);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/export/index.php?action=export",$langs->trans("New"),2,$user->rights->compta->ventilation->lire);
|
||||
if ($leftmenu=="ventil") $newmenu->add("/compta/export/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->lire);
|
||||
}
|
||||
|
||||
// Compta expert
|
||||
|
|
|
|||
|
|
@ -546,10 +546,10 @@ class pdf_expedition_merou extends ModelePdfExpedition
|
|||
$object->GetUrlTrackingStatus($object->tracking_number);
|
||||
if (! empty($object->tracking_url))
|
||||
{
|
||||
if ($object->expedition_method_id > 0)
|
||||
if ($object->shipping_method_id > 0)
|
||||
{
|
||||
// Get code using getLabelFromKey
|
||||
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
|
||||
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
|
||||
$label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -189,10 +189,10 @@ class pdf_expedition_rouget extends ModelePdfExpedition
|
|||
$object->GetUrlTrackingStatus($object->tracking_number);
|
||||
if (! empty($object->tracking_url))
|
||||
{
|
||||
if ($object->expedition_method_id > 0)
|
||||
if ($object->shipping_method_id > 0)
|
||||
{
|
||||
// Get code using getLabelFromKey
|
||||
$code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
|
||||
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
|
||||
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
|
||||
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class modBanque extends DolibarrModules
|
|||
|
||||
// Config pages
|
||||
//-------------
|
||||
$this->config_page_url = array("bank.php@compta/bank");
|
||||
$this->config_page_url = array("bank.php");
|
||||
|
||||
// Dependancies
|
||||
$this->depends = array();
|
||||
|
|
|
|||
|
|
@ -1,169 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup commissions Module commissions
|
||||
* \brief Module commissions
|
||||
* \file htdocs/core/modules/modCommissions.class.php
|
||||
* \ingroup commissions
|
||||
* \brief Description and activation file for module Commissions
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to describe modude Commisions
|
||||
*/
|
||||
class modCommissions extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 60000;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'Commissions';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "financial";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Commissions management";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=other)
|
||||
$this->special = 2;
|
||||
// Name of png file (without png) used for this module.
|
||||
// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
|
||||
$this->picto='commissions';
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||
$this->config_page_url = array("commissions.php@commissions");
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array("modFacture", "modMargin"); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->phpmin = array(5,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(3,2); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array("commissions");
|
||||
|
||||
// Constants
|
||||
$this->const = array(0=>array('COMMISSION_BASE',"chaine","TURNOVER",'Default commission base',0)); // List of particular constants to add when module is enabled
|
||||
|
||||
// New pages on tabs
|
||||
$this->tabs = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
$r=0;
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r=0;
|
||||
|
||||
// Add here list of permission defined by an id, a label, a boolean and two constant strings.
|
||||
// Example:
|
||||
// $this->rights[$r][0] = 2000; // Permission id (must not be already used)
|
||||
// $this->rights[$r][1] = 'Permision label'; // Permission label
|
||||
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
// $r++;
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r = 0;
|
||||
|
||||
// left menu entry
|
||||
$this->menu[$r]=array(
|
||||
'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu
|
||||
'type'=>'left', // This is a Top menu entry
|
||||
'titre'=>'Commissions',
|
||||
'mainmenu'=>'accountancy',
|
||||
'leftmenu'=>'commissions', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
|
||||
'url'=>'/commissions/index.php',
|
||||
'langs'=>'commissions', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>200,
|
||||
'enabled'=>'$conf->commissions->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
*
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
$result=$this->load_tables();
|
||||
|
||||
return $this->_init($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted.
|
||||
*
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create tables and keys required by module
|
||||
* Files mymodule.sql and mymodule.key.sql with create table and create keys
|
||||
* commands must be stored in directory /mymodule/sql/
|
||||
* This function is called by this->init.
|
||||
*
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function load_tables()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -16,11 +17,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \defgroup webservices Module webservices
|
||||
* \brief Module to enable the Dolibarr server of web services
|
||||
* \file htdocs/core/modules/modCron.class.php
|
||||
* \ingroup cron
|
||||
* \brief File to describe cron module
|
||||
* \defgroup cron Module cron
|
||||
* \brief cron module descriptor.
|
||||
* \file cron/core/modules/modCron.class.php
|
||||
* \ingroup cron
|
||||
* \brief Description and activation file for module Jobs
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
|
@ -65,11 +66,20 @@ class modCron extends DolibarrModules
|
|||
//-------------
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->langfiles = array("cron");
|
||||
$this->langfiles = array("cron@cron");
|
||||
|
||||
// Constantes
|
||||
//-----------
|
||||
$this->const = array();
|
||||
$this->const = array(
|
||||
0=>array(
|
||||
'MAIN_CRON_KEY',
|
||||
'chaine',
|
||||
'',
|
||||
'CRON KEY',
|
||||
0,
|
||||
'main',
|
||||
0
|
||||
),);
|
||||
|
||||
// New pages on tabs
|
||||
// -----------------
|
||||
|
|
@ -79,25 +89,60 @@ class modCron extends DolibarrModules
|
|||
//------
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
//------------
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'cron';
|
||||
$r=0;
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$this->rights_class = 'cron';
|
||||
$r=0;
|
||||
|
||||
$this->rights[$r][0] = 23001;
|
||||
$this->rights[$r][1] = 'Read cron jobs';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'read';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 23002;
|
||||
$this->rights[$r][1] = 'Create cron Jobs';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'create';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 23003;
|
||||
$this->rights[$r][1] = 'Delete cron Jobs';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'delete';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 23004;
|
||||
$this->rights[$r][1] = 'Execute cron Jobs';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'execute';
|
||||
$r++;
|
||||
|
||||
// Main menu entries
|
||||
$r=0;
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'CronJobs',
|
||||
'url'=>'/cron/index.php',
|
||||
'langs'=>'cron@cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'titre'=>'CronListActive',
|
||||
'url'=>'/cron/list.php?status=1',
|
||||
'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>200,
|
||||
'enabled'=>'$leftmenu==\'modulesadmintools\'', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->admin', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'CronListInactive',
|
||||
'url'=>'/cron/list.php?status=0',
|
||||
'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>201,
|
||||
'enabled'=>'$leftmenu==\'modulesadmintools\'', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -114,8 +159,6 @@ class modCron extends DolibarrModules
|
|||
// Prevent pb of modules not correctly disabled
|
||||
//$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* To use this template, the following var must be defined
|
||||
* $type, $text, $description, $line
|
||||
*/
|
||||
?>
|
||||
|
||||
|
|
@ -38,59 +40,59 @@
|
|||
<?php
|
||||
if ($line->description)
|
||||
{
|
||||
if ($line->description == '(CREDIT_NOTE)')
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(DEPOSIT)')
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt?' - ':'').dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
if ($line->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(DEPOSIT)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt?' - ':'').dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($line->fk_product > 0) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($line->fk_product > 0) {
|
||||
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||
|
||||
// Show range
|
||||
print_date_range($line->date_start, $line->date_end);
|
||||
// Show range
|
||||
echo get_date_range($line->date_start, $line->date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($line->label)) {
|
||||
$text.= ' <strong>'.$line->label.'</strong>';
|
||||
echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||
} else {
|
||||
|
||||
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($line->label)) {
|
||||
$text.= ' <strong>'.$line->label.'</strong>';
|
||||
echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||
} else {
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
|
||||
// Show range
|
||||
print_date_range($line->date_start,$line->date_end);
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
|
||||
// Show range
|
||||
echo get_date_range($line->date_start,$line->date_end);
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
|
|
|||
|
|
@ -1,34 +1,36 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/cron/admin/cron.php
|
||||
* \ingroup cron
|
||||
* \brief Page to setup cron module
|
||||
*/
|
||||
* \file cron/admin/cron.php
|
||||
* \ingroup cron
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
// Dolibarr environment
|
||||
$res = @include("../../main.inc.php"); // From htdocs directory
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("cron");
|
||||
$langs->load("admin");
|
||||
$langs->load("cron");
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
|
@ -36,37 +38,40 @@ if (! $user->admin)
|
|||
$actionsave=GETPOST("save");
|
||||
|
||||
// Sauvegardes parametres
|
||||
if ($actionsave)
|
||||
if (!empty($actionsave))
|
||||
{
|
||||
$i=0;
|
||||
$i=0;
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$i+=dolibarr_set_const($db,'CRON_KEY',trim(GETPOST("CRON_KEY")),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'MAIN_CRON_KEY',trim(GETPOST("MAIN_CRON_KEY")),'chaine',0,'',0);
|
||||
|
||||
if ($i >= 1)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
}
|
||||
if ($i >= 1)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("CronSetup"),$linkback,'setup');
|
||||
|
||||
print $langs->trans("CronDesc")."<br>\n";
|
||||
// Configuration header
|
||||
$head = cronadmin_prepare_head();
|
||||
dol_fiche_head($head,'setup',$langs->trans("Module2300Name"),0,'cron');
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
|
|
@ -76,13 +81,12 @@ print '<table class="noborder" width="100%">';
|
|||
print '<tr class="liste_titre">';
|
||||
print "<td>".$langs->trans("Parameter")."</td>";
|
||||
print "<td>".$langs->trans("Value")."</td>";
|
||||
//print "<td>".$langs->trans("Examples")."</td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="impair">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>';
|
||||
print '<td><input type="text" class="flat" id="CRON_KEY" name="CRON_KEY" value="'. (GETPOST('CRON_KEY')?GETPOST('CRON_KEY'):(! empty($conf->global->CRON_KEY)?$conf->global->CRON_KEY:'')) . '" size="40">';
|
||||
print '<td><input type="text" class="flat" id="MAIN_CRON_KEY" name="MAIN_CRON_KEY" value="'. (GETPOST('MAIN_CRON_KEY')?GETPOST('MAIN_CRON_KEY'):(! empty($conf->global->MAIN_CRON_KEY)?$conf->global->MAIN_CRON_KEY:'')) . '" size="40">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||
print '</td>';
|
||||
|
|
@ -102,12 +106,35 @@ print '<br><br>';
|
|||
|
||||
// Cron launch
|
||||
print '<u>'.$langs->trans("URLToLaunchCronJobs").':</u><br>';
|
||||
$url=DOL_MAIN_URL_ROOT.'/public/cron/cron_run_jobs.php'.(empty($conf->global->CRON_KEY)?'':'?securitykey='.$conf->global->CRON_KEY);
|
||||
$url=dol_buildpath('/public/cron/cron_run_jobs.php',1).(empty($conf->global->MAIN_CRON_KEY)?'':'?securitykey='.$conf->global->MAIN_CRON_KEY.'&').'userlogin='.$user->login;
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print ' '.$langs->trans("OrToLaunchASpecificJob").'<br>';
|
||||
$url=DOL_MAIN_URL_ROOT.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'id=cronjobid';
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
$url=dol_buildpath('/public/cron/cron_run_jobs.php',1).(empty($conf->global->MAIN_CRON_KEY)?'':'?securitykey='.$conf->global->MAIN_CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
|
||||
|
||||
if ($linuxlike) {
|
||||
print $langs->trans("CronExplainHowToRunUnix");
|
||||
} else {
|
||||
print $langs->trans("CronExplainHowToRunWin");
|
||||
}
|
||||
print '<br>';
|
||||
print '<u>'.$langs->trans("FileToLaunchCronJobs").':</u><br>';
|
||||
$file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->MAIN_CRON_KEY)?'securitykey':''.$conf->global->MAIN_CRON_KEY.'').' '.$user->login.' cronjobid(optionnal)';
|
||||
if ($linuxlike) {
|
||||
print 'user@host:'.DOL_DOCUMENT_ROOT.'$ php ..'.$file."<br>\n";
|
||||
} else {
|
||||
print DOL_DOCUMENT_ROOT.'> php ..'.$file."<br>\n";
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
|
@ -116,20 +143,18 @@ if (! empty($conf->use_javascript_ajax))
|
|||
{
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#generate_token").click(function() {
|
||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||
action: \'getrandompassword\',
|
||||
generic: true
|
||||
},
|
||||
function(token) {
|
||||
$("#CRON_KEY").val(token);
|
||||
});
|
||||
});
|
||||
});';
|
||||
$("#generate_token").click(function() {
|
||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||
action: \'getrandompassword\',
|
||||
generic: true
|
||||
},
|
||||
function(token) {
|
||||
$("#MAIN_CRON_KEY").val(token);
|
||||
});
|
||||
});
|
||||
});';
|
||||
print '</script>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
$db->close();
|
||||
596
htdocs/cron/card.php
Normal file
596
htdocs/cron/card.php
Normal file
|
|
@ -0,0 +1,596 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concpt.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cron/card.php
|
||||
* \ingroup cron
|
||||
* \brief Cron Jobs Card
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
// librairie jobs
|
||||
require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/html.formcron.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("cron");
|
||||
|
||||
if (!$user->rights->cron->create) accessforbidden();
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$cancel=GETPOST('cancel');
|
||||
|
||||
$object = new Cronjob($db);
|
||||
if (!empty($id)) {
|
||||
$result=$object->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($cancel)) {
|
||||
if (!empty($id)) {
|
||||
$action='';
|
||||
}else {
|
||||
Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Delete jobs
|
||||
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete){
|
||||
|
||||
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}else {
|
||||
Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
||||
}
|
||||
}
|
||||
|
||||
// Execute jobs
|
||||
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute){
|
||||
|
||||
$result=$object->run_jobs($user->login);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='';
|
||||
}else {
|
||||
$action='';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($action=='add') {
|
||||
|
||||
$object->jobtype=GETPOST('jobtype','alpha');
|
||||
$object->label=GETPOST('label','alpha');
|
||||
$object->command=GETPOST('command','alpha');
|
||||
$object->priority=GETPOST('priority','int');
|
||||
$object->classesname=GETPOST('classesname','alpha');
|
||||
$object->objectname=GETPOST('objectname','alpha');
|
||||
$object->methodename=GETPOST('methodename','alpha');
|
||||
$object->params=GETPOST('params');
|
||||
$object->md5params=GETPOST('md5params');
|
||||
$object->module_name=GETPOST('module_name','alpha');
|
||||
$object->note=GETPOST('note');
|
||||
$object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
|
||||
$object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
|
||||
$object->unitfrequency=GETPOST('unitfrequency','int');
|
||||
$object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int');
|
||||
|
||||
//Ajout de la tache cron
|
||||
$result = $object->create($user);
|
||||
|
||||
// test du Resultat de la requete
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='create';
|
||||
}
|
||||
else {
|
||||
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
// Save parameters
|
||||
if ($action=='update') {
|
||||
$object->id=$id;
|
||||
$object->jobtype=GETPOST('jobtype','alpha');
|
||||
$object->label=GETPOST('label','alpha');
|
||||
$object->command=GETPOST('command','alpha');
|
||||
$object->classesname=GETPOST('classesname','alpha');
|
||||
$object->priority=GETPOST('priority','int');
|
||||
$object->objectname=GETPOST('objectname','alpha');
|
||||
$object->methodename=GETPOST('methodename','alpha');
|
||||
$object->params=GETPOST('params');
|
||||
$object->md5params=GETPOST('md5params');
|
||||
$object->module_name=GETPOST('module_name','alpha');
|
||||
$object->note=GETPOST('note');
|
||||
$object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
|
||||
$object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
|
||||
$object->unitfrequency=GETPOST('unitfrequency','int');
|
||||
$object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int');
|
||||
|
||||
//Ajout de la tache cron
|
||||
$result = $object->update($user);
|
||||
|
||||
// test du Resultat de la requete
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
else {
|
||||
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action=='activate') {
|
||||
$object->status=1;
|
||||
|
||||
//Ajout de la tache cron
|
||||
$result = $object->update($user);
|
||||
|
||||
// test du Resultat de la requete
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
else {
|
||||
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action=='inactive') {
|
||||
$object->status=0;
|
||||
//Ajout de la tache cron
|
||||
$result = $object->update($user);
|
||||
|
||||
// test du Resultat de la requete
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
else {
|
||||
setEventMessage($langs->trans('CronSaveSucess'),'mesgs');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("CronAdd"));
|
||||
|
||||
if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') {
|
||||
$head=cron_prepare_head($object);
|
||||
dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'bill');
|
||||
} elseif ($action=='create') {
|
||||
print_fiche_titre($langs->trans("CronTask"),'','setup');
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initfields()
|
||||
{
|
||||
if ($("#jobtype option:selected").val()==\'method\') {
|
||||
$(".blockmethod").show();
|
||||
$(".blockcommand").hide();
|
||||
}
|
||||
if ($("#jobtype option:selected").val()==\'command\') {
|
||||
$(".blockmethod").hide();
|
||||
$(".blockcommand").show();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
jQuery("#jobtype").change(function() {
|
||||
initfields();
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$formCron = new FormCron($db);
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$action='';
|
||||
}
|
||||
|
||||
if ($action == 'execute'){
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Create Template
|
||||
*/
|
||||
|
||||
if (empty($object->status)) {
|
||||
dol_htmloutput_mesg($langs->trans("CronTaskInactive"),'','warning',1);
|
||||
}
|
||||
|
||||
if (($action=="create") || ($action=="edit")) {
|
||||
|
||||
print '<form name="cronform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
if (!empty($object->id)) {
|
||||
print '<input type="hidden" name="action" value="update">'."\n";
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">'."\n";
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="add">'."\n";
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print $langs->trans('CronLabel')."</td>";
|
||||
print "<td><input type=\"text\" size=\"20\" name=\"label\" value=\"".$object->label."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronType')."</td><td>";
|
||||
print $formCron->select_typejob('jobtype',$object->jobtype);
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronHourStart')."</td><td>";
|
||||
if(!empty($object->datestart)){
|
||||
$form->select_date($object->datestart,'datestart',1,1,'',"cronform");
|
||||
}
|
||||
else{
|
||||
$form->select_date(dol_now(),'datestart',1,1,'',"cronform");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronDtEnd')."</td><td>";
|
||||
if(!empty($object->dateend)){
|
||||
$form->select_date($object->dateend,'dateend',1,1,'',"cronform");
|
||||
}
|
||||
else{
|
||||
$form->select_date('','dateend',1,1,1,"cronform");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronPriority')."</td>";
|
||||
$priority=0;
|
||||
if (!empty($object->priority)) {
|
||||
$priority=$object->priority;
|
||||
}
|
||||
print "<td><input type=\"text\" size=\"2\" name=\"priority\" value=\"".$priority."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronEvery')."</td>";
|
||||
print "<td><select name=\"nbfrequency\">";
|
||||
for($i=1; $i<=60; $i++){
|
||||
if(($object->frequency/$object->unitfrequency) == $i){
|
||||
print "<option value='".$i."' selected='selected'>".$i."</option>";
|
||||
}
|
||||
else{
|
||||
print "<option value='".$i."'>".$i."</option>";
|
||||
}
|
||||
}
|
||||
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"60\" id=\"frequency_minute\" ";
|
||||
if($object->unitfrequency=="60"){
|
||||
$input .= ' checked="checked" />';
|
||||
}
|
||||
else{
|
||||
$input .= ' />';
|
||||
}
|
||||
$input .= "<label for=\"frequency_minute\">".$langs->trans('Minutes')."</label>";
|
||||
print $input;
|
||||
|
||||
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"3600\" id=\"frequency_heures\" ";
|
||||
if($object->unitfrequency=="3600"){
|
||||
$input .= ' checked="checked" />';
|
||||
}
|
||||
else{
|
||||
$input .= ' />';
|
||||
}
|
||||
$input .= "<label for=\"frequency_heures\">".$langs->trans('Hours')."</label>";
|
||||
print $input;
|
||||
|
||||
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"86400\" id=\"frequency_jours\" ";
|
||||
if($object->unitfrequency=="86400"){
|
||||
$input .= ' checked="checked" />';
|
||||
}
|
||||
else{
|
||||
$input .= ' />';
|
||||
}
|
||||
$input .= "<label for=\"frequency_jours\">".$langs->trans('Days')."</label>";
|
||||
print $input;
|
||||
|
||||
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"604800\" id=\"frequency_semaine\" ";
|
||||
if($object->unitfrequency=="604800"){
|
||||
$input .= ' checked="checked" />';
|
||||
}
|
||||
else{
|
||||
$input .= ' />';
|
||||
}
|
||||
$input .= "<label for=\"frequency_semaine\">".$langs->trans('Weeks')."</label>";
|
||||
print $input;
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronModule')."</td><td>";
|
||||
print "<input type=\"text\" size=\"20\" name=\"module_name\" value=\"".$object->module_name."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronModuleHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronClassFile')."</td><td>";
|
||||
print "<input type=\"text\" size=\"20\" name=\"classesname\" value=\"".$object->classesname."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronClassFileHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronObject')."</td><td>";
|
||||
print "<input type=\"text\" size=\"20\" name=\"objectname\" value=\"".$object->objectname."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronObjectHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronMethod')."</td><td>";
|
||||
print "<input type=\"text\" size=\"20\" name=\"methodename\" value=\"".$object->methodename."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronMethodHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronArgs')."</td><td>";
|
||||
print "<input type=\"text\" size=\"20\" name=\"params\" value=\"".$object->params."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronArgsHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="blockcommand"><td>';
|
||||
print $langs->trans('CronCommand')."</td><td>";
|
||||
print "<input type=\"text\" size=\"50\" name=\"command\" value=\"".$object->command."\" /> ";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $form->textwithpicto('',$langs->trans("CronCommandHelp"),1,'help');
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronNote')."</td><td>";
|
||||
$doleditor = new DolEditor('note', $object->note, '', 160, 'dolibarr_notes', 'In', true, false, 0, 4, 90);
|
||||
$doleditor->Create();
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
|
||||
print "<input type=\"submit\" name=\"cancel\" class=\"button\" value=\"".$langs->trans("Cancel")."\">";
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
}else {
|
||||
|
||||
/*
|
||||
* view Template
|
||||
*/
|
||||
|
||||
// box add_jobs_box
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print $langs->trans('CronId')."</td>";
|
||||
print "<td>".$form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'id');
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronLabel')."</td>";
|
||||
print "<td>".$object->label;
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronType')."</td><td>";
|
||||
print $formCron->select_typejob('jobtype',$object->jobtype,1);
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronHourStart')."</td><td>";
|
||||
if(!empty($object->datestart)) {print dol_print_date($object->datestart,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronDtEnd')."</td><td>";
|
||||
if(!empty($object->dateend)) {print dol_print_date($object->dateend,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronPriority')."</td>";
|
||||
print "<td>".$object->priority;
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronNbRun')."</td>";
|
||||
print "<td>".$object->nbrun;
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronEvery')."</td>";
|
||||
print "<td>";
|
||||
if($object->unitfrequency == "60") print $langs->trans('CronEach')." ".($object->frequency/$object->unitfrequency)." ".$langs->trans('Minutes');
|
||||
if($object->unitfrequency == "3600") print $langs->trans('CronEach')." ".($object->frequency/$object->unitfrequency)." ".$langs->trans('Hours');
|
||||
if($object->unitfrequency == "86400") print $langs->trans('CronEach')." ".($object->frequency/$object->unitfrequency)." ".$langs->trans('Days');
|
||||
if($object->unitfrequency == "604800") print $langs->trans('CronEach')." ".($object->frequency/$object->unitfrequency)." ".$langs->trans('Weeks');
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronModule')."</td><td>";
|
||||
print $object->module_name;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronClassFile')."</td><td>";
|
||||
print $object->classesname;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronObject')."</td><td>";
|
||||
print $object->objectname;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronMethod')."</td><td>";
|
||||
print $object->methodename;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr class="blockmethod"><td>';
|
||||
print $langs->trans('CronArgs')."</td><td>";
|
||||
print $object->params;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr class="blockcommand"><td>';
|
||||
print $langs->trans('CronCommand')."</td><td>";
|
||||
print $object->command;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronNote')."</td><td>";
|
||||
print $object->note;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronDtLastLaunch')."</td><td>";
|
||||
if(!empty($object->datelastrun)) {print dol_print_date($object->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronDtNextLaunch')."</td><td>";
|
||||
if(!empty($object->datenextrun)) {print dol_print_date($object->datenextrun,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronDtLastResult')."</td><td>";
|
||||
if(!empty($object->datelastresult)) {print dol_print_date($object->datelastresult,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronLastResult')."</td><td>";
|
||||
print $object->lastresult;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronLastOutput')."</td><td>";
|
||||
print nl2br($object->lastoutput);
|
||||
print "</td></tr>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "\n\n<div class=\"tabsAction\">\n";
|
||||
if (! $user->rights->cron->create) {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Edit").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("Edit").'</a>';
|
||||
}
|
||||
if (! $user->rights->cron->delete) {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
if (! $user->rights->cron->create) {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
|
||||
} else {
|
||||
if (empty($object->status)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=inactive&id='.$object->id.'">'.$langs->trans("CronStatusInactiveBtn").'</a>';
|
||||
}
|
||||
}
|
||||
if ((! $user->rights->cron->execute) || (empty($object->status))) {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronExecute").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.'">'.$langs->trans("CronExecute").'</a>';
|
||||
}
|
||||
print '<br><br></div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -17,42 +17,58 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file dev/skeletons/cronjob.class.php
|
||||
* \file cron/class/cronjob.class.php
|
||||
* \ingroup cron
|
||||
* \brief CRUD class file (Create/Read/Update/Delete) for cronjob table
|
||||
* Initialy built by build_class_from_table on 2013-03-17 18:50
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Put here description of your class
|
||||
* Crob Job class
|
||||
*/
|
||||
class Cronjob extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
var $element='cronjob'; //!< Id that identify managed objects
|
||||
var $element='cronjob'; //!< Id that identify managed objects
|
||||
var $table_element='cronjob'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
|
||||
var $ref; //Use for prevnext_ref
|
||||
var $jobtype;
|
||||
var $tms='';
|
||||
var $datec='';
|
||||
var $label;
|
||||
var $command;
|
||||
var $classesname;
|
||||
var $objectname;
|
||||
var $methodename;
|
||||
var $params;
|
||||
var $md5params;
|
||||
var $module_name;
|
||||
var $priority;
|
||||
var $datelastrun='';
|
||||
var $lastresult='';
|
||||
var $datenextrun='';
|
||||
var $dateend='';
|
||||
var $datestart='';
|
||||
var $datelastresult='';
|
||||
var $lastresult;
|
||||
var $lastoutput;
|
||||
var $fk_user;
|
||||
var $unitfrequency;
|
||||
var $frequency;
|
||||
var $status;
|
||||
var $fk_user_author;
|
||||
var $fk_user_mod;
|
||||
var $note;
|
||||
var $nbrun;
|
||||
|
||||
var $lines;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -80,51 +96,128 @@ class Cronjob extends CommonObject
|
|||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->label)) $this->label=trim($this->label);
|
||||
if (isset($this->jobtype)) $this->jobtype=trim($this->jobtype);
|
||||
if (isset($this->command)) $this->command=trim($this->command);
|
||||
if (isset($this->classesname)) $this->classesname=trim($this->classesname);
|
||||
if (isset($this->objectname)) $this->objectname=trim($this->objectname);
|
||||
if (isset($this->methodename)) $this->methodename=trim($this->methodename);
|
||||
if (isset($this->params)) $this->params=trim($this->params);
|
||||
if (isset($this->md5params)) $this->md5params=trim($this->md5params);
|
||||
if (isset($this->module_name)) $this->module_name=trim($this->module_name);
|
||||
if (isset($this->priority)) $this->priority=trim($this->priority);
|
||||
if (isset($this->lastoutput)) $this->lastoutput=trim($this->lastoutput);
|
||||
if (isset($this->fk_user)) $this->fk_user=trim($this->fk_user);
|
||||
if (isset($this->lastresult)) $this->lastresult=trim($this->lastresult);
|
||||
if (isset($this->unitfrequency)) $this->unitfrequency=trim($this->unitfrequency);
|
||||
if (isset($this->frequency)) $this->frequency=trim($this->frequency);
|
||||
if (isset($this->status)) $this->status=trim($this->status);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
|
||||
|
||||
if (isset($this->nbrun)) $this->nbrun=trim($this->nbrun);
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
// Put here code to add a control on parameters values
|
||||
if (dol_strlen($this->datestart)==0) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronDtStart'));
|
||||
$error++;
|
||||
}
|
||||
if (empty($this->label)) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronLabel'));
|
||||
$error++;
|
||||
}
|
||||
if ((dol_strlen($this->datestart)!=0) && (dol_strlen($this->dateend)!=0) && ($this->dateend<$this->datestart)) {
|
||||
$this->errors[]=$langs->trans('CronErrEndDateStartDt');
|
||||
$error++;
|
||||
}
|
||||
if (empty($this->unitfrequency)) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronFrequency'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='command') && (empty($this->command))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronCommand'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->classesname))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronClass'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->methodename))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronMethod'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->objectname))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronObject'));
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob(";
|
||||
|
||||
|
||||
$sql.= "datec,";
|
||||
$sql.= "jobtype,";
|
||||
$sql.= "label,";
|
||||
$sql.= "command,";
|
||||
$sql.= "classesname,";
|
||||
$sql.= "objectname,";
|
||||
$sql.= "methodename,";
|
||||
$sql.= "params,";
|
||||
$sql.= "md5params,";
|
||||
$sql.= "module_name,";
|
||||
$sql.= "priority,";
|
||||
$sql.= "datelastrun,";
|
||||
$sql.= "datenextrun,";
|
||||
$sql.= "dateend,";
|
||||
$sql.= "datestart,";
|
||||
$sql.= "lastresult,";
|
||||
$sql.= "datelastresult,";
|
||||
$sql.= "lastoutput,";
|
||||
$sql.= "fk_user,";
|
||||
$sql.= "note";
|
||||
|
||||
$sql.= "unitfrequency,";
|
||||
$sql.= "frequency,";
|
||||
$sql.= "status,";
|
||||
$sql.= "fk_user_author,";
|
||||
$sql.= "fk_user_mod,";
|
||||
$sql.= "note,";
|
||||
$sql.= "nbrun";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->datec) || dol_strlen($this->datec)==0?'NULL':$this->db->idate($this->datec)).",";
|
||||
|
||||
$sql.= " ".$this->db->idate(dol_now()).",";
|
||||
$sql.= " ".(! isset($this->jobtype)?'NULL':"'".$this->db->escape($this->jobtype)."'").",";
|
||||
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||
$sql.= " ".(! isset($this->command)?'NULL':"'".$this->db->escape($this->command)."'").",";
|
||||
$sql.= " ".(! isset($this->classesname)?'NULL':"'".$this->db->escape($this->classesname)."'").",";
|
||||
$sql.= " ".(! isset($this->objectname)?'NULL':"'".$this->db->escape($this->objectname)."'").",";
|
||||
$sql.= " ".(! isset($this->methodename)?'NULL':"'".$this->db->escape($this->methodename)."'").",";
|
||||
$sql.= " ".(! isset($this->params)?'NULL':"'".$this->db->escape($this->params)."'").",";
|
||||
$sql.= " ".(! isset($this->md5params)?'NULL':"'".$this->db->escape($this->md5params)."'").",";
|
||||
$sql.= " ".(! isset($this->module_name)?'NULL':"'".$this->db->escape($this->module_name)."'").",";
|
||||
$sql.= " ".(! isset($this->priority)?'NULL':"'".$this->priority."'").",";
|
||||
$sql.= " ".(! isset($this->datelastrun) || dol_strlen($this->datelastrun)==0?'NULL':$this->db->idate($this->datelastrun)).",";
|
||||
$sql.= " ".(! isset($this->lastresult) || dol_strlen($this->lastresult)==0?'NULL':$this->db->idate($this->lastresult)).",";
|
||||
$sql.= " ".(! isset($this->datenextrun) || dol_strlen($this->datenextrun)==0?'NULL':$this->db->idate($this->datenextrun)).",";
|
||||
$sql.= " ".(! isset($this->dateend) || dol_strlen($this->dateend)==0?'NULL':$this->db->idate($this->dateend)).",";
|
||||
$sql.= " ".(! isset($this->datestart) || dol_strlen($this->datestart)==0?'NULL':$this->db->idate($this->datestart)).",";
|
||||
$sql.= " ".(! isset($this->lastresult)?'NULL':"'".$this->db->escape($this->lastresult)."'").",";
|
||||
$sql.= " ".(! isset($this->datelastresult) || dol_strlen($this->datelastresult)==0?'NULL':$this->db->idate($this->datelastresult)).",";
|
||||
$sql.= " ".(! isset($this->lastoutput)?'NULL':"'".$this->db->escape($this->lastoutput)."'").",";
|
||||
$sql.= " ".(! isset($this->fk_user)?'NULL':"'".$this->fk_user."'").",";
|
||||
$sql.= " ".(! isset($this->note)?'NULL':"'".$this->db->escape($this->note)."'")."";
|
||||
|
||||
$sql.= " ".(! isset($this->unitfrequency)?'NULL':"'".$this->unitfrequency."'").",";
|
||||
$sql.= " ".(! isset($this->frequency)?'NULL':"'".$this->frequency."'").",";
|
||||
$sql.= " ".(! isset($this->status)?'0':"'".$this->status."'").",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".(! isset($this->note)?'NULL':"'".$this->db->escape($this->note)."'").",";
|
||||
$sql.= " ".(! isset($this->nbrun)?'0':"'".$this->db->escape($this->nbrun)."'")."";
|
||||
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."cronjob");
|
||||
|
|
@ -173,18 +266,35 @@ class Cronjob extends CommonObject
|
|||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.jobtype,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.command,";
|
||||
$sql.= " t.classesname,";
|
||||
$sql.= " t.objectname,";
|
||||
$sql.= " t.methodename,";
|
||||
$sql.= " t.params,";
|
||||
$sql.= " t.md5params,";
|
||||
$sql.= " t.module_name,";
|
||||
$sql.= " t.priority,";
|
||||
$sql.= " t.datelastrun,";
|
||||
$sql.= " t.datenextrun,";
|
||||
$sql.= " t.dateend,";
|
||||
$sql.= " t.datestart,";
|
||||
$sql.= " t.lastresult,";
|
||||
$sql.= " t.datelastresult,";
|
||||
$sql.= " t.lastoutput,";
|
||||
$sql.= " t.fk_user,";
|
||||
$sql.= " t.note";
|
||||
|
||||
$sql.= " t.unitfrequency,";
|
||||
$sql.= " t.frequency,";
|
||||
$sql.= " t.status,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.note,";
|
||||
$sql.= " t.nbrun";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
|
|
@ -197,18 +307,36 @@ class Cronjob extends CommonObject
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->label = $obj->label;
|
||||
$this->jobtype = $obj->jobtype;
|
||||
$this->command = $obj->command;
|
||||
$this->classesname = $obj->classesname;
|
||||
$this->objectname = $obj->objectname;
|
||||
$this->methodename = $obj->methodename;
|
||||
$this->params = $obj->params;
|
||||
$this->md5params = $obj->md5params;
|
||||
$this->module_name = $obj->module_name;
|
||||
$this->priority = $obj->priority;
|
||||
$this->datelastrun = $this->db->jdate($obj->datelastrun);
|
||||
$this->lastresult = $this->db->jdate($obj->lastresult);
|
||||
$this->datenextrun = $this->db->jdate($obj->datenextrun);
|
||||
$this->dateend = $this->db->jdate($obj->dateend);
|
||||
$this->datestart = $this->db->jdate($obj->datestart);
|
||||
$this->lastresult = $obj->lastresult;
|
||||
$this->lastoutput = $obj->lastoutput;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->datelastresult = $this->db->jdate($obj->datelastresult);
|
||||
$this->unitfrequency = $obj->unitfrequency;
|
||||
$this->frequency = $obj->frequency;
|
||||
$this->status = $obj->status;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_mod = $obj->fk_user_mod;
|
||||
$this->note = $obj->note;
|
||||
$this->nbrun = $obj->nbrun;
|
||||
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
@ -221,6 +349,141 @@ class Cronjob extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder sort order
|
||||
* @param string $sortfield sort field
|
||||
* @param int $limit limit page
|
||||
* @param int $offset page
|
||||
* @param int $status display active or not
|
||||
* @param array $filter filter output
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.jobtype,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.command,";
|
||||
$sql.= " t.classesname,";
|
||||
$sql.= " t.objectname,";
|
||||
$sql.= " t.methodename,";
|
||||
$sql.= " t.params,";
|
||||
$sql.= " t.md5params,";
|
||||
$sql.= " t.module_name,";
|
||||
$sql.= " t.priority,";
|
||||
$sql.= " t.datelastrun,";
|
||||
$sql.= " t.datenextrun,";
|
||||
$sql.= " t.dateend,";
|
||||
$sql.= " t.datestart,";
|
||||
$sql.= " t.lastresult,";
|
||||
$sql.= " t.datelastresult,";
|
||||
$sql.= " t.lastoutput,";
|
||||
$sql.= " t.unitfrequency,";
|
||||
$sql.= " t.frequency,";
|
||||
$sql.= " t.status,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.note,";
|
||||
$sql.= " t.nbrun";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
||||
$status = (empty($status))?'0':'1';
|
||||
$sql.= " WHERE t.status=".$status;
|
||||
//Manage filter
|
||||
if (is_array($filter) && count($filter)>0) {
|
||||
foreach($filter as $key => $value) {
|
||||
$sql.= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
if (!empty($limit) && !empty($offset)) {
|
||||
$sql.= $this->db->plimit( $limit + 1 ,$offset);
|
||||
}
|
||||
|
||||
$sqlwhere = array();
|
||||
|
||||
if (!empty($module_name)) {
|
||||
$sqlwhere[]='(t.module_name='.$module_name.')';
|
||||
}
|
||||
if (count($sqlwhere)>0) {
|
||||
$sql.= " WHERE ".implode(' AND ',$sqlwhere);
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num=$this->db->num_rows($resql);
|
||||
$i=0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$line = new Cronjobline();
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->ref = $obj->rowid;
|
||||
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
$line->label = $obj->label;
|
||||
$line->jobtype = $obj->jobtype;
|
||||
$line->command = $obj->command;
|
||||
$line->classesname = $obj->classesname;
|
||||
$line->objectname = $obj->objectname;
|
||||
$line->methodename = $obj->methodename;
|
||||
$line->params = $obj->params;
|
||||
$line->md5params = $obj->md5params;
|
||||
$line->module_name = $obj->module_name;
|
||||
$line->priority = $obj->priority;
|
||||
$line->datelastrun = $this->db->jdate($obj->datelastrun);
|
||||
$line->datenextrun = $this->db->jdate($obj->datenextrun);
|
||||
$line->dateend = $this->db->jdate($obj->dateend);
|
||||
$line->datestart = $this->db->jdate($obj->datestart);
|
||||
$line->lastresult = $obj->lastresult;
|
||||
$line->datelastresult = $this->db->jdate($obj->datelastresult);
|
||||
$line->lastoutput = $obj->lastoutput;
|
||||
$line->unitfrequency = $obj->unitfrequency;
|
||||
$line->frequency = $obj->frequency;
|
||||
$line->status = $obj->status;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->fk_user_mod = $obj->fk_user_mod;
|
||||
$line->note = $obj->note;
|
||||
$line->nbrun = $obj->nbrun;
|
||||
|
||||
$this->lines[]=$line;
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -233,35 +496,98 @@ class Cronjob extends CommonObject
|
|||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load('cron');
|
||||
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->label)) $this->label=trim($this->label);
|
||||
if (isset($this->jobtype)) $this->jobtype=trim($this->jobtype);
|
||||
if (isset($this->command)) $this->command=trim($this->command);
|
||||
if (isset($this->classesname)) $this->classesname=trim($this->classesname);
|
||||
if (isset($this->objectname)) $this->objectname=trim($this->objectname);
|
||||
if (isset($this->methodename)) $this->methodename=trim($this->methodename);
|
||||
if (isset($this->params)) $this->params=trim($this->params);
|
||||
if (isset($this->md5params)) $this->md5params=trim($this->md5params);
|
||||
if (isset($this->module_name)) $this->module_name=trim($this->module_name);
|
||||
if (isset($this->priority)) $this->priority=trim($this->priority);
|
||||
if (isset($this->lastoutput)) $this->lastoutput=trim($this->lastoutput);
|
||||
if (isset($this->fk_user)) $this->fk_user=trim($this->fk_user);
|
||||
if (isset($this->lastresult)) $this->lastresult=trim($this->lastresult);
|
||||
if (isset($this->unitfrequency)) $this->unitfrequency=trim($this->unitfrequency);
|
||||
if (isset($this->frequency)) $this->frequency=trim($this->frequency);
|
||||
if (isset($this->status)) $this->status=trim($this->status);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
|
||||
|
||||
if (isset($this->nbrun)) $this->nbrun=trim($this->nbrun);
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
if (empty($this->status)) {
|
||||
$this->dateend=dol_now();
|
||||
}
|
||||
if (dol_strlen($this->datestart)==0) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronDtStart'));
|
||||
$error++;
|
||||
}
|
||||
if ((dol_strlen($this->datestart)!=0) && (dol_strlen($this->dateend)!=0) && ($this->dateend<$this->datestart)) {
|
||||
$this->errors[]=$langs->trans('CronErrEndDateStartDt');
|
||||
$error++;
|
||||
}
|
||||
if (empty($this->label)) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronLabel'));
|
||||
$error++;
|
||||
}
|
||||
if (empty($this->unitfrequency)) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronFrequency'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='command') && (empty($this->command))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronCommand'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->classesname))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronClass'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->methodename))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronMethod'));
|
||||
$error++;
|
||||
}
|
||||
if (($this->jobtype=='method') && (empty($this->objectname))) {
|
||||
$this->errors[]=$langs->trans('CronFieldMandatory',$langs->trans('CronObject'));
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."cronjob SET";
|
||||
|
||||
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||
|
||||
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " jobtype=".(isset($this->jobtype)?"'".$this->db->escape($this->jobtype)."'":"null").",";
|
||||
$sql.= " command=".(isset($this->command)?"'".$this->db->escape($this->command)."'":"null").",";
|
||||
$sql.= " classesname=".(isset($this->classesname)?"'".$this->db->escape($this->classesname)."'":"null").",";
|
||||
$sql.= " objectname=".(isset($this->objectname)?"'".$this->db->escape($this->objectname)."'":"null").",";
|
||||
$sql.= " methodename=".(isset($this->methodename)?"'".$this->db->escape($this->methodename)."'":"null").",";
|
||||
$sql.= " params=".(isset($this->params)?"'".$this->db->escape($this->params)."'":"null").",";
|
||||
$sql.= " md5params=".(isset($this->md5params)?"'".$this->db->escape($this->md5params)."'":"null").",";
|
||||
$sql.= " module_name=".(isset($this->module_name)?"'".$this->db->escape($this->module_name)."'":"null").",";
|
||||
$sql.= " priority=".(isset($this->priority)?$this->priority:"null").",";
|
||||
$sql.= " datelastrun=".(dol_strlen($this->datelastrun)!=0 ? "'".$this->db->idate($this->datelastrun)."'" : 'null').",";
|
||||
$sql.= " lastresult=".(dol_strlen($this->lastresult)!=0 ? "'".$this->db->idate($this->lastresult)."'" : 'null').",";
|
||||
$sql.= " datenextrun=".(dol_strlen($this->datenextrun)!=0 ? "'".$this->db->idate($this->datenextrun)."'" : 'null').",";
|
||||
$sql.= " dateend=".(dol_strlen($this->dateend)!=0 ? "'".$this->db->idate($this->dateend)."'" : 'null').",";
|
||||
$sql.= " datestart=".(dol_strlen($this->datestart)!=0 ? "'".$this->db->idate($this->datestart)."'" : 'null').",";
|
||||
$sql.= " datelastresult=".(dol_strlen($this->datelastresult)!=0 ? "'".$this->db->idate($this->datelastresult)."'" : 'null').",";
|
||||
$sql.= " lastresult=".(isset($this->lastresult)?"'".$this->db->escape($this->lastresult)."'":"null").",";
|
||||
$sql.= " lastoutput=".(isset($this->lastoutput)?"'".$this->db->escape($this->lastoutput)."'":"null").",";
|
||||
$sql.= " fk_user=".(isset($this->fk_user)?$this->fk_user:"null").",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null")."";
|
||||
|
||||
$sql.= " unitfrequency=".(isset($this->unitfrequency)?$this->unitfrequency:"null").",";
|
||||
$sql.= " frequency=".(isset($this->frequency)?$this->frequency:"null").",";
|
||||
$sql.= " status=".(isset($this->status)?$this->status:"null").",";
|
||||
$sql.= " fk_user_mod=".$user->id.",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
|
||||
$sql.= " nbrun=".(isset($this->nbrun)?$this->nbrun:"null");
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -269,7 +595,7 @@ class Cronjob extends CommonObject
|
|||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
|
|
@ -377,7 +703,7 @@ class Cronjob extends CommonObject
|
|||
|
||||
$error=0;
|
||||
|
||||
$object=new Cronjobs($this->db);
|
||||
$object=new Cronjob($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
@ -428,19 +754,277 @@ class Cronjob extends CommonObject
|
|||
function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
$this->ref=0;
|
||||
|
||||
$this->tms='';
|
||||
$this->datec='';
|
||||
$this->label='';
|
||||
$this->jobtype='';
|
||||
$this->command='';
|
||||
$this->classesname='';
|
||||
$this->objectname='';
|
||||
$this->methodename='';
|
||||
$this->params='';
|
||||
$this->md5params='';
|
||||
$this->module_name='';
|
||||
$this->priority='';
|
||||
$this->datelastrun='';
|
||||
$this->lastresult='';
|
||||
$this->datenextrun='';
|
||||
$this->dateend='';
|
||||
$this->datestart='';
|
||||
$this->datelastresult='';
|
||||
$this->lastoutput='';
|
||||
$this->fk_user='';
|
||||
$this->note='';
|
||||
|
||||
|
||||
$this->lastresult='';
|
||||
$this->unitfrequency='';
|
||||
$this->frequency='';
|
||||
$this->status='';
|
||||
$this->fk_user_author='';
|
||||
$this->fk_user_mod='';
|
||||
$this->note='';
|
||||
$this->nbrun='';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object information
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " f.rowid, f.datec, f.tms, f.fk_user_mod, f.fk_user_author";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as f";
|
||||
$sql.= " WHERE f.rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
$this->user_modification = $obj->fk_user_mod;
|
||||
$this->user_creation = $obj->fk_user_author;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run a job
|
||||
*
|
||||
* @param string $userlogin User login
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function run_jobs($userlogin)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load('cron');
|
||||
|
||||
if (empty($userlogin)) {
|
||||
$this->error="User login is mandatory";
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user=new User($this->db);
|
||||
$result=$user->fetch('',$userlogin);
|
||||
if ($result<0) {
|
||||
$this->error="User Error:".$user->error;
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}else {
|
||||
if (empty($user->id)) {
|
||||
$this->error=" User user login:".$userlogin." do not exists";
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs userlogin:$userlogin", LOG_DEBUG);
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($this->jobtype=='method') {
|
||||
// load classes
|
||||
$ret=dol_include_once("/".$this->module_name."/class/".$this->classesname,$this->objectname);
|
||||
if ($ret===false) {
|
||||
$this->error=$langs->trans('CronCannotLoadClass',$file,$this->objectname);
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Load langs
|
||||
$result=$langs->load($this->module_name.'@'.$this->module_name);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs Cannot load module langs".$langs->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->objectname."->".$this->methodename."(".$this->params.");", LOG_DEBUG);
|
||||
|
||||
// Create Object for the call module
|
||||
$object = new $this->objectname($this->db);
|
||||
|
||||
$params_arr = array();
|
||||
$params_arr=explode(", ",$this->params);
|
||||
if (!is_array($params_arr)) {
|
||||
$result = call_user_func(array($object, $this->methodename), $this->params);
|
||||
}else {
|
||||
$result = call_user_func_array(array($object, $this->methodename), $params_arr);
|
||||
}
|
||||
|
||||
if ($result===false) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$object->error, LOG_ERR);
|
||||
return -1;
|
||||
}else {
|
||||
$this->lastoutput=var_export($result,true);
|
||||
$this->lastresult=var_export($result,true);
|
||||
}
|
||||
|
||||
} elseif ($this->jobtype=='command') {
|
||||
dol_syslog(get_class($this)."::run_jobs system:".$this->command, LOG_DEBUG);
|
||||
$output_arr=array();
|
||||
|
||||
exec($this->command, $output_arr,$retval);
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
|
||||
|
||||
$this->lastoutput='';
|
||||
if (is_array($output_arr) && count($output_arr)>0) {
|
||||
foreach($output_arr as $val) {
|
||||
$this->lastoutput.=$val."\n";
|
||||
}
|
||||
}
|
||||
$this->lastresult=$retval;
|
||||
}
|
||||
|
||||
$this->datelastresult=$now;
|
||||
$this->datelastrun=$now;
|
||||
$this->nbrun=$this->nbrun+1;
|
||||
$result = $this->update($user);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reprogram a job
|
||||
*
|
||||
* @param string $userlogin User login
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*
|
||||
*/
|
||||
function reprogram_jobs($userlogin)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user=new User($this->db);
|
||||
$result=$user->fetch('',$userlogin);
|
||||
if ($result<0) {
|
||||
$this->error="User Error:".$user->error;
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}else {
|
||||
if (empty($user->id)) {
|
||||
$this->error=" User user login:".$userlogin." do not exists";
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ", LOG_DEBUG);
|
||||
|
||||
if (empty($this->datenextrun)) {
|
||||
$this->datenextrun=dol_now()+$this->frequency;
|
||||
} else {
|
||||
if ($this->datenextrun<dol_now()) {
|
||||
$this->datenextrun=dol_now()+$this->frequency;
|
||||
} else {
|
||||
$this->datenextrun=$this->datenextrun+$this->frequency;
|
||||
}
|
||||
}
|
||||
$result = $this->update($user);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
/**
|
||||
* Crob Job line class
|
||||
*/
|
||||
class Cronjobline{
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
|
||||
var $tms='';
|
||||
var $datec='';
|
||||
var $label;
|
||||
var $jobtype;
|
||||
var $command;
|
||||
var $classesname;
|
||||
var $objectname;
|
||||
var $methodename;
|
||||
var $params;
|
||||
var $md5params;
|
||||
var $module_name;
|
||||
var $priority;
|
||||
var $datelastrun='';
|
||||
var $datenextrun='';
|
||||
var $dateend='';
|
||||
var $datestart='';
|
||||
var $lastresult='';
|
||||
var $lastoutput;
|
||||
var $unitfrequency;
|
||||
var $frequency;
|
||||
var $status;
|
||||
var $fk_user_author;
|
||||
var $fk_user_mod;
|
||||
var $note;
|
||||
var $nbrun;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cron/functions_cron.lib.php
|
||||
* \ingroup core
|
||||
* \brief Functions for miscellaneous cron tasks
|
||||
*/
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/Cronjobss/Cronjobs_page.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example of a php page
|
||||
* Initialy built by build_class_from_table on 2013-03-17 18:50
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php';
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php';
|
||||
if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
dol_include_once('/module/class/cronjob.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
$langs->load("cron");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$myparam = GETPOST('myparam','alpha');
|
||||
$action='list';
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$object=new Cronjobs($db);
|
||||
$object->prop1=$_POST["field1"];
|
||||
$object->prop2=$_POST["field2"];
|
||||
$result=$object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
}
|
||||
{
|
||||
// Creation KO
|
||||
$mesg=$object->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
|
||||
llxHeader('','MyPageName','');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
//print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_needroot();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
// Example 2 : Adding links to objects
|
||||
// The class must extends CommonObject class to have this method available
|
||||
//$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
|
||||
// Example 3 : List of data
|
||||
if ($action == 'list')
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.command,";
|
||||
$sql.= " t.params,";
|
||||
$sql.= " t.datelastrun,";
|
||||
$sql.= " t.lastresult,";
|
||||
$sql.= " t.lastoutput,";
|
||||
$sql.= " t.fk_user,";
|
||||
$sql.= " t.note";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
||||
//$sql.= " WHERE field3 = 'xxx'";
|
||||
//$sql.= " ORDER BY field1 ASC";
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfCronJobs"),'','').'<br>';
|
||||
|
||||
|
||||
print '<table class="noborder">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Id'),$_SERVER['PHP_SELF'],'t.rowid','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Command'),$_SERVER['PHP_SELF'],'t.command','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateCreation'),$_SERVER['PHP_SELF'],'t.datec','align="center"',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('LastOutput'),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateLastRun'),$_SERVER['PHP_SELF'],'t.datelastrun','align="center"',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('LastResult'),$_SERVER['PHP_SELF'],'t.lastresult','align="right"',$param,'',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
dol_syslog($script_file." sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
// You can use here results
|
||||
print '<tr><td>';
|
||||
print $obj->rowid;
|
||||
print '</td><td>';
|
||||
print $obj->command;
|
||||
print '</td><td align="center">';
|
||||
print $db->jdate($obj->datec);
|
||||
print '</td><td>';
|
||||
print '';
|
||||
print '</td><td align="center">';
|
||||
print $db->jdate($obj->datelastrun);
|
||||
print '</td><td align="right">';
|
||||
print $obj->lastresult;
|
||||
print '</td></tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
}
|
||||
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '<div></div></div>';
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
59
htdocs/cron/info.php
Normal file
59
htdocs/cron/info.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file /cron/cron/info.php
|
||||
* \brief Page fiche d'une operation
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->cron->read) accessforbidden();
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
|
||||
$mesg = '';
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("CronInfo"));
|
||||
|
||||
$object = new Cronjob($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = cron_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("CronTask"), 0, 'bill');
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
295
htdocs/cron/list.php
Normal file
295
htdocs/cron/list.php
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file cron/cron/list.php
|
||||
* \ingroup cron
|
||||
* \brief Lists Jobs
|
||||
*/
|
||||
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
|
||||
// librairie jobs
|
||||
require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("cron");
|
||||
|
||||
if (!$user->rights->cron->read) accessforbidden();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
|
||||
$sortorder=GETPOST('sortorder','alpha');
|
||||
$sortfield=GETPOST('sortfield','alpha');
|
||||
$page=GETPOST('page','int');
|
||||
$status=GETPOST('status','int');
|
||||
|
||||
//Search criteria
|
||||
$search_label=GETPOST("search_label",'alpha');
|
||||
|
||||
if (empty($sortorder)) $sortorder="DESC";
|
||||
if (empty($sortfield)) $sortfield="t.datenextrun";
|
||||
if (empty($arch)) $arch = 0;
|
||||
|
||||
if ($page == -1) {
|
||||
$page = 0 ;
|
||||
}
|
||||
|
||||
$limit = $conf->global->MAIN_SIZE_LISTE_LIMIT;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_label='';
|
||||
}
|
||||
|
||||
$filter=array();
|
||||
if (!empty($search_label)) {
|
||||
$filter['t.label']=$search_label;
|
||||
}
|
||||
|
||||
// Delete jobs
|
||||
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete){
|
||||
|
||||
//Delete de la tache cron
|
||||
$object = new Cronjob($db);
|
||||
$object->id=$id;
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Execute jobs
|
||||
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute){
|
||||
|
||||
//Execute jobs
|
||||
$object = new Cronjob($db);
|
||||
$job = $object->fetch($id);
|
||||
|
||||
$result = $object->run_jobs($user->login);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
if (!empty($status)) {
|
||||
$pagetitle=$langs->trans("CronListActive");
|
||||
}else {
|
||||
$pagetitle=$langs->trans("CronListInactive");
|
||||
}
|
||||
|
||||
llxHeader('',$pagetitle);
|
||||
|
||||
|
||||
// Form object for popup
|
||||
$form = new Form($db);
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
if ($action == 'execute'){
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print_fiche_titre($pagetitle,'','setup');
|
||||
|
||||
print $langs->trans('CronInfo');
|
||||
|
||||
// liste des jobs creer
|
||||
$object = new Cronjob($db);
|
||||
$result=$object->fetch_all($sortorder, $sortfield, $limit, $offset, $status, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
|
||||
print "<p><h2>";
|
||||
print $langs->trans('CronWaitingJobs');
|
||||
print "</h2></p>";
|
||||
|
||||
if (count($object->lines)>0) {
|
||||
|
||||
print '<table width="100%" cellspacing="0" cellpadding="4" class="border">';
|
||||
print '<tr class="liste_titre">';
|
||||
$arg_url='&page='.$page.'&status='.$status.'&search_label='.$search_label;
|
||||
print_liste_field_titre($langs->trans("CronLabel"),$_SERVEUR['PHP_SELF'],"t.label","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronTask"),'','',"",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronDtStart"),$_SERVEUR['PHP_SELF'],"t.datestart","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronDtEnd"),$_SERVEUR['PHP_SELF'],"t.dateend","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronDtLastLaunch"),$_SERVEUR['PHP_SELF'],"t.datelastrun","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronDtNextLaunch"),$_SERVEUR['PHP_SELF'],"t.datenextrun","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronFrequency"),'',"","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronNbRun"),$_SERVEUR['PHP_SELF'],"t.nbrun","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronLastResult"),$_SERVEUR['PHP_SELF'],"t.lastresult","",$arg_url,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVEUR['PHP_SELF'],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder);
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<form method="get" action="'.$url_form.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="status" value="'.$status.'" >';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
print '</from>';
|
||||
|
||||
|
||||
|
||||
// Boucler sur chaque job
|
||||
$style='impair';
|
||||
foreach($object->lines as $line){
|
||||
// title profil
|
||||
if ($style=='pair') {$style='impair';}
|
||||
else {$style='pair';}
|
||||
|
||||
print '<tr class="'.$style.'">';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->label)) {
|
||||
print '<a href="'.dol_buildpath('/cron/cron/card.php',1).'?id='.$line->id.'">'.$line->label.'</a>';
|
||||
}
|
||||
else {
|
||||
print $langs->trans('CronNone');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($line->jobtype=='method') {
|
||||
print $langs->trans('CronModule').':'.$line->module_name.'<BR>';
|
||||
print $langs->trans('CronClass').':'. $line->classesname.'<BR>';
|
||||
print $langs->trans('CronObject').':'. $line->objectname.'<BR>';
|
||||
print $langs->trans('CronMethod').':'. $line->methodename;
|
||||
if(!empty($line->params)) {
|
||||
print '<BR/>'.$langs->trans('CronArgs').':'. $line->params;
|
||||
}
|
||||
|
||||
}elseif ($line->jobtype=='command') {
|
||||
print $langs->trans('CronCommand').':'. dol_trunc($line->command);
|
||||
if(!empty($line->params)) {
|
||||
print '<BR/>'.$langs->trans('CronArgs').':'. $line->params;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->datestart)) {print dol_print_date($line->datestart,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->dateend)) {print dol_print_date($line->dateend,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->datelastrun)) {print dol_print_date($line->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->datenextrun)) {print dol_print_date($line->datenextrun,'dayhourtext');} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if($line->unitfrequency == "60") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Minutes');
|
||||
if($line->unitfrequency == "3600") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Hours');
|
||||
if($line->unitfrequency == "86400") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Days');
|
||||
if($line->unitfrequency == "604800") print $langs->trans('CronEach')." ".($line->frequency/$line->unitfrequency)." ".$langs->trans('Weeks');
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->nbrun)) {print $line->nbrun;} else {print '0';}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->lastresult)) {print dol_trunc($line->lastresult);} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if(!empty($line->lastoutput)) {print dol_trunc(nl2br($line->lastoutput),100);} else {print $langs->trans('CronNone');}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($user->rights->cron->delete) {
|
||||
print "<a href=\"".dol_buildpath('/cron/cron/list.php',1)."?id=".$line->id."&status=".$status."&action=delete\" title=\"".$langs->trans('CronDelete')."\"><img src=\"".dol_buildpath('/cron/img/delete.png',1)."\" alt=\"".$langs->trans('CronDelete')."\" /></a>";
|
||||
} else {
|
||||
print "<a href=\"#\" title=\"".$langs->trans('NotEnoughPermissions')."\"><img src=\"".dol_buildpath('/cron/img/delete.png',1)."\" alt=\"".$langs->trans('NotEnoughPermissions')."\" /></a>";
|
||||
}
|
||||
if ($user->rights->cron->execute) {
|
||||
print "<a href=\"".dol_buildpath('/cron/cron/list.php',1)."?id=".$line->id."&status=".$status."&action=execute\" title=\"".$langs->trans('CronExecute')."\"><img src=\"".dol_buildpath('/cron/img/execute.png',1)."\" alt=\"".$langs->trans('CronExecute')."\" /></a>";
|
||||
} else {
|
||||
print "<a href=\"#\" title=\"".$langs->trans('NotEnoughPermissions')."\"><img src=\"".dol_buildpath('/cron/img/execute.png',1)."\" alt=\"".$langs->trans('NotEnoughPermissions')."\" /></a>";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
} else {
|
||||
print $langs->trans('CronNoJobs');
|
||||
}
|
||||
|
||||
print "\n\n<div class=\"tabsAction\">\n";
|
||||
if (! $user->rights->cron->create) {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("New").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.dol_buildpath('/cron/card.php',1).'?action=create">'.$langs->trans("New").'</a>';
|
||||
}
|
||||
print '<br><br></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
|
@ -51,7 +51,6 @@ class Expedition extends CommonObject
|
|||
var $origin;
|
||||
var $origin_id;
|
||||
var $lines=array();
|
||||
var $expedition_method_id; // deprecated
|
||||
var $shipping_method_id;
|
||||
var $tracking_number;
|
||||
var $tracking_url;
|
||||
|
|
@ -203,7 +202,7 @@ class Expedition extends CommonObject
|
|||
$sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
|
||||
$sql.= ", ".($this->expedition_method_id>0?$this->expedition_method_id:"null");
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
|
||||
$sql.= ", '".$this->db->escape($this->tracking_number)."'";
|
||||
$sql.= ", ".$this->weight;
|
||||
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
||||
|
|
@ -373,7 +372,6 @@ class Expedition extends CommonObject
|
|||
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
|
||||
$this->fk_delivery_address = $obj->fk_address;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->expedition_method_id = $obj->fk_expedition_methode; // TODO deprecated
|
||||
$this->shipping_method_id = $obj->fk_expedition_methode;
|
||||
$this->tracking_number = $obj->tracking_number;
|
||||
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
||||
|
|
@ -683,7 +681,7 @@ class Expedition extends CommonObject
|
|||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
|
||||
if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address);
|
||||
if (isset($this->expedition_method_id)) $this->expedition_method_id=trim($this->expedition_method_id);
|
||||
if (isset($this->shipping_method_id)) $this->shipping_method_id=trim($this->shipping_method_id);
|
||||
if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number);
|
||||
if (isset($this->statut)) $this->statut=trim($this->statut);
|
||||
if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth);
|
||||
|
|
@ -714,7 +712,7 @@ class Expedition extends CommonObject
|
|||
$sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
|
||||
$sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
|
||||
$sql.= " fk_address=".(isset($this->fk_delivery_address)?$this->fk_delivery_address:"null").",";
|
||||
$sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").",";
|
||||
$sql.= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0)?$this->shipping_method_id:"null").",";
|
||||
$sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").",";
|
||||
|
|
@ -1291,11 +1289,11 @@ class Expedition extends CommonObject
|
|||
{
|
||||
$code='';
|
||||
|
||||
if (! empty($this->expedition_method_id))
|
||||
if (! empty($this->shipping_method_id))
|
||||
{
|
||||
$sql = "SELECT em.code, em.tracking";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql.= " WHERE em.rowid = ".$this->expedition_method_id;
|
||||
$sql.= " WHERE em.rowid = ".$this->shipping_method_id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ if ($action == 'add')
|
|||
$object->ref_customer = $objectsrc->ref_client;
|
||||
$object->date_delivery = $date_delivery; // Date delivery planed
|
||||
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
|
||||
$object->expedition_method_id = GETPOST('expedition_method_id','int');
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
$object->tracking_number = GETPOST('tracking_number','alpha');
|
||||
$object->ref_int = GETPOST('ref_int','alpha');
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
|||
|| $action == 'settrueWidth'
|
||||
|| $action == 'settrueHeight'
|
||||
|| $action == 'settrueDepth'
|
||||
|| $action == 'setexpedition_method_id')
|
||||
|| $action == 'setshipping_method_id')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
|||
if ($action == 'settrueWidth') $shipping->trueWidth = trim(GETPOST('trueWidth','int'));
|
||||
if ($action == 'settrueHeight') $shipping->trueHeight = trim(GETPOST('trueHeight','int'));
|
||||
if ($action == 'settrueDepth') $shipping->trueDepth = trim(GETPOST('trueDepth','int'));
|
||||
if ($action == 'setexpedition_method_id') $shipping->expedition_method_id = trim(GETPOST('expedition_method_id','int'));
|
||||
if ($action == 'setshipping_method_id') $shipping->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
|
@ -658,7 +658,7 @@ if ($action == 'create')
|
|||
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
|
||||
print '<td colspan="3">';
|
||||
$expe->fetch_delivery_methods();
|
||||
print $form->selectarray("expedition_method_id",$expe->meths,GETPOST('expedition_method_id','int'),1,0,0,"",1);
|
||||
print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
|
@ -1105,26 +1105,26 @@ else
|
|||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editexpedition_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editexpedition_method_id&id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>';
|
||||
if ($action != 'editshipping_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping_method_id&id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editexpedition_method_id')
|
||||
if ($action == 'editshipping_method_id')
|
||||
{
|
||||
print '<form name="setexpedition_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<form name="setshipping_method_id" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setexpedition_method_id">';
|
||||
print '<input type="hidden" name="action" value="setshipping_method_id">';
|
||||
$object->fetch_delivery_methods();
|
||||
print $form->selectarray("expedition_method_id",$object->meths,$object->expedition_method_id,1,0,0,"",1);
|
||||
print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->expedition_method_id > 0)
|
||||
if ($object->shipping_method_id > 0)
|
||||
{
|
||||
// Get code using getLabelFromKey
|
||||
$code=$langs->getLabelFromKey($db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
|
||||
$code=$langs->getLabelFromKey($db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
|
||||
print $langs->trans("SendingMethod".strtoupper($code));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ alter table llx_socpeople CHANGE COLUMN cp zip varchar(10);
|
|||
alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text;
|
||||
alter table llx_societe_address CHANGE COLUMN ville town text;
|
||||
alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);
|
||||
alter table llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
|
||||
|
||||
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description;
|
||||
|
||||
|
|
@ -153,7 +154,43 @@ ALTER TABLE llx_holiday ADD COLUMN note_public text;
|
|||
|
||||
-- Add new trigger on Invoice BILL_UNVALIDATE + Index
|
||||
INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (28,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10);
|
||||
ALTER TABLE llx_c_action_trigger ADD INDEX idx_action_trigger_rang (rang)
|
||||
ALTER TABLE llx_c_action_trigger ADD INDEX idx_action_trigger_rang (rang);
|
||||
|
||||
|
||||
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_code_ventilation integer DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE llx_facturedet DROP COLUMN fk_export_compta;
|
||||
|
||||
CREATE TABLE llx_cronjob
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
jobtype varchar(10) NOT NULL,
|
||||
label text NOT NULL,
|
||||
command varchar(255),
|
||||
classesname varchar(255),
|
||||
objectname varchar(255),
|
||||
methodename varchar(255),
|
||||
params text NOT NULL,
|
||||
md5params varchar(32),
|
||||
module_name varchar(255),
|
||||
priority integer DEFAULT 0,
|
||||
datelastrun datetime,
|
||||
datenextrun datetime,
|
||||
datestart datetime,
|
||||
dateend datetime,
|
||||
datelastresult datetime,
|
||||
lastresult text,
|
||||
lastoutput text,
|
||||
unitfrequency integer NOT NULL DEFAULT 0,
|
||||
frequency integer NOT NULL DEFAULT 0,
|
||||
nbrun integer,
|
||||
status integer NOT NULL DEFAULT 1,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_mod integer DEFAULT NULL,
|
||||
note text
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_societe MODIFY COLUMN zip varchar(25);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,52 @@
|
|||
-- ===================================================================
|
||||
-- Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_cronjob
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
command varchar(256),
|
||||
params text,
|
||||
frequency varchar(24),
|
||||
datelastrun datetime,
|
||||
lastresult date,
|
||||
lastoutput text,
|
||||
fk_user integer DEFAULT NULL,
|
||||
note text
|
||||
)ENGINE=innodb;
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
|
||||
CREATE TABLE llx_cronjob
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
jobtype varchar(10) NOT NULL,
|
||||
label text NOT NULL,
|
||||
command varchar(255),
|
||||
classesname varchar(255),
|
||||
objectname varchar(255),
|
||||
methodename varchar(255),
|
||||
params text NOT NULL,
|
||||
md5params varchar(32),
|
||||
module_name varchar(255),
|
||||
priority integer DEFAULT 0,
|
||||
datelastrun datetime,
|
||||
datenextrun datetime,
|
||||
datestart datetime,
|
||||
dateend datetime,
|
||||
datelastresult datetime,
|
||||
lastresult text,
|
||||
lastoutput text,
|
||||
unitfrequency integer NOT NULL DEFAULT 0,
|
||||
frequency integer NOT NULL DEFAULT 0,
|
||||
nbrun integer,
|
||||
status integer NOT NULL DEFAULT 1,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_mod integer DEFAULT NULL,
|
||||
note text
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,5 +43,6 @@ create table llx_facture_fourn_det
|
|||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||
import_key varchar(14)
|
||||
)ENGINE=innodb;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ create table llx_facturedet
|
|||
buy_price_ht double(24,8) DEFAULT 0, -- prix d'achat HT
|
||||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference prix fournisseur
|
||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||
fk_export_compta integer DEFAULT 0 NOT NULL,
|
||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- ordre d'affichage
|
||||
import_key varchar(14)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
--
|
||||
-- ===================================================================
|
||||
|
||||
|
||||
-- Satut, 0 ou 1, 1 n'est plus supprimable
|
||||
-- fk_export_compta 0 pas exporte
|
||||
|
||||
create table llx_paiement
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
|
|
@ -36,7 +32,6 @@ create table llx_paiement
|
|||
fk_bank integer NOT NULL DEFAULT 0,
|
||||
fk_user_creat integer, -- utilisateur qui a cree l'info
|
||||
fk_user_modif integer, -- utilisateur qui a modifie l'info
|
||||
statut smallint DEFAULT 0 NOT NULL,
|
||||
fk_export_compta integer DEFAULT 0 NOT NULL
|
||||
|
||||
statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable
|
||||
fk_export_compta integer DEFAULT 0 NOT NULL -- fk_export_compta 0 pas exporte
|
||||
)ENGINE=innodb;
|
||||
|
|
|
|||
|
|
@ -116,3 +116,4 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXE
|
|||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
|
|
|||
|
|
@ -428,8 +428,6 @@ NbOfThirdParties=عدد من الأطراف الثالثة
|
|||
NbOfCustomers=عدد من العملاء
|
||||
NbOfLines=عدد الخطوط
|
||||
NbOfObjects=عدد الأجسام
|
||||
NbOfReferers=عدد referers
|
||||
Referers=Referers
|
||||
TotalQuantity=الكمية الإجمالية
|
||||
DateFromTo=ل٪ من ق ق ٪
|
||||
DateFrom=من ق ٪
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ ShowTypeCard=وتبين من نوع '٪ ق'
|
|||
HTPasswordExport=الملف htpassword جيل
|
||||
NoThirdPartyAssociatedToMember=لم يرتبط بها من طرف ثالث لهذا العضو
|
||||
ThirdPartyDolibarr=Dolibarr طرف ثالث
|
||||
MembersAndSubscriptions=وأعضاء Suscriptions
|
||||
MembersAndSubscriptions=وأعضاء Subscriptions
|
||||
// Date 2009-08-11 13:27:01
|
||||
// STOP - Lines generated via parser
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ ShowTypeCard=Покажи тип "%s"
|
|||
HTPasswordExport=htpassword файл поколение
|
||||
NoThirdPartyAssociatedToMember=Никоя трета страна, свързана с този потребител
|
||||
ThirdPartyDolibarr=Dolibarr трета страна
|
||||
MembersAndSubscriptions=Членове и Suscriptions
|
||||
MembersAndSubscriptions=Членове и Subscriptions
|
||||
MoreActions=Допълнително действие на запис
|
||||
MoreActionBankDirect=Създаване на директен запис на сделката по сметка
|
||||
MoreActionBankViaInvoice=Създаване на фактура и плащане по сметка
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
# Dolibarr language file - ca_ES - commissions
|
||||
CHARSET=UTF-8
|
||||
|
||||
Module60000Desc=Gestió de comissions
|
||||
commissionsSetup=Configuració de la gestió de comissions
|
||||
|
||||
ProductCommissionRate=Taxa de comissió sobre els productes
|
||||
ServiceCommissionRate=Taxa de comissió sobre els serveis
|
||||
|
||||
ProductCommissionRateDetails=Taxa usada per calcular les comissions sobre les vendes de productes
|
||||
ServiceCommissionRateDetails=Taxa usada per calcular les comissions sobre les vendes de serveis
|
||||
|
||||
Commissions=Comissions
|
||||
CommissionDetails=Detall de comissions
|
||||
|
||||
IncludeUnpayedInvoices=Incloure les factures no cobrades
|
||||
TotalCommission=Total comissions
|
||||
|
||||
ProductMargin=Marge / productes
|
||||
ServiceMargin=Marge / serveis
|
||||
|
||||
CommissionRate=Taxes comissions
|
||||
|
||||
ProductCommission=Comissió / productes
|
||||
ServiceCommission=Comissió / serveis
|
||||
|
||||
CommissionBase=Base de càlcul de comissions
|
||||
CommissionBasedOnTurnover=Comissions calculades sobre el volum de venda
|
||||
CommissionBasedOnMargins=Comissions calculades sobre els marges
|
||||
CommissionBaseDetails=Estableix el mètode de càlcul de les comissions
|
||||
CommissionBasedOnMarginsDetails=El càlcul basat en els marges requereix l'activació del mòdul marges
|
||||
|
||||
TurnoverTotal = Volum de vendes sense IVA
|
||||
ProductTurnover=Vendes sense IVA / productes
|
||||
ServiceTurnover=Vendes sense IVA / serveis
|
||||
|
||||
CommercialAgent=Agent comercial
|
||||
|
||||
StartDate=Data d'inici
|
||||
EndDate=Data de fi
|
||||
Launch=Començar
|
||||
|
|
@ -84,8 +84,8 @@ NumberOfOrdersByMonth=Nombre de comandes per mes
|
|||
AmountOfOrdersByMonthHT=Import total de comandes per mes (Sense IVA)
|
||||
ListOfOrders=Llistat de comandes
|
||||
CloseOrder=Tancar comanda
|
||||
ConfirmCloseOrder=Esteu segur de voler tancar aquesta comanda? Un cop tancat, haurà de facturar-se
|
||||
ConfirmCloseOrderIfSending=Esteu segur de voler tancar aquesta comanda? No ha de tancar una comanda que encara no té els seus productes enviats
|
||||
ConfirmCloseOrder=Esteu segur que voleu classificar aquesta comanda com a enviat? Un cop enviat una comanda, només podrà facturar-se
|
||||
ConfirmCloseOrderIfSending=Esteu segur que voleu tancar aquesta comanda? Només hauria de tancar una comanda quan aquesta hagi estat enviada completament.
|
||||
ConfirmDeleteOrder=Esteu segur de voler eliminar aquest comanda?
|
||||
ConfirmValidateOrder=Esteu segur de voler validar aquesta comanda sota la referència <b>%s</b> ?
|
||||
ConfirmUnvalidateOrder=Esteu segur de voler restaurar la comanda <b>%s</b> a l'estat esborrany?
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ MemberId=Medlem id
|
|||
PaymentSubscription=Nye bidrag betaling
|
||||
NoThirdPartyAssociatedToMember=Nr. tredjepart forbundet til dette medlem
|
||||
ThirdPartyDolibarr=Dolibarr tredjepart
|
||||
MembersAndSubscriptions=Medlemmer og Suscriptions
|
||||
MembersAndSubscriptions=Medlemmer og Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:39:59).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ ShowTypeCard=Show type '%s'
|
|||
HTPasswordExport=htpassword file generation
|
||||
NoThirdPartyAssociatedToMember=No third party associated to this member
|
||||
ThirdPartyDolibarr=Dolibarr third party
|
||||
MembersAndSubscriptions= Members and Suscriptions
|
||||
MembersAndSubscriptions= Members and Subscriptions
|
||||
MoreActions=Complementary action on recording
|
||||
MoreActionBankDirect=Create a direct transaction record on account
|
||||
MoreActionBankViaInvoice=Create an invoice and payment on account
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ Module1Desc=Companies and contact management (customers, prospects...)
|
|||
Module2Name=Commercial
|
||||
Module2Desc=Commercial management
|
||||
Module10Name=Accounting
|
||||
Module10Desc=Simple accounting management (invoice and payment dispatching)
|
||||
Module10Desc=Simple accounting reports (journals, turnover) based onto database content. No dispatching.
|
||||
Module20Name=Proposals
|
||||
Module20Desc=Commercial proposal management
|
||||
Module22Name=Mass E-mailings
|
||||
|
|
@ -672,6 +672,10 @@ Permission1237=Export supplier orders and their details
|
|||
Permission1251=Run mass imports of external data into database (data load)
|
||||
Permission1321=Export customer invoices, attributes and payments
|
||||
Permission1421=Export customer orders and attributes
|
||||
Permission23001 = Read Scheduled task
|
||||
Permission23002 = Create/update Scheduled task
|
||||
Permission23003 = Delete Scheduled task
|
||||
Permission23004 = Execute Scheduled task
|
||||
Permission2401=Read actions (events or tasks) linked to his account
|
||||
Permission2402=Create/modify actions (events or tasks) linked to his account
|
||||
Permission2403=Delete actions (events or tasks) linked to his account
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
# Dolibarr language file - fr_FR - commissions
|
||||
CHARSET=UTF-8
|
||||
|
||||
Module60000Desc=Commissions management
|
||||
commissionsSetup=Commissions management setup
|
||||
|
||||
ProductCommissionRate=Commission rate on products
|
||||
ServiceCommissionRate=Commission rate on services
|
||||
|
||||
ProductCommissionRateDetails=Commission rate on product sales
|
||||
ServiceCommissionRateDetails=Commission rate on service sales
|
||||
|
||||
Commissions=Commissions
|
||||
CommissionDetails=Commissions details
|
||||
|
||||
IncludeUnpayedInvoices=Include overdue invoices
|
||||
TotalCommission=Commissions subtotal
|
||||
|
||||
ProductMargin=Margin / products
|
||||
ServiceMargin=Margin / services
|
||||
|
||||
CommissionRate=Commission rate
|
||||
|
||||
ProductCommission=Commission / produics
|
||||
ServiceCommission=Commission / services
|
||||
|
||||
CommissionBase=Commissions base
|
||||
CommissionBasedOnTurnover=Commissions based on turnover
|
||||
CommissionBasedOnMargins=Commissions based on margins
|
||||
CommissionBaseDetails=Define calculation method for commissions
|
||||
CommissionBasedOnMarginsDetails=Commissions based on margins needs margin module activation.
|
||||
|
||||
TurnoverTotal = Total turrnover
|
||||
ProductTurnover=Product turnover
|
||||
ServiceTurnover=Service turnover
|
||||
|
||||
CommercialAgent=Commercial agent
|
||||
|
||||
StartDate=Start date
|
||||
EndDate=End date
|
||||
Launch=Start
|
||||
|
||||
AgentContactType=Contact type used for commissioning
|
||||
AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents
|
||||
|
|
@ -392,6 +392,7 @@ UniqueThirdParties=Total of unique third parties
|
|||
InActivity=Open
|
||||
ActivityCeased=Closed
|
||||
ActivityStateFilter=Activity status
|
||||
ProductsIntoElements=List of products into
|
||||
|
||||
# Monkey
|
||||
MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.
|
||||
|
|
|
|||
|
|
@ -149,4 +149,6 @@ WarningDepositsNotIncluded=Deposits invoices are not included in this version wi
|
|||
DatePaymentTermCantBeLowerThanObjectDate=Payment term date can't be lower than object date.
|
||||
Pcg_version=Pcg version
|
||||
Pcg_type=Pcg type
|
||||
Pcg_subtype=Pcg subtype
|
||||
Pcg_subtype=Pcg subtype
|
||||
InvoiceLinesToDispatch=Invoice lines to dispatch
|
||||
InvoiceDispatched=Dispatched invoices
|
||||
|
|
@ -1,11 +1,87 @@
|
|||
# Dolibarr language file - en_US - cron
|
||||
CHARSET=UTF-8
|
||||
CronSetup=Cron scheduler setup
|
||||
CronDesc=This page can be used to setup options of the scheduler manager
|
||||
|
||||
#
|
||||
# Admin
|
||||
#
|
||||
CronSetup= Configuration Scheduled task management
|
||||
URLToLaunchCronJobs=URL to launch cron jobs
|
||||
OrToLaunchASpecificJob=Or to launch a specific job
|
||||
KeyForCronAccess=Security key for URL to launch cron jobs
|
||||
DateLastRun=Last run
|
||||
LastOutput=Last run output
|
||||
LastResult=Last result code
|
||||
ListOfCronJobs=List of scheduled jobs
|
||||
Command=Command
|
||||
FileToLaunchCronJobs=Command to launch cron jobs
|
||||
CronExplainHowToRunUnix=On Unix environement you should use crontab to run Command line each minutes
|
||||
CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Scheduled task tools to run Command line each minutes
|
||||
|
||||
#
|
||||
# Page list
|
||||
#
|
||||
CronDateLastRun=Last run
|
||||
CronLastOutput=Last run output
|
||||
CronLastResult=Last result code
|
||||
CronListOfCronJobs=List of scheduled jobs
|
||||
CronCommand=Command
|
||||
CronList= Job list
|
||||
CronDelete= Delete cron jobs
|
||||
CronConfirmDelete= Are you sure to delete this cron jobs ?
|
||||
CronExecute=Launch task
|
||||
CronConfirmExecute= Are you sure to execute this job now
|
||||
CronInfo= Jobs allow to execute task that have been planned
|
||||
CronWaitingJobs=Wainting jobs
|
||||
CronTask=Task
|
||||
CronNone= None
|
||||
CronDtStart=Start date
|
||||
CronDtEnd=End fin
|
||||
CronDtNextLaunch=Next execution
|
||||
CronDtLastLaunch=Last execution
|
||||
CronFrequency=Frequancy
|
||||
CronClass=Classe
|
||||
CronMethod=Method
|
||||
CronModule=Module
|
||||
CronAction=Action
|
||||
CronStatus=Status
|
||||
CronStatusActive=Active
|
||||
CronStatusInactive=Inactive
|
||||
CronNoJobs=No jobs registered
|
||||
CronPriority=Priority
|
||||
CronLabel=Description
|
||||
CronNbRun=Nb. launch
|
||||
|
||||
#
|
||||
#Page card
|
||||
#
|
||||
CronAdd= Add jobs
|
||||
CronHourStart= Start Hour and date of task
|
||||
CronEvery= And execute task each
|
||||
CronObject= Instance/Object to create
|
||||
CronArgs=Parameters
|
||||
CronSaveSucess=Save succefully
|
||||
CronNote=Comment
|
||||
CronFieldMandatory=Fields %s is mandatory
|
||||
CronErrEndDateStartDt=End date cannot be before start date
|
||||
CronStatusActiveBtn=Active
|
||||
CronStatusInactiveBtn=Inactive
|
||||
CronTaskInactive=This task is inactive
|
||||
CronDtLastResult=Last result date
|
||||
CronId=Id
|
||||
CronClassFile=Classes (file name)
|
||||
CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module). <BR> For exemple to fetch method of Dolibarr Product object /htdocs/<u>product</u>/class/product.class.php, the value of module is <i>product</i>
|
||||
CronClassFileHelp=The file name to load. <BR> For exemple to fetch method of Dolibarr Product object /htdocs/product/class/<u>product.class.php</u>, the value of class file name is <i>product.class.php</i>
|
||||
CronObjectHelp=The object name to load. <BR> For exemple to fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of class file name is <i>Product</i>
|
||||
CronMethodHelp=The object method to launch. <BR> For exemple to fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of method is is <i>fecth</i>
|
||||
CronArgsHelp=The method arguments. <BR> For exemple to fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value of paramters can be <i>0, ProductRef</i>
|
||||
CronCommandHelp=The system command line to execute.
|
||||
|
||||
#
|
||||
# Info
|
||||
#
|
||||
CronInfoPage=Information
|
||||
|
||||
|
||||
#
|
||||
# Common
|
||||
#
|
||||
CronType=Task type
|
||||
CronType_method=Call method of a Dolibarr Class
|
||||
CronType_command=Shell command
|
||||
CronMenu=Cron
|
||||
CronCannotLoadClass=Cannot load class %s or object %s
|
||||
|
|
@ -487,7 +487,7 @@ NbOfCustomers=Number of customers
|
|||
NbOfLines=Number of lines
|
||||
NbOfObjects=Number of objects
|
||||
NbOfReferers=Number of referrers
|
||||
Referers=Referrers
|
||||
Referers=Consumption
|
||||
TotalQuantity=Total quantity
|
||||
DateFromTo=From %s to %s
|
||||
DateFrom=From %s
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ ShowTypeCard=Show type '%s'
|
|||
HTPasswordExport=htpassword file generation
|
||||
NoThirdPartyAssociatedToMember=No third party associated to this member
|
||||
ThirdPartyDolibarr=Dolibarr third party
|
||||
MembersAndSubscriptions= Members and Suscriptions
|
||||
MembersAndSubscriptions= Members and Subscriptions
|
||||
MoreActions=Complementary action on recording
|
||||
MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription
|
||||
MoreActionBankDirect=Create a direct transaction record on account
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
# Dolibarr language file - es_ES - commissions
|
||||
CHARSET=UTF-8
|
||||
|
||||
Module60000Desc=Gestión de comisiones
|
||||
commissionsSetup=Configuración de la gestión de comisiones
|
||||
|
||||
ProductCommissionRate=Tasa de comisión sobre los productos
|
||||
ServiceCommissionRate=Tasa de comisión sobre los servicios
|
||||
|
||||
ProductCommissionRateDetails=Tasa usada para calcular las comisiones sobre las ventas de productos
|
||||
ServiceCommissionRateDetails=Tasa usada para calcular las comisiones sobre las ventas de servicios
|
||||
|
||||
Commissions=Comisiones
|
||||
CommissionDetails=Detalle de comisiones
|
||||
|
||||
IncludeUnpayedInvoices=Incluir las facturas no cobradas
|
||||
TotalCommission=Total comisiones
|
||||
|
||||
ProductMargin=Margen / productos
|
||||
ServiceMargin=Margen / servicios
|
||||
|
||||
CommissionRate=Tasas comisiones
|
||||
|
||||
ProductCommission=Comisión / productos
|
||||
ServiceCommission=Comisión / servicios
|
||||
|
||||
CommissionBase=Base de cálculo de comisiones
|
||||
CommissionBasedOnTurnover=Comisiones calculadas sobre el volumen de venta
|
||||
CommissionBasedOnMargins=Comisiones calculadas sobre los márgenes
|
||||
CommissionBaseDetails=Establece el método de cálculo de las comisiones
|
||||
CommissionBasedOnMarginsDetails=El cálculo basado en los márgenes requiere la activación del módulo márgenes
|
||||
|
||||
TurnoverTotal = Volumen de ventas sin IVA
|
||||
ProductTurnover=Ventas sin IVA / productos
|
||||
ServiceTurnover=Ventas sin IVA / servicios
|
||||
|
||||
CommercialAgent=Agente comercial
|
||||
|
||||
StartDate=Fecha de inicio
|
||||
EndDate=Fecha de fin
|
||||
Launch=Comenzar
|
||||
|
|
@ -84,8 +84,8 @@ NumberOfOrdersByMonth=Número de pedidos por mes
|
|||
AmountOfOrdersByMonthHT=Importe total de pedidos por mes (sin IVA)
|
||||
ListOfOrders=Listado de pedidos
|
||||
CloseOrder=Cerrar pedido
|
||||
ConfirmCloseOrder=¿Está seguro de querer cerrar este pedido? Una vez cerrado, deberá facturarse
|
||||
ConfirmCloseOrderIfSending=¿Está seguro de querer cerrar este pedido? No debe cerrar un pedido que aún no tiene sus productos enviados
|
||||
ConfirmCloseOrder=¿Está seguro de querer clasificar este pedido como enviado? Una vez enviado un pedido, solo podrá facturarse
|
||||
ConfirmCloseOrderIfSending=¿Está seguro de querer cerrar este pedido? Solamente debería cerrar un pedido cuando este haya sido enviado completamente.
|
||||
ConfirmDeleteOrder=¿Está seguro de querer eliminar este pedido?
|
||||
ConfirmValidateOrder=¿Está seguro de querer validar este pedido bajo la referencia <b>%s</b> ?
|
||||
ConfirmUnvalidateOrder=¿Está seguro de querer restaurar el pedido <b>%s</b> al estado borrador?
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ ShowTypeCard=Näita tüüp "%s"
|
|||
HTPasswordExport=htpassword fail põlvkonna
|
||||
NoThirdPartyAssociatedToMember=Ükski kolmas isik on seotud selle liige
|
||||
ThirdPartyDolibarr=Dolibarr kolmanda osapoole
|
||||
MembersAndSubscriptions=Liikmete ja Suscriptions
|
||||
MembersAndSubscriptions=Liikmete ja Subscriptions
|
||||
MoreActions=Täiendav tegevus salvestus
|
||||
MoreActionBankDirect=Loo otseseid tehingukulusid rekord konto
|
||||
MoreActionBankViaInvoice=Loo arve ja ettemaks
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ ShowTypeCard=وتبين من نوع '٪ ق'
|
|||
HTPasswordExport=الملف htpassword جيل
|
||||
NoThirdPartyAssociatedToMember=لم يرتبط بها من طرف ثالث لهذا العضو
|
||||
ThirdPartyDolibarr=Dolibarr طرف ثالث
|
||||
MembersAndSubscriptions=وأعضاء Suscriptions
|
||||
MembersAndSubscriptions=وأعضاء Subscriptions
|
||||
// Date 2009-08-11 13:27:01
|
||||
// STOP - Lines generated via parser
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ MemberId=Jäsen id
|
|||
PaymentSubscription=Uusi osuus maksu
|
||||
NoThirdPartyAssociatedToMember=Kolmansista osapuolista ei näihin jäsen
|
||||
ThirdPartyDolibarr=Dolibarr kolmannen osapuolen
|
||||
MembersAndSubscriptions=Jäsenet ja Suscriptions
|
||||
MembersAndSubscriptions=Jäsenet ja Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2009-08-13 20:45:19).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ Module1Desc= Gestion des tiers (sociétés, particuliers) et contacts
|
|||
Module2Name= Commercial
|
||||
Module2Desc= Gestion commerciale
|
||||
Module10Name= Comptabilité
|
||||
Module10Desc= Gestion simpliste de comptabilité (ventilation de factures et paiements uniquement)
|
||||
Module10Desc= Activation de rapports simplistes de comptabilité (ca, journaux) basé sur la base. Pas de ventilation.
|
||||
Module20Name= Propositions commerciales
|
||||
Module20Desc= Gestion des devis/propositions commerciales
|
||||
Module22Name= EMailings
|
||||
|
|
@ -678,6 +678,10 @@ Permission1411= Lire les mouvements comptables
|
|||
Permission1412= Créer/modifier/annuler les mouvements comptables
|
||||
Permission1415= Lire CA, bilans, résultats, journaux, grands livres
|
||||
Permission1421= Exporter les commandes clients et attributs
|
||||
Permission23001 = Voir les taches planifiée
|
||||
Permission23002 = Créer/Modifier les taches planifiée
|
||||
Permission23003 = Supprimer les taches planifiée
|
||||
Permission23004 = Executer les taches planifiée
|
||||
Permission2401= Lire les actions (événements ou tâches) liées à son compte
|
||||
Permission2402= Créer/modifier les actions (événements ou tâches) liées à son compte
|
||||
Permission2403= Supprimer les actions (événements ou tâches) liées à son compte
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
# Dolibarr language file - fr_FR - commissions
|
||||
CHARSET=UTF-8
|
||||
|
||||
Module60000Desc=Gestion des commissions
|
||||
commissionsSetup=Paramétrage de la gestion des commissions
|
||||
|
||||
ProductCommissionRate=Taux de commissionnement sur les produits
|
||||
ServiceCommissionRate=Taux de commissionnement sur les services
|
||||
|
||||
ProductCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de produits
|
||||
ServiceCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de services
|
||||
|
||||
Commissions=Commissions
|
||||
CommissionDetails=Détail des commissions
|
||||
|
||||
IncludeUnpayedInvoices=Inclure les factures non réglées
|
||||
TotalCommission=Total des commissions
|
||||
|
||||
ProductMargin=Marge / produits
|
||||
ServiceMargin=Marge / services
|
||||
|
||||
CommissionRate=Taux de commissionnement
|
||||
|
||||
ProductCommission=Commission / produits
|
||||
ServiceCommission=Commission / services
|
||||
|
||||
CommissionBase=Base de calcul des commissions
|
||||
CommissionBasedOnTurnover=Commissions calculées sur le CA
|
||||
CommissionBasedOnMargins=Commissions calculées sur les marges
|
||||
CommissionBaseDetails=Définit le mode de calcul des commissions
|
||||
CommissionBasedOnMarginsDetails=Le calcul basé sur les marges nécessite l'activation du module marges.
|
||||
|
||||
TurnoverTotal = Chiffre d'affaire réalisé HT
|
||||
ProductTurnover=CA HT / produits
|
||||
ServiceTurnover=CA HT / services
|
||||
|
||||
CommercialAgent=Agent commercial
|
||||
|
||||
StartDate=Date de début
|
||||
EndDate=Date de fin
|
||||
Launch=Démarrer
|
||||
|
||||
AgentContactType=Type de contact commissionné
|
||||
AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux
|
||||
|
|
@ -394,6 +394,7 @@ UniqueThirdParties=Total de tiers uniques
|
|||
InActivity=En activité
|
||||
ActivityCeased=Clos
|
||||
ActivityStateFilter=Statut d'activité
|
||||
ProductsIntoElements=Liste des produits dans les %s
|
||||
|
||||
# Monkey
|
||||
MonkeyNumRefModelDesc=Renvoie le numéro sous la forme %syymm-nnnn pour les codes clients et %syymm-nnnn pour les codes fournisseurs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0.
|
||||
|
|
|
|||
|
|
@ -161,3 +161,5 @@ DatePaymentTermCantBeLowerThanObjectDate=La date limite de règlement ne peut ê
|
|||
Pcg_version=Version du plan
|
||||
Pcg_type=Classe de compte
|
||||
Pcg_subtype=Sous classe de compte
|
||||
InvoiceLinesToDispatch=Lignes de factures à ventiler
|
||||
InvoiceDispatched=Factures ventilées
|
||||
|
|
@ -1,11 +1,93 @@
|
|||
# Dolibarr language file - fr_FR - cron
|
||||
CHARSET=UTF-8
|
||||
CronSetup=Configuration du séquenceur de taches
|
||||
CronDesc=Cette page permet de configurer certaines options du séquenceur de taches
|
||||
|
||||
#
|
||||
# Admin
|
||||
#
|
||||
CronSetup = Page de configuration du module - Gestion de tâches planifiées
|
||||
URLToLaunchCronJobs=URL pour lancer les taches automatiques
|
||||
OrToLaunchASpecificJob=Ou pour lancer une tache spécifique
|
||||
KeyForCronAccess=Clé de sécurité pour l'URL de lancement des taches automatiques
|
||||
DateLastRun=Dernier lancement
|
||||
LastOutput=Dernière sortie
|
||||
LastResult=Dernière code retour
|
||||
ListOfCronJobs=Liste des taches programmées
|
||||
Command=Commande
|
||||
FileToLaunchCronJobs=Commande pour lancer les taches automatiques
|
||||
CronExplainHowToRunUnix=Sur un environement Unix vous pouvez paramétré CronTab pour executer cette commande toute les minutes
|
||||
CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utilisr le planificateur de tache pour lancer cette commande toute les minutes
|
||||
|
||||
#
|
||||
# Menu
|
||||
#
|
||||
CronListActive= Liste des tâches planifiées active
|
||||
CronListInactive= Liste des tâches planifiées inactive
|
||||
|
||||
|
||||
#
|
||||
# Page list
|
||||
#
|
||||
CronDateLastRun=Dernier lancement
|
||||
CronLastOutput=Dernière sortie
|
||||
CronLastResult=Dernier code retour
|
||||
CronCommand=Commande
|
||||
CronList= Liste des tâches planifiées
|
||||
CronDelete= Supprimer la tâche planifiée
|
||||
CronConfirmDelete= Êtes-vous sûr de vouloir supprimer cette tâche planifiée ?
|
||||
CronExecute=Exécuter cette tâche
|
||||
CronConfirmExecute= Êtes-vous sûr de vouloir exécuter cette tâche maintenant?
|
||||
CronInfo= Les jobs permettent d'exécuter des tâches à intervales réguliers
|
||||
CronWaitingJobs= Vos jobs en attente:
|
||||
CronTask= Tâche
|
||||
CronNone=Aucun(e)
|
||||
CronDtStart=Date début
|
||||
CronDtEnd=Date fin
|
||||
CronDtNextLaunch=Prochaine éxécution
|
||||
CronDtLastLaunch=Dernière éxécution
|
||||
CronFrequency=Fréquence
|
||||
CronClass=Classes
|
||||
CronMethod=Méthode
|
||||
CronModule=Module
|
||||
CronAction=Action
|
||||
CronStatus=Status
|
||||
CronStatusActive=Active
|
||||
CronStatusInactive=Inactive
|
||||
CronEach=Tou(te)s
|
||||
CronNoJobs= Aucun jobs actuellement
|
||||
CronPriority=Priorité
|
||||
CronLabel=Description
|
||||
CronNbRun=Nb. exec.
|
||||
CronDtLastResult=Date du derniétre resulat de la dernière éxécution
|
||||
|
||||
#
|
||||
#Page card
|
||||
#
|
||||
CronAdd= Ajoutez une tâche
|
||||
CronHourStart= Jour et Heure de début de la tâche
|
||||
CronEvery= Puis execution toutes les
|
||||
CronObject= Instance/Objet à créer
|
||||
CronArgs= Argument
|
||||
CronSaveSucess=Enregistrement effectué
|
||||
CronNote=Note
|
||||
CronFieldMandatory=Le champ %s est obligatoire
|
||||
CronErrEndDateStartDt=La date de fin ne peux être avant la date de début
|
||||
CronStatusActiveBtn=Activer
|
||||
CronStatusInactiveBtn=Désactiver
|
||||
CronTaskInactive=Cette tâche est désactivée
|
||||
CronId=Id
|
||||
CronClassFile=Classes (fichier)
|
||||
CronModuleHelp=Nom du repertoire du module dolibarr (fonctionne automatiquement avec les modules externe Dolibarr). <BR> Par exemple pour appeler la mèthode fetch de l'object Product de Dolibarr /htdocs/<u>product</u>/class/product.class.php, la valeur de module est <i>product</i>
|
||||
CronClassFileHelp=Le fichier qui contient l'objet . <BR> Par exemple pour appeler la mèthode fetch de l'object Product de Dolibarr /htdocs/product/class/<u>product.class.php</u>, la valeur de classe est <i>product.class.php</i>
|
||||
CronObjectHelp=Le nom de l'object a crée. <BR> Par exemple pour appeler la mèthode fetch de l'object Product de Dolibarr /htdocs/product/class/product.class.php, la valeur de objet est <i>Product</i>
|
||||
CronMethodHelp=La mèthode a lancer. <BR> Par exemple pour appeler la mèthode fetch de l'object Product de Dolibarr /htdocs/product/class/product.class.php, la valeur de mèthode est <i>fecth</i>
|
||||
CronArgsHelp=Les arguments de la mèthode. <BR> For exemple to fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, la valeur de paramétre pourrait être <i>0, RefProduit</i>
|
||||
CronCommandHelp=La commande système a éxecuter
|
||||
|
||||
#
|
||||
# Info
|
||||
#
|
||||
CronInfoPage=Suivie
|
||||
|
||||
#
|
||||
# Common
|
||||
#
|
||||
CronType=Type d'action a executer
|
||||
CronType_method=Méthode d'une classe d'un module Dolibarr
|
||||
CronType_command=Commande Shell
|
||||
CronMenu=Cron
|
||||
CronCannotLoadClass=impossible de charger la classe %s ou l'object %s
|
||||
|
|
@ -490,7 +490,7 @@ NbOfCustomers=Nombre de clients
|
|||
NbOfLines=Nombre de lignes
|
||||
NbOfObjects=Nombre d'objets
|
||||
NbOfReferers=Nombre de références
|
||||
Referers=Référents
|
||||
Referers=Consommation
|
||||
TotalQuantity=Quantité totale
|
||||
DateFromTo=Du %s au %s
|
||||
DateFrom=A partir du %s
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ ShowTypeCard=הצג מסוג "%s"
|
|||
HTPasswordExport=htpassword הדור הקובץ
|
||||
NoThirdPartyAssociatedToMember=אין צד שלישי הקשור משתמש זה
|
||||
ThirdPartyDolibarr=Dolibarr צד שלישי
|
||||
MembersAndSubscriptions=משתמשים ו Suscriptions
|
||||
MembersAndSubscriptions=משתמשים ו Subscriptions
|
||||
MoreActions=פעולה משלימה על ההקלטה
|
||||
MoreActionBankDirect=יצירת הרשומה העסקה ישירה על חשבון
|
||||
MoreActionBankViaInvoice=יצירת חשבונית התשלום על חשבון
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ ShowTypeCard=Mutasd típusú "%s"
|
|||
HTPasswordExport=htpassword fájl létrehozása
|
||||
NoThirdPartyAssociatedToMember=Harmadik félnek nem társult a tag
|
||||
ThirdPartyDolibarr=Dolibarr harmadik fél
|
||||
MembersAndSubscriptions=A tagok és Suscriptions
|
||||
MembersAndSubscriptions=A tagok és Subscriptions
|
||||
MoreActions=Kiegészítő fellépés a felvételi
|
||||
MoreActionBankDirect=Hozzon létre egy közvetlen tranzakciós rekord miatt
|
||||
MoreActionBankViaInvoice=Hozzon létre egy számlát és előleg
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ ShowTypeCard=Sýna tegund ' %s '
|
|||
HTPasswordExport=htpassword skrá kynslóð
|
||||
NoThirdPartyAssociatedToMember=Engar þriðja aðila í tengslum við þennan
|
||||
ThirdPartyDolibarr=Dolibarr þriðja aðila
|
||||
MembersAndSubscriptions=Aðilar og Suscriptions
|
||||
MembersAndSubscriptions=Aðilar og Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2010-06-30 00:15:29).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ MemberModifiedInDolibarr =Membri modificati su Dolibarr
|
|||
MEMBER_NEWFORM_PAYONLINE =Saltate sulla integrato pagina di pagamento online
|
||||
MemberNotOrNoMoreExpectedToSubscribe =Membri non iscritti o non più attesi per iscrizione
|
||||
MemberPublicLinks =Link/pagine pubbliche
|
||||
MembersAndSubscriptions =Deputati e Suscriptions
|
||||
MembersAndSubscriptions =Deputati e Subscriptions
|
||||
MembersArea =Sezione riservata membri
|
||||
MembersAttributes =Attributi dei membri
|
||||
MembersByCountryDesc =Questa schermata mostra le statistiche dei membri per paese. Il grafico dipende da servizi online di Google ed è disponibile solo se il server può connettersi ad internet.
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ ShowTypeCard=タイプ "%s"を表示
|
|||
HTPasswordExport=htpasswordファイルの生成
|
||||
NoThirdPartyAssociatedToMember=このメンバに関連付けられているサードパーティません
|
||||
ThirdPartyDolibarr=Dolibarrサードパーティ
|
||||
MembersAndSubscriptions=メンバーとSuscriptions
|
||||
MembersAndSubscriptions=メンバーとSubscriptions
|
||||
MoreActions=記録上の相補的なアクション
|
||||
MoreActionBankDirect=アカウントに直接トランザクション·レコードを作成します。
|
||||
MoreActionBankViaInvoice=アカウントの請求書と支払いを作成します。
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ DescADHERENT_CARD_TEXT_RIGHT=Tekst trykt på kort medlem (justere på høyre)
|
|||
DescADHERENT_MAILMAN_LISTS=Liste (er) for automatisk insription av nye medlemmer (separert med komma)
|
||||
NoThirdPartyAssociatedToMember=Ingen tredjepart knyttet til dette medlemmet
|
||||
ThirdPartyDolibarr=Dolibarr tredjepart
|
||||
MembersAndSubscriptions=Medlemmer og Suscriptions
|
||||
MembersAndSubscriptions=Medlemmer og Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2010-07-17 11:48:27).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ MemberId=Państwa id
|
|||
PaymentSubscription=Nowy wkład płatności
|
||||
NoThirdPartyAssociatedToMember=Nr trzeciej związane do tego członka
|
||||
ThirdPartyDolibarr=Dolibarr trzeciej
|
||||
MembersAndSubscriptions=Członkowie i Suscriptions
|
||||
MembersAndSubscriptions=Członkowie i Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2009-08-13 21:07:31).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ SetLinkToThirdParty=Link para uma Dolibarr terceiro
|
|||
SubscriptionId=Assinaturas id
|
||||
MemberId=Estados-id
|
||||
PaymentSubscription=Nova contribuição pagamento
|
||||
MembersAndSubscriptions=Deputados e Suscriptions
|
||||
MembersAndSubscriptions=Deputados e Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2009-08-13 21:10:10).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ MemberId=Statele id
|
|||
PaymentSubscription=New plata contribuţiei
|
||||
NoThirdPartyAssociatedToMember=Nu părţi terţe asociate la prezenta membru
|
||||
ThirdPartyDolibarr=Dolibarr terţă parte
|
||||
MembersAndSubscriptions=Membrii şi Suscriptions
|
||||
MembersAndSubscriptions=Membrii şi Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2009-08-13 21:12:07).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ ShowTypeCard=Visa typ "%s"
|
|||
HTPasswordExport=htpassword fil generation
|
||||
NoThirdPartyAssociatedToMember=Ingen tredje part som är associerade till denna medlem
|
||||
ThirdPartyDolibarr=Dolibarr tredje part
|
||||
MembersAndSubscriptions=Medlemmar och Suscriptions
|
||||
MembersAndSubscriptions=Medlemmar och Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2010-08-27 08:51:26).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ ShowTypeCard=顯示類型'%s'
|
|||
HTPasswordExport=htpassword文件生成
|
||||
NoThirdPartyAssociatedToMember=無關聯的第三方該會員
|
||||
ThirdPartyDolibarr=Dolibarr第三者
|
||||
MembersAndSubscriptions=議員和Suscriptions
|
||||
MembersAndSubscriptions=議員和Subscriptions
|
||||
// STOP - Lines generated via autotranslator.php tool (2010-06-08 21:22:55).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -40,7 +40,13 @@ $mesg = '';
|
|||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
if (! $sortfield)
|
||||
{
|
||||
if ($agentid > 0)
|
||||
$sortfield="s.nom";
|
||||
else
|
||||
$sortfield="u.name";
|
||||
}
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
|
|
@ -75,7 +81,7 @@ $titre=$langs->trans("Margins");
|
|||
$picto='margin';
|
||||
dol_fiche_head($head, 'agentMargins', $titre, 0, $picto);
|
||||
|
||||
print '<form method="post" name="sel">';
|
||||
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||
|
|
@ -118,10 +124,11 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
|||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
|
||||
$sql.= " u.login,";
|
||||
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,";
|
||||
$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge" ;
|
||||
$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, u.rowid as agent,";
|
||||
$sql.= " u.login, u.name, u.firstname,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge" ;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
|
||||
|
|
@ -155,7 +162,8 @@ if ($agentid > 0)
|
|||
else
|
||||
$sql.= " GROUP BY u.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -163,7 +171,7 @@ if ($result)
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',0,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -172,7 +180,7 @@ if ($result)
|
|||
if ($agentid > 0)
|
||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
else
|
||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.name","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
|
@ -191,7 +199,7 @@ if ($result)
|
|||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
|
@ -208,9 +216,8 @@ if ($result)
|
|||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||
}
|
||||
else {
|
||||
$userstatic->id=$objp->agent;
|
||||
$userstatic->login=$objp->login;
|
||||
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
||||
$userstatic->fetch($objp->agent);
|
||||
print "<td>".$userstatic->getFullName($langs,0,0,0)."</td>\n";
|
||||
}
|
||||
print "<td align=\"right\">".price($objp->selling_price)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->buying_price)."</td>\n";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -40,10 +40,6 @@ $result = restrictedArea($user, 'societe','','');
|
|||
|
||||
$mesg = '';
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
|
|
@ -77,7 +73,7 @@ $titre=$langs->trans("Margins");
|
|||
$picto='margin';
|
||||
dol_fiche_head($head, 'customerMargins', $titre, 0, $picto);
|
||||
|
||||
print '<form method="post" name="sel">';
|
||||
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$client = false;
|
||||
|
|
@ -105,6 +101,23 @@ else {
|
|||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield)
|
||||
{
|
||||
if ($client)
|
||||
{
|
||||
$sortfield="f.datef";
|
||||
$sortorder="DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sortfield="s.nom";
|
||||
$sortorder="ASC";
|
||||
}
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td width="20%">';
|
||||
|
|
@ -142,8 +155,9 @@ print '</form>';
|
|||
|
||||
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client,";
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,";
|
||||
$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
|
|
@ -166,7 +180,8 @@ if ($client)
|
|||
else
|
||||
$sql.= " GROUP BY s.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -174,7 +189,7 @@ if ($result)
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',0,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -203,7 +218,7 @@ if ($result)
|
|||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -48,7 +48,20 @@ $mesg = '';
|
|||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortfield)
|
||||
{
|
||||
if ($id > 0)
|
||||
{
|
||||
$sortfield="f.datef";
|
||||
$sortorder="DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sortfield="p.ref";
|
||||
$sortorder="ASC";
|
||||
}
|
||||
}
|
||||
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
|
|
@ -83,7 +96,7 @@ $titre=$langs->trans("Margins");
|
|||
$picto='margin';
|
||||
dol_fiche_head($head, 'productMargins', $titre, 0, $picto);
|
||||
|
||||
print '<form method="post" name="sel">';
|
||||
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($id > 0) {
|
||||
|
|
@ -144,8 +157,9 @@ print '</form>';
|
|||
|
||||
$sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref,";
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,";
|
||||
$sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
|
|
@ -170,7 +184,8 @@ if ($id > 0)
|
|||
else
|
||||
$sql.= " GROUP BY d.fk_product";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -178,7 +193,7 @@ if ($result)
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',0,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -207,7 +222,7 @@ if ($result)
|
|||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -130,7 +130,10 @@ if ($id > 0 || ! empty($ref))
|
|||
|
||||
$sql = "SELECT DISTINCT s.nom, s.rowid as socid, s.code_client,";
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.buy_price_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.buy_price_ht) * d.qty) as marge," ;
|
||||
$sql.= " d.total_ht as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','(d.buy_price_ht * d.qty *-1)','(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','d.qty *-1','d.qty')." as qty,";
|
||||
$sql.= $db->ifsql('f.type =2','((d.price + d.buy_price_ht) * d.qty)','((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
|
@ -148,14 +151,15 @@ if ($id > 0 || ! empty($ref))
|
|||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',0,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -184,7 +188,7 @@ if ($id > 0 || ! empty($ref))
|
|||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -128,7 +128,10 @@ if ($socid > 0)
|
|||
|
||||
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
|
|
@ -143,14 +146,15 @@ if ($socid > 0)
|
|||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
$sql.= " GROUP BY f.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',0,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -176,7 +180,7 @@ if ($socid > 0)
|
|||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
|
||||
* Copyright (C) 2013 Florian Henry <forian.henry@open-cocnept.pro
|
||||
*
|
||||
* 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
|
||||
|
|
@ -16,158 +17,126 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file cron/cron_run_jobs.php
|
||||
* \ingroup cron
|
||||
* \brief This file is the page to call to run jobs
|
||||
* Initialy built by build_class_from_table on 2013-03-17 18:50
|
||||
* \file cron/public/cron/cron_run_jobs.php
|
||||
* \ingroup cron
|
||||
* \brief Execute pendings jobs
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php';
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php';
|
||||
if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
include_once(DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php');
|
||||
|
||||
|
||||
// C'est un wrapper, donc header vierge
|
||||
/**
|
||||
* Header function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function llxHeaderVierge() {
|
||||
print '<html><title>Export agenda cal</title><body>';
|
||||
}
|
||||
/**
|
||||
* Footer function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function llxFooterVierge() {
|
||||
print '</body></html>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
$langs->load("cron@cron");
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
//accessforbidden();
|
||||
// librarie core
|
||||
// Dolibarr environment
|
||||
$res = @include("../../main.inc.php"); // From htdocs directory
|
||||
if (! $res) {
|
||||
$res = @include("../../../main.inc.php"); // From "custom" directory
|
||||
}
|
||||
if (! $res) die("Include of master.inc.php fails");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->cron->enabled)) accessforbidden('',1,1,1);
|
||||
// librarie jobs
|
||||
dol_include_once("/cron/class/cronjob.class.php");
|
||||
|
||||
// Check also security key
|
||||
if (empty($_GET["securitykey"]) || $conf->global->CRON_KEY != $_GET["securitykey"])
|
||||
{
|
||||
$user->getrights();
|
||||
|
||||
llxHeaderVierge();
|
||||
print '<div class="error">Bad value for key.</div>';
|
||||
llxFooterVierge();
|
||||
exit;
|
||||
|
||||
global $langs, $conf;
|
||||
|
||||
// Check the key, avoid that a stranger starts cron
|
||||
$key = $_GET['securitykey'];
|
||||
if (empty($key)) {
|
||||
echo 'securitykey is require';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
if ($action == 'add')
|
||||
if($key != $conf->global->MAIN_CRON_KEY)
|
||||
{
|
||||
$object=new Cronjobs($db);
|
||||
$object->prop1=$_POST["field1"];
|
||||
$object->prop2=$_POST["field2"];
|
||||
$result=$object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
}
|
||||
{
|
||||
// Creation KO
|
||||
$mesg=$object->error;
|
||||
echo 'securitykey is wrong';
|
||||
exit;
|
||||
}
|
||||
// Check the key, avoid that a stranger starts cron
|
||||
$userlogin = $_GET['userlogin'];
|
||||
if (empty($userlogin)) {
|
||||
echo 'userlogin is require';
|
||||
exit;
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user=new User($db);
|
||||
$result=$user->fetch('',$userlogin);
|
||||
if ($result<0) {
|
||||
echo "User Error:".$user->error;
|
||||
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
|
||||
exit;
|
||||
}else {
|
||||
if (empty($user->id)) {
|
||||
echo " User user login:".$userlogin." do not exists";
|
||||
dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$id = $_GET['id'];
|
||||
|
||||
// Language Management
|
||||
$langs->load("admin");
|
||||
$langs->load("cron@cron");
|
||||
|
||||
// create a jobs object
|
||||
$object = new Cronjob($db);
|
||||
|
||||
$filter=array();
|
||||
if (empty($id)) {
|
||||
$filter=array();
|
||||
$filter['t.rowid']=$id;
|
||||
}
|
||||
|
||||
$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter);
|
||||
if ($result<0) {
|
||||
echo "Error:".$cronjob->error;
|
||||
dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
* Put here all code to build page
|
||||
****************************************************/
|
||||
// current date
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('',$langs->trans('CronList'),'');
|
||||
if(is_array($object->lines) && (count($object->lines)>0)){
|
||||
// Loop over job
|
||||
foreach($object->lines as $line){
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
// Put here content of your page
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
dol_syslog("cron_run_jobs.php:: fetch cronjobid:".$line->id, LOG_ERR);
|
||||
|
||||
//If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database
|
||||
if ((($line->datenextrun <= $now) && $line->dateend < $now)
|
||||
|| ((empty($line->datenextrun)) && (empty($line->dateend)))){
|
||||
|
||||
dol_syslog("cron_run_jobs.php:: torun line->datenextrun:".dol_print_date($line->datenextrun,'dayhourtext')." line->dateend:".dol_print_date($line->dateend,'dayhourtext')." now:".dol_print_date($now,'dayhourtext'), LOG_ERR);
|
||||
|
||||
$cronjob=new Cronjob($db);
|
||||
$result=$cronjob->fetch($line->id);
|
||||
if ($result<0) {
|
||||
echo "Error:".$cronjob->error;
|
||||
dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
// execute methode
|
||||
$result=$cronjob->run_jobs($userlogin);
|
||||
if ($result<0) {
|
||||
echo "Error:".$cronjob->error;
|
||||
dol_syslog("cron_run_jobs.php:: run_jobs Error".$cronjob->error, LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
|
||||
// we re-program the next execution and stores the last execution time for this job
|
||||
$result=$cronjob->reprogram_jobs($userlogin);
|
||||
if ($result<0) {
|
||||
echo "Error:".$cronjob->error;
|
||||
dol_syslog("cron_run_jobs.php:: reprogram_jobs Error".$cronjob->error, LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_needroot();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
$cronjob=new CronJob($db);
|
||||
$result=$cronjob->fetch($id);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
|
||||
echo "OK";
|
||||
} else {
|
||||
echo "No Jobs to run";
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
439
htdocs/societe/consumption.php
Normal file
439
htdocs/societe/consumption.php
Normal file
|
|
@ -0,0 +1,439 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* Version V1.1 Initial version of Philippe Berthet
|
||||
* Version V2 Change to be compatible with 3.4 and enhanced to be more generic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/consumption.php
|
||||
* \ingroup societe
|
||||
* \brief Add a tab on thirpdarty view to list all products/services bought or sells by thirdparty
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
$object = new Societe($db);
|
||||
if ($socid > 0) $object->fetch($socid);
|
||||
|
||||
// Sort & Order fields
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='datePrint';
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
// Search fields
|
||||
$sref=GETPOST("sref");
|
||||
$sprod_fulldescr=GETPOST("sprod_fulldescr");
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
|
||||
// Clean up on purge search criteria ?
|
||||
if (GETPOST("button_removefilter"))
|
||||
{
|
||||
$sref='';
|
||||
$sprod_fulldescr='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
// Customer or supplier selected in drop box
|
||||
$thirdTypeSelect = GETPOST("third_select_id");
|
||||
$type_element = GETPOST('type_element')?GETPOST('type_element'):'invoice';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("orders");
|
||||
$langs->load("suppliers");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$productstatic=new Product($db);
|
||||
|
||||
$titre = $langs->trans("Referer",$object->name);
|
||||
llxHeader('',$titre,'');
|
||||
|
||||
if (empty($socid))
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$head = societe_prepare_head($object);
|
||||
dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="30%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
||||
print $object->code_client;
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td></tr>';
|
||||
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbFactsClient = $obj->nb;
|
||||
$thirdTypeArray['customer']=$langs->trans("customer");
|
||||
if ($conf->facture->enabled) $elementTypeArray['invoice']=$langs->trans('Invoices');
|
||||
if ($conf->commande->enabled) $elementTypeArray['order']=$langs->trans('Orders');
|
||||
}
|
||||
|
||||
if ($object->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $object->code_fournisseur;
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid;
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbCmdsFourn = $obj->nb;
|
||||
$thirdTypeArray['supplier']=$langs->trans("supplier");
|
||||
if ($conf->fournisseur->enabled) $elementTypeArray['supplier_invoice']=$langs->trans('SuppliersInvoices');
|
||||
if ($conf->fournisseur->enabled) $elementTypeArray['supplier_order']=$langs->trans('SuppliersOrders');
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
print '<br>';
|
||||
|
||||
|
||||
$sql_select='';
|
||||
if ($type_element == 'invoice')
|
||||
{ // Customer : show products from invoices
|
||||
$documentstatic=new Facture($db);
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as datePrint, ';
|
||||
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
|
||||
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
|
||||
$where.= " AND d.fk_facture = f.rowid";
|
||||
$where.= " AND f.entity = ".$conf->entity;
|
||||
$datePrint = 'f.datef';
|
||||
$doc_number='f.facnumber';
|
||||
$thirdTypeSelect='customer';
|
||||
}
|
||||
if ($type_element == 'order')
|
||||
{
|
||||
// TODO
|
||||
|
||||
}
|
||||
if ($type_element == 'supplier_order')
|
||||
{ // Supplier : Show products from orders.
|
||||
$documentstatic=new CommandeFournisseur($db);
|
||||
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_valid as datePrint, ';
|
||||
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
|
||||
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
|
||||
$where.= " AND d.fk_commande = c.rowid";
|
||||
$datePrint = 'c.date_creation';
|
||||
$doc_number='c.ref';
|
||||
$thirdTypeSelect='supplier';
|
||||
}
|
||||
if ($type_element == 'supplier_invoice')
|
||||
{
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
$sql = $sql_select;
|
||||
$sql.= ' d.fk_product as product_id, d.fk_product as fk_product, d.label, d.description as description, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,';
|
||||
$sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type,';
|
||||
$sql.= " s.rowid as socid, p.ref as prod_ref, p.label as product_label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from;
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
|
||||
$sql.= $where;
|
||||
if ($month > 0) {
|
||||
if ($year > 0) {
|
||||
$start = dol_mktime(0, 0, 0, $month, 1, $year);
|
||||
$end = dol_time_plus_duree($start, 1 , 'm') - 1;
|
||||
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||
} else {
|
||||
$sql.= " AND date_format(".$datePrint.", '%m') = '".sprintf('%02d',$month)."'";
|
||||
}
|
||||
} else if ($year > 0) {
|
||||
$start = dol_mktime(0, 0, 0, 1, 1, $year);
|
||||
$end = dol_time_plus_duree($start, 1 , 'y') - 1;
|
||||
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||
}
|
||||
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
|
||||
// Define type of elements
|
||||
$typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST('type_element'));
|
||||
$button = '<input type="submit" class="button" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid;
|
||||
|
||||
print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
if ($sql_select)
|
||||
{
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'datePrint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
// Filters
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">'; // date
|
||||
print $formother->select_month($month?$month:-1,'month',1);
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.$sprod_fulldescr.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("resetFilters")).'" title="'.dol_escape_htmltag($langs->trans("resetFilters")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($sql_select)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while (($objp = $db->fetch_object($resql)) && $i < $conf->liste_limit )
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nobordernopadding" nowrap="nowrap" width="100">';
|
||||
$documentstatic->id=$objp->doc_id;
|
||||
$documentstatic->ref=$objp->doc_number;
|
||||
$documentstatic->type=$objp->type;
|
||||
print $documentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->datePrint),'day').'</td>';
|
||||
|
||||
print '<td>';
|
||||
|
||||
// Define text, description and type
|
||||
$text=''; $description=''; $type=0;
|
||||
|
||||
// Code to show product duplicated from commonobject->printObjectLine
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$product_static = new Product($db);
|
||||
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->fk_product;
|
||||
$product_static->ref=$objp->ref;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
}
|
||||
|
||||
// Product
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
{
|
||||
$this->fetch_thirdparty();
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($objp->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang)) $newlang=$this->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
|
||||
}
|
||||
else
|
||||
{
|
||||
$label = $objp->product_label;
|
||||
}
|
||||
|
||||
$text.= ' - '.(! empty($objp->label)?$objp->label:$label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description));
|
||||
}
|
||||
|
||||
if (($objp->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
|
||||
<?php
|
||||
$txt='';
|
||||
print img_object($langs->trans("ShowReduc"),'reduc').' ';
|
||||
if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit");
|
||||
//else $txt=$langs->trans("Discount");
|
||||
print $txt;
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
if ($objp->description)
|
||||
{
|
||||
if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objp->fk_product > 0) {
|
||||
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,'');
|
||||
|
||||
// Show range
|
||||
echo get_date_range($objp->date_start, $objp->date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($objp->label)) {
|
||||
$text.= ' <strong>'.$objp->label.'</strong>';
|
||||
echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,'');
|
||||
} else {
|
||||
echo $text.' '.dol_htmlentitiesbr($objp->description);
|
||||
}
|
||||
|
||||
// Show range
|
||||
echo get_date_range($objp->date_start,$objp->date_end);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$prodreftxt='';
|
||||
if ($objp->prod_id > 0)
|
||||
{
|
||||
$productstatic->id = $objp->prod_id;
|
||||
$productstatic->ref = $objp->prod_ref;
|
||||
$productstatic->status = $objp->prod_type;
|
||||
$prodreftxt = $productstatic->getNomUrl(0);
|
||||
if(!empty($objp->product_label)) $prodreftxt .= ' - '.$objp->product_label;
|
||||
}
|
||||
// Show range
|
||||
$prodreftxt .= get_date_range($objp->date_start, $objp->date_end);
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
$prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
*/
|
||||
print '</td>';
|
||||
|
||||
//print '<td align="left">'.$prodreftxt.'</td>';
|
||||
|
||||
print '<td align="right">'.$objp->prod_qty.'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
if ($num > $conf->liste_limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else {
|
||||
print '<tr><td colspan="4">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</form>";
|
||||
|
||||
|
||||
/*
|
||||
* Errors
|
||||
*/
|
||||
|
||||
dol_htmloutput_errors($warning);
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
BIN
htdocs/theme/amarok/img/cron.png
Normal file
BIN
htdocs/theme/amarok/img/cron.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
htdocs/theme/amarok/img/object_cron.png
Normal file
BIN
htdocs/theme/amarok/img/object_cron.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 655 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user