Merge branch '6.0' into 6.0
This commit is contained in:
commit
3ac413084f
21
ChangeLog
21
ChangeLog
@ -2,6 +2,27 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
|
||||
FIX: #7737
|
||||
FIX: #7751
|
||||
FIX: #7756 Add better error message
|
||||
FIX: #7786
|
||||
FIX: #7806
|
||||
FIX: #7824
|
||||
FIX: add line bad price and ref
|
||||
FIX: A lot of several fix on local taxes and NPR tax
|
||||
FIX: createfromorder
|
||||
FIX: CSS for IE10
|
||||
FIX: external user cannot be set as internal
|
||||
FIX: Filter type on actioncomm with multiselect doesn't work
|
||||
FIX: list of donation not filtered on multicompany
|
||||
FIX: list of module not complete when module mb_strlen not available
|
||||
FIX: Locatax were not propagated when cloning order or proposal
|
||||
FIX: Searching translation should not be case sensitive
|
||||
FIX: Search into language is ok for file into external modules two.
|
||||
FIX: test for filter fk_status
|
||||
FIX: too much users on holiday list
|
||||
FIX: Wrong alias sql
|
||||
|
||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||
FIX: #7211 Update qty dispatched on qty change
|
||||
|
||||
@ -131,7 +131,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
|
||||
@ -556,9 +556,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
||||
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
|
||||
|
||||
@ -110,4 +110,25 @@ to get
|
||||
if ($className == 'Luracast\Restler\string') return;
|
||||
if ($className == 'Luracast\Restler\mixed') return;
|
||||
...
|
||||
|
||||
|
||||
|
||||
PARSEDOWN
|
||||
---------
|
||||
|
||||
* Fix to avoid fatal error when mb_strlen not available:
|
||||
|
||||
// @CHANGE LDR Fix when mb_strlen is not available
|
||||
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
||||
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
|
||||
else $len = strlen($line);
|
||||
$shortage = 4 - $len % 4;
|
||||
|
||||
|
||||
|
||||
JEDITABLE.JS
|
||||
------------
|
||||
|
||||
* <button type="submit" /> => <button class="button" type="submit" />
|
||||
* <button type="cancel" /> => <button class="button" type="cancel" />
|
||||
|
||||
|
||||
|
||||
@ -15,6 +15,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
||||
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
||||
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
||||
|
||||
@ -14,8 +14,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT -->
|
||||
|
||||
@ -14,9 +14,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
|
||||
?>
|
||||
|
||||
@ -14,10 +14,18 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
|
||||
|
||||
@ -36,7 +36,7 @@ $langs->load("users");
|
||||
if (!$user->rights->adherent->lire)
|
||||
accessforbidden();
|
||||
|
||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
||||
$rowid=GETPOST("rowid",'int');
|
||||
|
||||
|
||||
|
||||
@ -44,10 +44,10 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$object = new Subscription($db);
|
||||
$result = $object->fetch($rowid);
|
||||
|
||||
|
||||
@ -15,8 +15,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -33,7 +40,7 @@ $var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
|
||||
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("Subscription"); ?></td>
|
||||
|
||||
@ -212,7 +212,7 @@ if ($xml)
|
||||
|
||||
// Defined qualified files (must be same than into generate_filelist_xml.php)
|
||||
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
|
||||
|
||||
// Fill file_list with files in signature, new files, modified files
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("cashdesk");
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
|
||||
@ -16,6 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$langs->load("main");
|
||||
|
||||
@ -16,6 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("banks");
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$langs->load("orders");
|
||||
$langs->load("companies");
|
||||
|
||||
$_socid = $_GET["id"];
|
||||
$id = GETPOST('id','int');
|
||||
$_socid = GETPOST("id",'int');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -45,10 +46,10 @@ if ($user->societe_id > 0)
|
||||
if ($_POST["action"] == 'setpricelevel')
|
||||
{
|
||||
$soc = New Societe($db);
|
||||
$soc->fetch($_GET["id"]);
|
||||
$soc->fetch($id);
|
||||
$soc->set_price_level($_POST["price_level"],$user);
|
||||
|
||||
header("Location: multiprix.php?id=".$_GET["id"]);
|
||||
header("Location: multiprix.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ if ($_socid > 0)
|
||||
print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setpricelevel">';
|
||||
|
||||
|
||||
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print '<table width="100%" border="0">';
|
||||
@ -122,12 +123,12 @@ if ($_socid > 0)
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
|
||||
@ -867,13 +867,33 @@ if (empty($reshook))
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||
{
|
||||
$tmptxt = '(';
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id','alpha'))
|
||||
$newlang = GETPOST('lang_id','alpha');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('products');
|
||||
}
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
|
||||
} else {
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
}
|
||||
$tmptxt .= ')';
|
||||
$desc = dol_concatdesc($desc, $tmptxt);
|
||||
}
|
||||
|
||||
@ -22,6 +22,14 @@
|
||||
* \ingroup propal
|
||||
* \brief Template to show objects linked to proposals
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -40,7 +48,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -71,7 +79,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -824,12 +824,33 @@ if (empty($reshook))
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
||||
$tmptxt = '(';
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id','alpha'))
|
||||
$newlang = GETPOST('lang_id','alpha');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('products');
|
||||
}
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
|
||||
} else {
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
}
|
||||
$tmptxt .= ')';
|
||||
$desc = dol_concatdesc($desc, $tmptxt);
|
||||
}
|
||||
|
||||
@ -15,8 +15,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -36,7 +43,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -76,7 +83,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -1644,12 +1644,32 @@ if (empty($reshook))
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
||||
$tmptxt = '(';
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id','alpha'))
|
||||
$newlang = GETPOST('lang_id','alpha');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
|
||||
} else {
|
||||
if (! empty($prod->customcode))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code))
|
||||
$tmptxt .= ' - ';
|
||||
if (! empty($prod->country_code))
|
||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||
}
|
||||
$tmptxt .= ')';
|
||||
$desc = dol_concatdesc($desc, $tmptxt);
|
||||
}
|
||||
@ -2514,10 +2534,10 @@ if ($action == 'create')
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
@ -939,7 +939,8 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
@ -989,6 +990,8 @@ class Facture extends CommonInvoice
|
||||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
$line->fk_unit = $object->lines[$i]->fk_unit;
|
||||
$line->date_start = $object->lines[$i]->date_start;
|
||||
$line->date_end = $object->lines[$i]->date_end;
|
||||
|
||||
$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);
|
||||
@ -2194,6 +2197,7 @@ class Facture extends CommonInvoice
|
||||
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $mouvP->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.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
|
||||
@ -193,6 +197,6 @@ else
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -552,14 +552,14 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
|
||||
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
|
||||
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
|
||||
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category);
|
||||
if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category);
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
|
||||
if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1);
|
||||
if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2);
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($option) $param.="&option=".$option;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
@ -15,8 +15,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -36,7 +43,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -54,7 +61,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
@ -76,7 +83,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -15,8 +15,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -36,7 +43,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
|
||||
@ -102,7 +102,7 @@ if (empty($reshook))
|
||||
$tmpinvoice=new Facture($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
if (substr($key,0,7) == 'amount_' && GETPOST($key) != '')
|
||||
{
|
||||
$cursorfacid = substr($key,7);
|
||||
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
|
||||
|
||||
@ -46,14 +46,14 @@ $confirm=GETPOST('confirm', 'alpha');
|
||||
// Security check
|
||||
$fieldname = (! empty($ref)?'ref':'rowid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname);
|
||||
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','fk_user_author',$fieldname);
|
||||
|
||||
$sortfield=GETPOST('sortfield', 'alpha');
|
||||
$sortorder=GETPOST('sortorder', 'alpha');
|
||||
$page=GETPOST('page', 'int');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="b.dateo,b.rowid";
|
||||
if ($page < 0) { $page = 0 ; }
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
@ -490,53 +490,55 @@ if ($action == 'new')
|
||||
|
||||
if (count($lines[$bid]))
|
||||
{
|
||||
foreach ($lines[$bid] as $lid => $value)
|
||||
{
|
||||
$account_id = $bid;
|
||||
if (! isset($accounts[$bid]))
|
||||
$accounts[$bid]=0;
|
||||
$accounts[$bid] += 1;
|
||||
foreach ($lines[$bid] as $lid => $value)
|
||||
{
|
||||
//$account_id = $bid; FIXME not used
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($value["date"],'day').'</td>';
|
||||
print '<td>'.$value["numero"]."</td>\n";
|
||||
print '<td>'.$value["emetteur"]."</td>\n";
|
||||
print '<td>'.$value["banque"]."</td>\n";
|
||||
print '<td align="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
|
||||
// FIXME $accounts[$bid] is a label !
|
||||
/*if (! isset($accounts[$bid]))
|
||||
$accounts[$bid]=0;
|
||||
$accounts[$bid] += 1;*/
|
||||
|
||||
// Link to payment
|
||||
print '<td align="center">';
|
||||
$paymentstatic->id=$value["paymentid"];
|
||||
$paymentstatic->ref=$value["paymentid"];
|
||||
if ($paymentstatic->id)
|
||||
{
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
// Link to bank transaction
|
||||
print '<td align="center">';
|
||||
$accountlinestatic->rowid=$value["id"];
|
||||
if ($accountlinestatic->rowid)
|
||||
{
|
||||
print $accountlinestatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($value["date"],'day').'</td>';
|
||||
print '<td>'.$value["numero"]."</td>\n";
|
||||
print '<td>'.$value["emetteur"]."</td>\n";
|
||||
print '<td>'.$value["banque"]."</td>\n";
|
||||
print '<td align="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<input id="'.$value["id"].'" class="flat checkforremise_'.$bid.'" checked type="checkbox" name="toRemise[]" value="'.$value["id"].'">';
|
||||
print '</td>' ;
|
||||
print '</tr>';
|
||||
// Link to payment
|
||||
print '<td align="center">';
|
||||
$paymentstatic->id=$value["paymentid"];
|
||||
$paymentstatic->ref=$value["paymentid"];
|
||||
if ($paymentstatic->id)
|
||||
{
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
// Link to bank transaction
|
||||
print '<td align="center">';
|
||||
$accountlinestatic->rowid=$value["id"];
|
||||
if ($accountlinestatic->rowid)
|
||||
{
|
||||
print $accountlinestatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<td align="center">';
|
||||
print '<input id="'.$value["id"].'" class="flat checkforremise_'.$bid.'" checked type="checkbox" name="toRemise[]" value="'.$value["id"].'">';
|
||||
print '</td>' ;
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
@ -688,10 +690,12 @@ else
|
||||
{
|
||||
while ($objp = $db->fetch_object($resql))
|
||||
{
|
||||
$account_id = $objp->bid;
|
||||
if (! isset($accounts[$objp->bid]))
|
||||
//$account_id = $objp->bid; FIXME not used
|
||||
|
||||
// FIXME $accounts[$objp->bid] is a label
|
||||
/*if (! isset($accounts[$objp->bid]))
|
||||
$accounts[$objp->bid]=0;
|
||||
$accounts[$objp->bid] += 1;
|
||||
$accounts[$objp->bid] += 1;*/
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="center">'.$i.'</td>';
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE CONTACTCARD_CREATE.TPL.PHP DEFAULT -->
|
||||
|
||||
@ -13,9 +13,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
|
||||
?>
|
||||
|
||||
@ -13,9 +13,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
?>
|
||||
|
||||
|
||||
@ -68,6 +68,9 @@ $search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
|
||||
$search_categ_supplier=GETPOST("search_categ_supplier",'int');
|
||||
$search_status=GETPOST("search_status",'int');
|
||||
$search_type=GETPOST('search_type','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
@ -289,7 +292,7 @@ if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_pos
|
||||
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
|
||||
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
|
||||
if (strlen($search_fax)) $sql.= natural_search('p.phone_fax', $search_fax);
|
||||
if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
|
||||
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
|
||||
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
|
||||
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
|
||||
@ -396,6 +399,7 @@ if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
@ -491,12 +495,6 @@ if (! empty($arrayfields['p.firstname']['checked']))
|
||||
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
@ -509,6 +507,12 @@ if (! empty($arrayfields['p.town']['checked']))
|
||||
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
|
||||
@ -1840,7 +1840,7 @@ else
|
||||
{
|
||||
$tmpaction='unactivateline';
|
||||
$tmpactionpicto='playstop';
|
||||
$tmpactiontext=$langs->trans("Unactivate");
|
||||
$tmpactiontext=$langs->trans("Disable");
|
||||
}
|
||||
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver))
|
||||
{
|
||||
@ -1982,7 +1982,7 @@ else
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nohover">'.$langs->trans("Comment").'</td><td class="nohover"><input size="70" type="text" class="flat" name="comment" value="'.dol_escape_htmltag(GETPOST('comment', 'alpha')).'"></td>';
|
||||
print '<td class="nohover right">';
|
||||
print '<input type="submit" class="button" name="close" value="'.$langs->trans("Unactivate").'"> ';
|
||||
print '<input type="submit" class="button" name="close" value="'.$langs->trans("Disable").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -14,6 +14,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -33,7 +41,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
// Build doc
|
||||
if ($action == 'builddoc' && $permissioncreate)
|
||||
{
|
||||
|
||||
|
||||
if (is_numeric(GETPOST('model')))
|
||||
{
|
||||
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||
@ -48,13 +48,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
dol_print_error('Object must have been loaded by a fetch');
|
||||
exit;
|
||||
}*/
|
||||
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model'))
|
||||
{
|
||||
$object->setDocModel($user, GETPOST('model','alpha'));
|
||||
}
|
||||
|
||||
|
||||
// Special case to force bank account
|
||||
//if (property_exists($object, 'fk_bank'))
|
||||
//{
|
||||
@ -76,13 +76,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
|
||||
// To be sure vars is defined
|
||||
if (empty($hidedetails)) $hidedetails=0;
|
||||
if (empty($hidedesc)) $hidedesc=0;
|
||||
if (empty($hideref)) $hideref=0;
|
||||
if (empty($moreparams)) $moreparams=null;
|
||||
|
||||
|
||||
$result= $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@ -91,11 +91,15 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
|
||||
if (empty($donotredirect)) // This is set when include is done by bulk action "Bill Orders"
|
||||
{
|
||||
setEventMessages($langs->trans("FileGenerated"), null);
|
||||
|
||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
||||
$urltoredirect = $_SERVER['REQUEST_URI'];
|
||||
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
|
||||
$urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop
|
||||
|
||||
header('Location: '.$urltoredirect.'#builddoc');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,6 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
$object->attachedfiles = $attachedfiles;
|
||||
|
||||
// Call of triggers
|
||||
if (! empty($trigger_name))
|
||||
|
||||
@ -94,10 +94,30 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
}
|
||||
else $newelement = $element;
|
||||
|
||||
$_POST['action']='update'; // Hack so restrictarea will test permissions on write too
|
||||
$feature = $newelement;
|
||||
$feature2 = $subelement;
|
||||
$object_id = $fk_element;
|
||||
if ($feature == 'expedition' || $feature == 'shipping')
|
||||
{
|
||||
$feature = 'commande';
|
||||
$object_id = 0;
|
||||
}
|
||||
if ($feature == 'shipping') $feature = 'commande';
|
||||
if ($feature == 'payment') { $feature = 'facture'; }
|
||||
if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
|
||||
//var_dump(GETPOST('action','aZ09'));
|
||||
//var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id);
|
||||
$check_access = restrictedArea($user, $feature, $object_id, '', $feature2);
|
||||
//var_dump($user->rights);
|
||||
/*
|
||||
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
|
||||
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|
||||
|| ($element == 'payment' && $user->rights->facture->paiement)
|
||||
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
||||
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|
||||
|| ($element == 'payment' && $user->rights->facture->paiement)
|
||||
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
|
||||
*/
|
||||
|
||||
if ($check_access)
|
||||
{
|
||||
// Clean parameters
|
||||
$newvalue = trim($value);
|
||||
|
||||
@ -83,8 +83,8 @@ class Conf
|
||||
$this->file = new stdClass();
|
||||
$this->db = new stdClass();
|
||||
$this->global = new stdClass();
|
||||
$this->mycompany = new stdClass();
|
||||
$this->admin = new stdClass();
|
||||
$this->mycompany = new stdClass();
|
||||
$this->admin = new stdClass();
|
||||
$this->user = new stdClass();
|
||||
$this->syslog = new stdClass();
|
||||
$this->browser = new stdClass();
|
||||
|
||||
@ -166,7 +166,7 @@ class Form
|
||||
$ret.='<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$ret.='<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
if (empty($notabletag)) $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret.='<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret.='<tr><td>';
|
||||
if (preg_match('/^(string|email)/',$typeofdata))
|
||||
{
|
||||
@ -189,7 +189,7 @@ class Form
|
||||
$morealt=' style="width: '.$cols.'"';
|
||||
$cols='';
|
||||
}
|
||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>';
|
||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>';
|
||||
}
|
||||
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
|
||||
{
|
||||
@ -4170,12 +4170,12 @@ class Form
|
||||
{
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
|
||||
}
|
||||
elseif ($filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'))")
|
||||
elseif ($filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'))")
|
||||
{
|
||||
// Replace trans key with CompanyHasDownPaymentOrCommercialDiscount
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2011-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
// Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
// Copyright (C) 2011-2017 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
|
||||
@ -26,6 +26,50 @@ $(document).ready(function() {
|
||||
var table_element = $('#jeditable_table_element').html();
|
||||
var fk_element = $('#jeditable_fk_element').html();
|
||||
|
||||
|
||||
if ($('.editval_string').length > 0) {
|
||||
$('.editval_string').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
id : 'field',
|
||||
width : withInPlace, /* Size of string area in px ? */
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : placeholderInPlace,
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'string');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
});
|
||||
$('.editkey_string').hover(
|
||||
function () {
|
||||
console.log("We are hover (entry) an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
},
|
||||
function () {
|
||||
console.log("We are no more hover an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
}
|
||||
);
|
||||
$('.editkey_string').click(function() {
|
||||
console.log("We click on the edit field");
|
||||
$('#viewval_' + $(this).attr('id')).click();
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
$('.viewval_string.active').click(function() {
|
||||
console.log("We click on the viewed value");
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_textarea').length > 0) {
|
||||
$('.editval_textarea').editable(urlSaveInPlace, {
|
||||
type : 'textarea',
|
||||
@ -127,49 +171,6 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_string').length > 0) {
|
||||
$('.editval_string').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
id : 'field',
|
||||
width : withInPlace, /* Size of string area in px ? */
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : placeholderInPlace,
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'string');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
});
|
||||
$('.editkey_string').hover(
|
||||
function () {
|
||||
console.log("We are hover (entry) an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
},
|
||||
function () {
|
||||
console.log("We are no more hover an editkey_string");
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
}
|
||||
);
|
||||
$('.editkey_string').click(function() {
|
||||
$( '#viewval_' + $(this).attr('id') ).click();
|
||||
});
|
||||
$('.viewval_string.active').click(function() {
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
$('.editkey_string').click(function() {
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editval_numeric').length > 0) {
|
||||
$('.editval_numeric').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
|
||||
@ -1359,10 +1359,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour');
|
||||
}
|
||||
$late=0;
|
||||
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $db->jdate($histo[$key]['dateend']) < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) $late=1;
|
||||
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
|
||||
if ($late) $out.=img_warning($langs->trans("Late")).' ';
|
||||
$out.="</td>\n";
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ function dol_basename($pathfile)
|
||||
* @param int $recursive Determines whether subdirectories are searched
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
||||
* but must not contains the start and end '/'. Filter is checked into basename only.
|
||||
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath.
|
||||
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked both into fullpath and into basename (So '^xxx' may exclude 'xxx/dirscanned/...' and dirscanned/xxx').
|
||||
* @param string $sortcriteria Sort criteria ("","fullname","relativename","name","date","size")
|
||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||
@ -107,6 +107,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath)
|
||||
{
|
||||
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory
|
||||
$fullpathfile=($newpath?$newpath.'/':'').$file;
|
||||
|
||||
$qualified=1;
|
||||
|
||||
@ -120,10 +121,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
// Check if file is qualified
|
||||
foreach($excludefilterarray as $filt)
|
||||
{
|
||||
if (preg_match('/'.$filt.'/i',$file)) {
|
||||
if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) {
|
||||
$qualified=0; break;
|
||||
}
|
||||
}
|
||||
//print $fullpathfile.' '.$file.' '.$qualified.'<br>';
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
|
||||
@ -238,6 +238,17 @@ function dol_shutdown()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if we are in a context of submitting a parameter
|
||||
*
|
||||
* @param string $paramname Name or parameter to test
|
||||
* @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
|
||||
*/
|
||||
function GETPOSTISSET($paramname)
|
||||
{
|
||||
return (isset($_POST[$paramname]) || isset($_GET[$paramname]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value of a param into GET or POST supervariable.
|
||||
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
||||
@ -4306,6 +4317,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
||||
{
|
||||
$product->get_buyprice($idprodfournprice,0,0,0);
|
||||
$ret=$product->vatrate_supplier;
|
||||
if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -242,9 +242,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
|
||||
{
|
||||
foreach($feature2 as $subfeature)
|
||||
{
|
||||
if (empty($user->rights->$feature->$subfeature->creer)
|
||||
&& empty($user->rights->$feature->$subfeature->write)
|
||||
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
|
||||
if (empty($user->rights->$feature->$subfeature->creer)
|
||||
&& empty($user->rights->$feature->$subfeature->write)
|
||||
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
|
||||
else { $createok=1; break; } // Break to bypass second test if the first is ok
|
||||
}
|
||||
}
|
||||
@ -306,6 +306,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
|
||||
else if ($feature == 'ftp')
|
||||
{
|
||||
if (! $user->rights->ftp->write) $deleteok=0;
|
||||
}else if ($feature == 'salaries')
|
||||
{
|
||||
if (! $user->rights->salaries->delete) $deleteok=0;
|
||||
}
|
||||
else if (! empty($feature2)) // This should be used for future changes
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ class mailing_fraise extends MailingTargets
|
||||
*/
|
||||
function getSqlArrayForStats()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("members");
|
||||
|
||||
@ -73,7 +73,7 @@ class mailing_fraise extends MailingTargets
|
||||
$statssql=array();
|
||||
|
||||
$statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb";
|
||||
$statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1";
|
||||
$statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1 and entity IN (".getEntity('member').")";
|
||||
|
||||
return $statssql;
|
||||
}
|
||||
@ -89,9 +89,11 @@ class mailing_fraise extends MailingTargets
|
||||
*/
|
||||
function getNbOfRecipients($sql='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(distinct(a.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '')";
|
||||
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
@ -201,7 +203,7 @@ class mailing_fraise extends MailingTargets
|
||||
$sql.= " a.lastname, a.firstname,";
|
||||
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
||||
$sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";
|
||||
|
||||
@ -26,6 +26,13 @@
|
||||
* $elementtype
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->
|
||||
@ -56,11 +63,11 @@
|
||||
|
||||
// Case of computed field
|
||||
console.log(type);
|
||||
if (type == '' || type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||
jQuery("tr.extra_computed_value").show();
|
||||
if (type == '' || type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||
jQuery("tr.extra_computed_value").show();
|
||||
} else {
|
||||
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
||||
}
|
||||
}
|
||||
if (computed_value.val())
|
||||
{
|
||||
console.log("We enter a computed formula");
|
||||
@ -75,7 +82,7 @@
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||
}
|
||||
|
||||
|
||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||
@ -90,8 +97,8 @@
|
||||
else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
||||
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'separate') {
|
||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
else if (type == 'separate') {
|
||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
||||
}
|
||||
else { // type = string
|
||||
@ -102,12 +109,12 @@
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
default_value.removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
init_typeoffields('<?php echo GETPOST('type'); ?>');
|
||||
|
||||
@ -25,6 +25,13 @@
|
||||
* $elementtype
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_edit.tpl.php -->
|
||||
@ -54,11 +61,11 @@
|
||||
?>
|
||||
|
||||
// Case of computed field
|
||||
if (type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||
jQuery("tr.extra_computed_value").show();
|
||||
if (type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||
jQuery("tr.extra_computed_value").show();
|
||||
} else {
|
||||
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
||||
}
|
||||
}
|
||||
if (computed_value.val())
|
||||
{
|
||||
console.log("We enter a computed formula");
|
||||
@ -73,7 +80,7 @@
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||
}
|
||||
|
||||
|
||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||
else if (type == 'double') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||
@ -91,19 +98,19 @@
|
||||
else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
else { // type = string
|
||||
size.val('').prop('disabled', true);
|
||||
unique.removeAttr('disabled');
|
||||
unique.removeAttr('disabled');
|
||||
}
|
||||
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
default_value.removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||
}
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
init_typeoffields(jQuery("#type").val());
|
||||
jQuery("#type").change(function() {
|
||||
@ -113,7 +120,7 @@
|
||||
// If we enter a formula, we disable other fields
|
||||
jQuery("#computed_value").keyup(function() {
|
||||
init_typeoffields(jQuery('#type').val());
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -22,6 +22,14 @@
|
||||
* $extrafield
|
||||
* $elementtype
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
|
||||
@ -56,7 +64,7 @@ if (count($extrafields->attribute_type))
|
||||
{
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
@ -77,7 +85,7 @@ else
|
||||
{
|
||||
$colspan=9;
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) $colspan++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="opacitymedium" colspan="'.$colspan.'">';
|
||||
print $langs->trans("None");
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- START TEMPLATE FILE UPLOAD MAIN -->
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- START TEMPLATE FILE UPLOAD -->
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
* You can use this if you want to be abale to drag and drop rows of a table.
|
||||
* You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0)
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on tables -->
|
||||
|
||||
@ -16,6 +16,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($blocname))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
$hide = true; // Hide by default
|
||||
if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false);
|
||||
if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false);
|
||||
|
||||
@ -21,6 +21,14 @@
|
||||
* $withproject (if we are on task contact)
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
|
||||
@ -24,6 +24,14 @@
|
||||
// $modulepart = for download
|
||||
// $param = param to add to download links
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$langs->load("link");
|
||||
if (empty($relativepathwithnofile)) $relativepathwithnofile='';
|
||||
if (empty($permtoedit)) $permtoedit=-1;
|
||||
|
||||
@ -24,6 +24,14 @@
|
||||
* $parameters
|
||||
* $cols
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
|
||||
<?php
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
// Need global variable $title to be defined by caller (like dol_loginfunction)
|
||||
// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
|
||||
@ -54,7 +62,7 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable
|
||||
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
// Set focus on correct field
|
||||
/* Set focus on correct field */
|
||||
<?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// $cssclass must be defined by caller. For example cssclass='fieldtitle"
|
||||
$module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
|
||||
@ -30,6 +30,13 @@
|
||||
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande')))
|
||||
|
||||
@ -30,6 +30,13 @@
|
||||
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||
@ -266,21 +273,21 @@ jQuery(document).ready(function()
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
|
||||
jQuery("#price_ttc").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
jQuery("#price_ttc").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
jQuery("#multicurrency_subprice").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#price_ttc").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php
|
||||
|
||||
@ -37,6 +37,14 @@
|
||||
* $type, $text, $description, $line
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
|
||||
|
||||
$usemargins=0;
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||
|
||||
@ -16,6 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
|
||||
@ -40,7 +48,7 @@ print top_htmlhead('',$langs->trans('SendNewPassword'));
|
||||
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
// Set focus on correct field
|
||||
/* Set focus on correct field */
|
||||
<?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
<!-- BEGIN TEMPLATE resource_add.tpl.php -->
|
||||
<?php
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
<!-- BEGIN TEMPLATE resource_view.tpl.php -->
|
||||
<?php
|
||||
//var_dump($linked_resources);
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$form= new Form($db);
|
||||
|
||||
@ -34,11 +40,11 @@ if( (array) $linked_resources && count($linked_resources) > 0)
|
||||
|
||||
foreach ($linked_resources as $linked_resource)
|
||||
{
|
||||
|
||||
|
||||
$object_resource = fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
|
||||
|
||||
|
||||
//$element_id = $linked_resource['rowid'];
|
||||
|
||||
|
||||
if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
|
||||
{
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ $nb=array();
|
||||
$somme=array();
|
||||
|
||||
$sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d WHERE d.entity IN (".getEntity('donation').")";
|
||||
$sql.= " GROUP BY d.fk_statut";
|
||||
$sql.= " ORDER BY d.fk_statut";
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
|
||||
$sql.= " d.amount, d.fk_statut as statut, ";
|
||||
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
||||
if ($statut != '' && $statut != '-1')
|
||||
{
|
||||
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
|
||||
|
||||
@ -16,6 +16,14 @@
|
||||
*
|
||||
* Output javascript for interactions code of ecm module
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
|
||||
|
||||
@ -127,7 +127,7 @@ if (empty($reshook))
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Set incoterm
|
||||
// Reopen
|
||||
if ($action == 'reopen' && $user->rights->expedition->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -503,8 +503,8 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
||||
// Action update
|
||||
else if ($action == 'settracking_number' || $action == 'settracking_url'
|
||||
|| $action == 'settrueWeight'
|
||||
|| $action == 'settrueWidth'
|
||||
|| $action == 'settrueHeight'
|
||||
@ -513,8 +513,8 @@ if (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
||||
if ($action == 'settrackingurl') $object->tracking_url = trim(GETPOST('trackingurl','int'));
|
||||
if ($action == 'settracking_number') $object->tracking_number = trim(GETPOST('tracking_number','alpha'));
|
||||
if ($action == 'settracking_url') $object->tracking_url = trim(GETPOST('tracking_url','int'));
|
||||
if ($action == 'settrueWeight') {
|
||||
$object->trueWeight = trim(GETPOST('trueWeight','int'));
|
||||
$object->weight_units = GETPOST('weight_units','int');
|
||||
@ -1692,8 +1692,8 @@ else if ($id || $ref)
|
||||
print '</tr>';
|
||||
|
||||
// Tracking Number
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'tracking_number',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $form->editfieldval("TrackingNumber",'tracking_number',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
|
||||
print '</td></tr>';
|
||||
|
||||
// Incoterms
|
||||
|
||||
@ -30,9 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("deliveries");
|
||||
$langs->load('companies');
|
||||
$langs->loadLangs(array("sendings","deliveries",'companies','bills'));
|
||||
|
||||
$socid=GETPOST('socid','int');
|
||||
// Security check
|
||||
|
||||
@ -14,8 +14,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -34,7 +41,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -73,7 +80,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -15,8 +15,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -32,7 +39,7 @@ $var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
|
||||
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("ExpenseReport"); ?></td>
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -33,7 +40,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@ -14,8 +14,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -35,7 +42,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -66,7 +73,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -36,7 +44,7 @@ $var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
@ -54,7 +62,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
@ -62,7 +70,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
@ -76,7 +84,7 @@ if (count($linkedObjectBlock) > 1)
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ $langs->load("orders");
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
$socid = GETPOST("socid", 'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe',$socid,'');
|
||||
|
||||
@ -81,7 +81,7 @@ if ($resql)
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans($commande->statuts[$row[1]]).'</td>';
|
||||
@ -132,7 +132,7 @@ if (! empty($conf->fournisseur->enabled))
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$commandestatic->id=$obj->rowid;
|
||||
@ -151,7 +151,7 @@ if (! empty($conf->fournisseur->enabled))
|
||||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
@ -190,7 +190,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
@ -263,7 +263,7 @@ if ($resql)
|
||||
|
||||
while ($obj = $db->fetch_object($resql) )
|
||||
{
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>';
|
||||
@ -300,7 +300,7 @@ if (count($companystatic->SupplierCategories))
|
||||
|
||||
foreach ($companystatic->SupplierCategories as $rowid => $label)
|
||||
{
|
||||
|
||||
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
print '<td>';
|
||||
$categstatic->id=$rowid;
|
||||
|
||||
@ -989,7 +989,7 @@ class Holiday extends CommonObject
|
||||
while ($i < $nbUser)
|
||||
{
|
||||
$now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']);
|
||||
$new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth');
|
||||
$new_solde = $now_holiday + $nb_holiday;
|
||||
|
||||
// We add a log for each user
|
||||
$this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']);
|
||||
@ -1309,15 +1309,15 @@ class Holiday extends CommonObject
|
||||
// List for Dolibarr users
|
||||
if ($type)
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE (ug.fk_user = u.rowid";
|
||||
$sql.= " WHERE ((ug.fk_user = u.rowid";
|
||||
$sql.= " AND ug.entity = ".$conf->entity.")";
|
||||
$sql.= " OR u.admin = 1";
|
||||
$sql.= " OR u.admin = 1)";
|
||||
}
|
||||
else
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
|
||||
@ -424,7 +424,7 @@
|
||||
});
|
||||
/* otherwise use button with given string as text */
|
||||
} else {
|
||||
var submit = $('<button type="submit" />');
|
||||
var submit = $('<button class="button" type="submit" />');
|
||||
submit.html(settings.submit);
|
||||
}
|
||||
$(this).append(submit);
|
||||
@ -435,7 +435,7 @@
|
||||
var cancel = $(settings.cancel);
|
||||
/* otherwise use button with given string as text */
|
||||
} else {
|
||||
var cancel = $('<button type="cancel" />');
|
||||
var cancel = $('<button class="button" type="cancel" />');
|
||||
cancel.html(settings.cancel);
|
||||
}
|
||||
$(this).append(cancel);
|
||||
|
||||
@ -141,7 +141,11 @@ class Parsedown
|
||||
|
||||
foreach ($parts as $part)
|
||||
{
|
||||
$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
||||
// @CHANGE LDR Fix when mb_strlen is not available
|
||||
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
||||
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
|
||||
else $len = strlen($line);
|
||||
$shortage = 4 - $len % 4;
|
||||
|
||||
$line .= str_repeat(' ', $shortage);
|
||||
$line .= $part;
|
||||
@ -515,10 +519,10 @@ class Parsedown
|
||||
),
|
||||
);
|
||||
|
||||
if($name === 'ol')
|
||||
if($name === 'ol')
|
||||
{
|
||||
$listStart = stristr($matches[0], '.', true);
|
||||
|
||||
|
||||
if($listStart !== '1')
|
||||
{
|
||||
$Block['element']['attributes'] = array('start' => $listStart);
|
||||
|
||||
@ -367,7 +367,7 @@ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0;
|
||||
$dashboardlines=array();
|
||||
|
||||
// Do not include sections without management permission
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
|
||||
// Number of actions to do (late)
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
|
||||
@ -548,7 +548,7 @@ if (! empty($valid_dashboardlines))
|
||||
$boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent">';
|
||||
foreach($valid_dashboardlines as $board)
|
||||
{
|
||||
if (empty($boad->nbtodo)) $nbworkboardempty++;
|
||||
if (empty($board->nbtodo)) $nbworkboardempty++;
|
||||
|
||||
$textlate = $langs->trans("NActionsLate",$board->nbtodolate);
|
||||
$textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
|
||||
|
||||
@ -172,7 +172,7 @@ NumberOfSupplierOrders=Nombre de commandes fournisseurs
|
||||
NumberOfSupplierInvoices=Nombre de factures fournisseurs
|
||||
NumberOfUnitsProposals=Quantités présentes dans les propositions commerciales
|
||||
NumberOfUnitsCustomerOrders=Quantités présentes dans les commandes clients
|
||||
NumberOfUnitsCustomerInvoices=Quantités présentes dans les factures fournisseurs
|
||||
NumberOfUnitsCustomerInvoices=Quantités présentes dans les factures clients
|
||||
NumberOfUnitsSupplierProposals=Quantités présentes dans les demande de prix
|
||||
NumberOfUnitsSupplierOrders=Quantités présentes dans les commandes fournisseurs
|
||||
NumberOfUnitsSupplierInvoices=Quantités présentes dans les factures fournisseurs
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
/* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/loan/card.php
|
||||
* \ingroup loan
|
||||
* \brief Loan card
|
||||
* \file htdocs/loan/card.php
|
||||
* \ingroup loan
|
||||
* \brief Loan card
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -61,129 +61,81 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($loan->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($loan->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete loan
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($loan->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
// Delete loan
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($loan->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Add loan
|
||||
if ($action == 'add' && $user->rights->loan->write)
|
||||
{
|
||||
if (! $cancel)
|
||||
{
|
||||
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
||||
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||
$capital = price2num(GETPOST('capital'));
|
||||
$rate = GETPOST('rate');
|
||||
// Add loan
|
||||
if ($action == 'add' && $user->rights->loan->write)
|
||||
{
|
||||
if (! $cancel)
|
||||
{
|
||||
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
||||
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||
$capital = price2num(GETPOST('capital'));
|
||||
$rate = GETPOST('rate');
|
||||
|
||||
if (! $capital)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||
}
|
||||
if (! $datestart)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
|
||||
}
|
||||
if (! $dateend)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
|
||||
}
|
||||
if ($rate == '')
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
|
||||
}
|
||||
if (! $capital)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||
}
|
||||
if (! $datestart)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
|
||||
}
|
||||
if (! $dateend)
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
|
||||
}
|
||||
if ($rate == '')
|
||||
{
|
||||
$error++; $action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->label = GETPOST('label');
|
||||
$object->fk_bank = GETPOST('accountid');
|
||||
$object->capital = $capital;
|
||||
$object->datestart = $datestart;
|
||||
$object->dateend = $dateend;
|
||||
$object->nbterm = GETPOST('nbterm');
|
||||
$object->rate = $rate;
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
|
||||
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||
$accountancy_account_interest = GETPOST('accountancy_account_interest');
|
||||
|
||||
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
|
||||
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
|
||||
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
|
||||
|
||||
$id=$object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
else if ($action == 'update' && $user->rights->loan->write)
|
||||
{
|
||||
if (! $cancel)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
||||
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||
$capital = price2num(GETPOST('capital'));
|
||||
|
||||
if (! $capital)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->datestart = $datestart;
|
||||
$object->dateend = $dateend;
|
||||
$object->capital = $capital;
|
||||
$object->nbterm = GETPOST("nbterm");
|
||||
$object->rate = GETPOST("rate");
|
||||
if (! $error)
|
||||
{
|
||||
$object->label = GETPOST('label');
|
||||
$object->fk_bank = GETPOST('accountid');
|
||||
$object->capital = $capital;
|
||||
$object->datestart = $datestart;
|
||||
$object->dateend = $dateend;
|
||||
$object->nbterm = GETPOST('nbterm');
|
||||
$object->rate = $rate;
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
|
||||
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||
@ -192,43 +144,91 @@ if (empty($reshook))
|
||||
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
|
||||
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
|
||||
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
|
||||
}
|
||||
|
||||
$result = $object->update($user);
|
||||
$id=$object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Update record
|
||||
else if ($action == 'update' && $user->rights->loan->write)
|
||||
{
|
||||
if (! $cancel)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
|
||||
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
|
||||
$capital = price2num(GETPOST('capital'));
|
||||
|
||||
if (! $capital)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->datestart = $datestart;
|
||||
$object->dateend = $dateend;
|
||||
$object->capital = $capital;
|
||||
$object->nbterm = GETPOST("nbterm");
|
||||
$object->rate = GETPOST("rate");
|
||||
|
||||
$accountancy_account_capital = GETPOST('accountancy_account_capital');
|
||||
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
|
||||
$accountancy_account_interest = GETPOST('accountancy_account_interest');
|
||||
|
||||
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
|
||||
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
|
||||
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
|
||||
}
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Link to a project
|
||||
if ($action == 'classin' && $user->rights->loan->write)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject($projectid);
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject($projectid);
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($action == 'setlabel' && $user->rights->loan->write)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
if ($action == 'setlabel' && $user->rights->loan->write)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -249,19 +249,19 @@ llxHeader("",$title,$help_url);
|
||||
if ($action == 'create')
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewLoan"), '', 'title_accountancy.png');
|
||||
print load_fiche_titre($langs->trans("NewLoan"), '', 'title_accountancy.png');
|
||||
|
||||
$datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
$datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
|
||||
print '<form name="loan" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<form name="loan" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Label").'</td><td><input name="label" size="40" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>';
|
||||
@ -280,97 +280,97 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Capital
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanCapital").'</td><td><input name="capital" size="10" value="' . dol_escape_htmltag(GETPOST("capital")) . '"></td></tr>';
|
||||
// Capital
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanCapital").'</td><td><input name="capital" size="10" value="' . dol_escape_htmltag(GETPOST("capital")) . '"></td></tr>';
|
||||
|
||||
// Date Start
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
|
||||
print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1);
|
||||
print '</td></tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
|
||||
print $form->select_date($datestart?$datestart:-1,'start','','','','add',1,1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date End
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1);
|
||||
print '</td></tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $form->select_date($dateend?$dateend:-1,'end','','','','add',1,1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Number of terms
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Nbterms").'</td><td><input name="nbterm" size="5" value="' . dol_escape_htmltag(GETPOST('nbterm')) . '"></td></tr>';
|
||||
|
||||
// Rate
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . dol_escape_htmltag(GETPOST("rate")) . '"> %</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . dol_escape_htmltag(GETPOST("rate")) . '"> %</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
// Projet associe
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$numproject=$formproject->select_projects(-1, $projectid, 'projectid', 16, 0, 1, 1);
|
||||
$numproject=$formproject->select_projects(-1, $projectid, 'projectid', 16, 0, 1, 1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Note Private
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
// Note Private
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Public
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
// Note Public
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy
|
||||
// Accountancy
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_account_capital
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||
print '<td>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_account_insurance
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||
print '<td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_account_interest
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||
print '<td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_account_capital
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||
print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">';
|
||||
print '</td></tr>';
|
||||
// Accountancy_account_capital
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
|
||||
print '<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_account_insurance
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||
print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">';
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
|
||||
print '<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_account_interest
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>';
|
||||
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -382,14 +382,14 @@ if ($action == 'create')
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// View
|
||||
if ($id > 0)
|
||||
{
|
||||
$object = new Loan($db);
|
||||
$result = $object->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -413,9 +413,9 @@ if ($id > 0)
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Loan"), -1, 'bill');
|
||||
@ -441,40 +441,40 @@ if ($id > 0)
|
||||
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
@ -496,7 +496,7 @@ if ($id > 0)
|
||||
print '<tr><td class="titlefield">'.$langs->trans("LoanCapital").'</td><td>'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Date start
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart")."</td>";
|
||||
print "<td>";
|
||||
if ($action == 'edit')
|
||||
@ -548,15 +548,15 @@ if ($id > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy account capital
|
||||
// Accountancy account capital
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("LoanAccountancyCapitalCode");
|
||||
print '</td><td>';
|
||||
print $langs->trans("LoanAccountancyCapitalCode");
|
||||
print '</td><td>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1);
|
||||
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -573,15 +573,15 @@ if ($id > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy account insurance
|
||||
// Accountancy account insurance
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("LoanAccountancyInsuranceCode");
|
||||
print '</td><td>';
|
||||
print $langs->trans("LoanAccountancyInsuranceCode");
|
||||
print '</td><td>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
|
||||
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -600,13 +600,13 @@ if ($id > 0)
|
||||
|
||||
// Accountancy account interest
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("LoanAccountancyInterestCode");
|
||||
print '</td><td>';
|
||||
print $langs->trans("LoanAccountancyInterestCode");
|
||||
print '</td><td>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1);
|
||||
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -650,9 +650,9 @@ if ($id > 0)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$total_insurance = 0;
|
||||
$total_interest = 0;
|
||||
$total_capital = 0;
|
||||
$total_insurance = 0;
|
||||
$total_interest = 0;
|
||||
$total_capital = 0;
|
||||
print '<table class="noborder paymenttable">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
@ -660,8 +660,8 @@ if ($id > 0)
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Insurance").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Interest").'</td>';
|
||||
print '<td align="right">'.$langs->trans("LoanCapital").'</td>';
|
||||
print '</tr>';
|
||||
print '<td align="right">'.$langs->trans("LoanCapital").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
@ -672,11 +672,11 @@ if ($id > 0)
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
print "<td>".$objp->paiement_type.' '.$objp->num_payment."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_insurance, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_interest, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_capital, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_insurance, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_interest, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount_capital, 0, $langs, 0, 0, -1, $conf->currency)."</td>\n";
|
||||
print "</tr>";
|
||||
$total_capital += $objp->amount_capital;
|
||||
$total_capital += $objp->amount_capital;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -716,47 +716,47 @@ if ($id > 0)
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Buttons actions
|
||||
* Buttons actions
|
||||
*/
|
||||
if ($action != 'edit')
|
||||
{
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
print '<a href="javascript:popEcheancier()" class="butAction">'.$langs->trans('CreateCalcSchedule').'</a>';
|
||||
// Edit
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
print '<a href="javascript:popEcheancier()" class="butAction">'.$langs->trans('CreateCalcSchedule').'</a>';
|
||||
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
// Emit payment
|
||||
if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create">'.$langs->trans("DoPayment").'</a>';
|
||||
}
|
||||
// Emit payment
|
||||
if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create">'.$langs->trans("DoPayment").'</a>';
|
||||
}
|
||||
|
||||
// Classify 'paid'
|
||||
if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=paid">'.$langs->trans("ClassifyPaid").'</a>';
|
||||
}
|
||||
// Classify 'paid'
|
||||
if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=paid">'.$langs->trans("ClassifyPaid").'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->loan->delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
// Delete
|
||||
if ($user->rights->loan->delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -17,128 +17,128 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/loan/class/loan.class.php
|
||||
* \ingroup loan
|
||||
* \brief Class for loan module
|
||||
* \file htdocs/loan/class/loan.class.php
|
||||
* \ingroup loan
|
||||
* \brief Class for loan module
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Loan
|
||||
* Loan
|
||||
*/
|
||||
class Loan extends CommonObject
|
||||
{
|
||||
public $element='loan';
|
||||
public $table='loan';
|
||||
public $table_element='loan';
|
||||
public $element='loan';
|
||||
public $table='loan';
|
||||
public $table_element='loan';
|
||||
|
||||
public $picto = 'bill';
|
||||
public $picto = 'bill';
|
||||
|
||||
public $rowid;
|
||||
public $datestart;
|
||||
public $dateend;
|
||||
public $label;
|
||||
public $capital;
|
||||
public $nbterm;
|
||||
public $rate;
|
||||
public $paid;
|
||||
public $account_capital;
|
||||
public $account_insurance;
|
||||
public $account_interest;
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
public $date_validation;
|
||||
public $fk_bank;
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
public $fk_project;
|
||||
public $rowid;
|
||||
public $datestart;
|
||||
public $dateend;
|
||||
public $label;
|
||||
public $capital;
|
||||
public $nbterm;
|
||||
public $rate;
|
||||
public $paid;
|
||||
public $account_capital;
|
||||
public $account_insurance;
|
||||
public $account_interest;
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
public $date_validation;
|
||||
public $fk_bank;
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
public $fk_project;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id id object
|
||||
* @return int <0 error , >=0 no error
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id id object
|
||||
* @return int <0 error , >=0 no error
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
|
||||
$sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
|
||||
$sql.= " WHERE l.rowid = ".$id;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
|
||||
$sql.= " WHERE l.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
dol_syslog(get_class($this)."::fetch", 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->ref = $obj->rowid;
|
||||
$this->datestart = $this->db->jdate($obj->datestart);
|
||||
$this->dateend = $this->db->jdate($obj->dateend);
|
||||
$this->label = $obj->label;
|
||||
$this->capital = $obj->capital;
|
||||
$this->nbterm = $obj->nbterm;
|
||||
$this->rate = $obj->rate;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->paid = $obj->paid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->datestart = $this->db->jdate($obj->datestart);
|
||||
$this->dateend = $this->db->jdate($obj->dateend);
|
||||
$this->label = $obj->label;
|
||||
$this->capital = $obj->capital;
|
||||
$this->nbterm = $obj->nbterm;
|
||||
$this->rate = $obj->rate;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->paid = $obj->paid;
|
||||
|
||||
$this->account_capital = $obj->accountancy_account_capital;
|
||||
$this->account_insurance = $obj->accountancy_account_insurance;
|
||||
$this->account_interest = $obj->accountancy_account_interest;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->db->free($resql);
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->free($resql);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->free($resql);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a loan into database
|
||||
*
|
||||
* @param User $user User making creation
|
||||
* @return int <0 if KO, id if OK
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
/**
|
||||
* Create a loan into database
|
||||
*
|
||||
* @param User $user User making creation
|
||||
* @return int <0 if KO, id if OK
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$now=dol_now();
|
||||
$now=dol_now();
|
||||
|
||||
// clean parameters
|
||||
$newcapital=price2num($this->capital,'MT');
|
||||
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
|
||||
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
|
||||
// clean parameters
|
||||
$newcapital=price2num($this->capital,'MT');
|
||||
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
|
||||
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
|
||||
if (isset($this->account_capital)) $this->account_capital = trim($this->account_capital);
|
||||
if (isset($this->account_insurance)) $this->account_insurance = trim($this->account_insurance);
|
||||
if (isset($this->account_interest)) $this->account_interest = trim($this->account_interest);
|
||||
@ -147,322 +147,332 @@ class Loan extends CommonObject
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
|
||||
|
||||
// Check parameters
|
||||
if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend))
|
||||
{
|
||||
$this->error="ErrorBadParameter";
|
||||
return -2;
|
||||
}
|
||||
if (($conf->accounting->enabled) && empty($this->account_capital) && empty($this->account_insurance) && empty($this->account_interest))
|
||||
// Check parameters
|
||||
if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Accounting"));
|
||||
return -2;
|
||||
$this->error="ErrorBadParameter";
|
||||
return -2;
|
||||
}
|
||||
if (($conf->accounting->enabled) && empty($this->account_capital))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyCapitalCode"));
|
||||
return -2;
|
||||
}
|
||||
if (($conf->accounting->enabled) && empty($this->account_insurance))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInsuranceCode"));
|
||||
return -2;
|
||||
}
|
||||
if (($conf->accounting->enabled) && empty($this->account_interest))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInterestCode"));
|
||||
return -2;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,";
|
||||
$sql.= " accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity,";
|
||||
$sql.= " datec, fk_projet, fk_user_author)";
|
||||
$sql.= " VALUES ('".$this->db->escape($this->label)."',";
|
||||
$sql.= " '".$this->db->escape($this->fk_bank)."',";
|
||||
$sql.= " '".price2num($newcapital)."',";
|
||||
$sql.= " '".price2num($newcapital)."',";
|
||||
$sql.= " '".$this->db->idate($this->datestart)."',";
|
||||
$sql.= " '".$this->db->idate($this->dateend)."',";
|
||||
$sql.= " '".$this->db->escape($this->nbterm)."',";
|
||||
$sql.= " '".$this->db->escape($this->nbterm)."',";
|
||||
$sql.= " '".$this->db->escape($this->rate)."',";
|
||||
$sql.= " '".$this->db->escape($this->note_private)."',";
|
||||
$sql.= " '".$this->db->escape($this->note_public)."',";
|
||||
$sql.= " '".$this->db->escape($this->account_capital)."',";
|
||||
$sql.= " '".$this->db->escape($this->account_insurance)."',";
|
||||
$sql.= " '".$this->db->escape($this->account_interest)."',";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " '".$this->db->idate($now)."',";
|
||||
$sql.= " ".(empty($this->fk_project)?'NULL':$this->fk_project).",";
|
||||
$sql.= " ".$user->id;
|
||||
$sql.= ")";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."loan");
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."loan");
|
||||
|
||||
//dol_syslog("Loans::create this->id=".$this->id);
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//dol_syslog("Loans::create this->id=".$this->id);
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a loan
|
||||
*
|
||||
* @param User $user Object user making delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
$error=0;
|
||||
/**
|
||||
* Delete a loan
|
||||
*
|
||||
* @param User $user Object user making delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
// Get bank transaction lines for this loan
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$account=new Account($this->db);
|
||||
$lines_url=$account->get_url('',$this->id,'loan');
|
||||
// Get bank transaction lines for this loan
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$account=new Account($this->db);
|
||||
$lines_url=$account->get_url('',$this->id,'loan');
|
||||
|
||||
// Delete bank urls
|
||||
foreach ($lines_url as $line_url)
|
||||
{
|
||||
if (! $error)
|
||||
{
|
||||
$accountline=new AccountLine($this->db);
|
||||
$accountline->fetch($line_url['fk_bank']);
|
||||
$result=$accountline->delete_urls($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Delete bank urls
|
||||
foreach ($lines_url as $line_url)
|
||||
{
|
||||
if (! $error)
|
||||
{
|
||||
$accountline=new AccountLine($this->db);
|
||||
$accountline->fetch($line_url['fk_bank']);
|
||||
$result=$accountline->delete_urls($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete payments
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_loan where fk_loan=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
// Delete payments
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_loan where fk_loan=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update loan
|
||||
*
|
||||
* @param User $user User who modified
|
||||
* @return int <0 if error, >0 if ok
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
$this->db->begin();
|
||||
/**
|
||||
* Update loan
|
||||
*
|
||||
* @param User $user User who modified
|
||||
* @return int <0 if error, >0 if ok
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."loan";
|
||||
$sql.= " SET label='".$this->db->escape($this->label)."',";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."loan";
|
||||
$sql.= " SET label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
|
||||
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
|
||||
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
|
||||
$sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).",";
|
||||
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
|
||||
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
|
||||
$sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).",";
|
||||
$sql.= " fk_user_modif = ".$user->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag loan as payed completely
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_paid($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
|
||||
$sql.= " paid = 1";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
/**
|
||||
* Tag loan as payed completely
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_paid($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
|
||||
$sql.= " paid = 1";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) {
|
||||
return 1;
|
||||
} else {
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of loan status (unpaid, paid)
|
||||
*
|
||||
* @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatut($mode=0,$alreadypaid=-1)
|
||||
{
|
||||
return $this->LibStatut($this->paid,$mode,$alreadypaid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label for given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatut($statut,$mode=0,$alreadypaid=-1)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
$langs->load('bills');
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
if ($statut == 1) return $langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
if ($statut == 1) return $langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with eventually the picto)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen Label max length
|
||||
* @return string Chaine with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$tooltip = '<u>' . $langs->trans("ShowLoan") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$this->id.'"';
|
||||
$linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($tooltip, 1)).'" class="classfortooltip">';
|
||||
$linkend = '</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.$linkclose.img_object($langs->trans("ShowLoan").': '.$this->label,'bill', 'class="classfortooltip"').$linkend.' ');
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$linkclose.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of payments already done
|
||||
*
|
||||
* @return int Amount of payment already done, <0 if KO
|
||||
*/
|
||||
function getSumPayment()
|
||||
{
|
||||
$table='payment_loan';
|
||||
$field='fk_loan';
|
||||
|
||||
$sql = 'SELECT sum(amount) as amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSumPayment", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$amount=0;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $amount=$obj->amount?$obj->amount:0;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
* Return label of loan status (unpaid, paid)
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return integer|null
|
||||
* @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatut($mode=0,$alreadypaid=-1)
|
||||
{
|
||||
return $this->LibStatut($this->paid,$mode,$alreadypaid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label for given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatut($statut,$mode=0,$alreadypaid=-1)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
$langs->load('bills');
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
if ($statut == 1) return $langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
if ($statut == 1) return $langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with eventually the picto)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen Label max length
|
||||
* @return string Chaine with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$tooltip = '<u>' . $langs->trans("ShowLoan") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$this->id.'"';
|
||||
$linkclose = '" title="'.str_replace('\n', '', dol_escape_htmltag($tooltip, 1)).'" class="classfortooltip">';
|
||||
$linkend = '</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.$linkclose.img_object($langs->trans("ShowLoan").': '.$this->label,'bill', 'class="classfortooltip"').$linkend.' ');
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$linkclose.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of payments already done
|
||||
*
|
||||
* @return int Amount of payment already done, <0 if KO
|
||||
*/
|
||||
function getSumPayment()
|
||||
{
|
||||
$table='payment_loan';
|
||||
$field='fk_loan';
|
||||
|
||||
$sql = 'SELECT sum(amount) as amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSumPayment", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$amount=0;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $amount=$obj->amount?$obj->amount:0;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return integer|null
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
@ -492,17 +502,17 @@ class Loan extends CommonObject
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
if (empty($obj->fk_user_modif)) $obj->tms = "";
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
|
||||
$this->db->free($result);
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->free($result);
|
||||
return 0;
|
||||
$this->db->free($result);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -81,7 +81,8 @@ function test_sql_and_script_inject($val, $type)
|
||||
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
|
||||
if ($type != 2)
|
||||
{
|
||||
$inj += preg_match('/delete\s+from/i', $val);
|
||||
$inj += preg_match('/updatexml\(/i', $val);
|
||||
$inj += preg_match('/delete\s+from/i', $val);
|
||||
$inj += preg_match('/create\s+table/i', $val);
|
||||
$inj += preg_match('/update.+set.+=/i', $val);
|
||||
$inj += preg_match('/insert\s+into/i', $val);
|
||||
@ -1244,7 +1245,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! defined('DISABLE_JQUERY_JEDITABLE'))
|
||||
{
|
||||
print '<!-- JS to manage editInPlace feature -->'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
|
||||
@ -23,5 +23,13 @@
|
||||
* Put detailed description here.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/** Your code here. */
|
||||
echo "Hello world!";
|
||||
|
||||
@ -15,6 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
|
||||
@ -15,6 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
|
||||
@ -15,6 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
?>
|
||||
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -69,7 +76,7 @@
|
||||
if ($searchfield['enabled']) {
|
||||
if ($searchfield['search']) { ?>
|
||||
<td class="liste_titre" align="<?php echo $searchfield['align']; ?>"><input class="flat" type="text" name="s<?php echo $searchfield['alias']; ?>" value=""></td>
|
||||
<?php } else if ($key == $num) {
|
||||
<?php } else if ($key == $num) {
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
|
||||
@ -13,9 +13,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
|
||||
@ -15,6 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
|
||||
@ -15,6 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
?>
|
||||
|
||||
|
||||
@ -13,8 +13,15 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@ -69,7 +76,7 @@
|
||||
if ($searchfield['enabled']) {
|
||||
if ($searchfield['search']) { ?>
|
||||
<td class="liste_titre" align="<?php echo $searchfield['align']; ?>"><input class="flat" type="text" name="s<?php echo $searchfield['alias']; ?>" value=""></td>
|
||||
<?php } else if ($key == $num) {
|
||||
<?php } else if ($key == $num) {
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
|
||||
@ -1505,6 +1505,7 @@ class Product extends CommonObject
|
||||
// We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref)
|
||||
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,";
|
||||
$sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
||||
$sql.= " ,pfp.default_vat_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$prodfournprice;
|
||||
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
|
||||
@ -1537,9 +1538,11 @@ class Product extends CommonObject
|
||||
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
|
||||
$this->fourn_price_base_type = 'HT'; // Price base type
|
||||
$this->ref_fourn = $obj->ref_fourn; // deprecated
|
||||
$this->product_fourn_price_id = $obj->rowid; // supplier price id
|
||||
$this->ref_supplier = $obj->ref_fourn; // Ref supplier
|
||||
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
|
||||
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
|
||||
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
|
||||
$result=$obj->fk_product;
|
||||
return $result;
|
||||
}
|
||||
@ -1548,6 +1551,7 @@ class Product extends CommonObject
|
||||
// We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc.
|
||||
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
|
||||
$sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
||||
$sql.= " ,pfp.default_vat_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.fk_product = ".$product_id;
|
||||
if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
||||
@ -1583,10 +1587,12 @@ class Product extends CommonObject
|
||||
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
|
||||
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier
|
||||
$this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier
|
||||
$this->product_fourn_price_id = $obj->rowid; // supplier price id
|
||||
$this->ref_fourn = $obj->ref_supplier; // deprecated
|
||||
$this->ref_supplier = $obj->ref_supplier; // Ref supplier
|
||||
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
|
||||
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
|
||||
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
|
||||
$result=$obj->fk_product;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1,12 +1,22 @@
|
||||
<?php
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function save_qty(k) {
|
||||
|
||||
|
||||
var $input = $('input[name="qty_to_add['+k+']"]');
|
||||
var fk_det_inventory = $('input[name=det_id_'+k+']').val();
|
||||
var qty = $input.val();
|
||||
|
||||
|
||||
$('#a_save_qty_'+k).hide();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url:"ajax/ajax.inventory.php"
|
||||
,data:{
|
||||
@ -14,28 +24,28 @@
|
||||
,'qty': qty
|
||||
,'put':'qty'
|
||||
}
|
||||
|
||||
|
||||
}).done(function(data) {
|
||||
$('#qty_view_'+k).html(data);
|
||||
$input.val(0);
|
||||
$.jnotify("Quantité ajoutée : "+qty, "mesgs" );
|
||||
|
||||
|
||||
$('#a_save_qty_'+k).show();
|
||||
|
||||
|
||||
hide_save_button();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function save_pmp(k) {
|
||||
|
||||
|
||||
var $input = $('input[name="new_pmp['+k+']"]');
|
||||
var fk_det_inventory = $('input[name=det_id_'+k+']').val();
|
||||
var pmp = $input.val();
|
||||
|
||||
|
||||
$('#a_save_new_pmp_'+k).hide();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url:"ajax/ajax.inventory.php"
|
||||
,data:{
|
||||
@ -43,31 +53,31 @@
|
||||
,'pmp': pmp
|
||||
,'put':'pmp'
|
||||
}
|
||||
|
||||
|
||||
}).done(function(data) {
|
||||
$input.css({"background-color":"#66ff66"});
|
||||
$.jnotify("PMP sauvegardé : "+pmp, "mesgs" );
|
||||
$('#a_save_new_pmp_'+k).show();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function hide_save_button() {
|
||||
var nb = 0;
|
||||
$('input[name^="qty_to_add"]').each(function() {
|
||||
nb += $(this).val();
|
||||
});
|
||||
|
||||
|
||||
if(nb>0) {
|
||||
$('input[name=modify]').show();
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
$('input[name=modify]').hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -76,37 +86,37 @@
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
<input type="hidden" name="action" value="add_line" />
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||
|
||||
|
||||
<?php echo inventorySelectProducts($object); ?>
|
||||
|
||||
|
||||
<input class="button" type="submit" value="<?php echo $langs->trans('AddProduct'); ?>" />
|
||||
</form><br>
|
||||
<?php } ?>
|
||||
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
|
||||
|
||||
<?php if ($view['is_already_validate'] == 1) { ?>
|
||||
<div class="warning">Cet inventaire est validé</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<input type="hidden" name="action" value="save" />
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||
|
||||
|
||||
<table width="100%" class="noborder workstation">
|
||||
<?php
|
||||
|
||||
_headerList($view);
|
||||
|
||||
|
||||
_headerList($view);
|
||||
|
||||
$total_pmp = $total_pa = $total_pmp_actual = $total_pa_actual =$total_current_pa=$total_current_pa_actual = 0;
|
||||
$i=1;
|
||||
|
||||
foreach ($lines as $k=>$row) {
|
||||
|
||||
|
||||
foreach ($lines as $k=>$row) {
|
||||
|
||||
$total_pmp+=$row['pmp_stock'];
|
||||
$total_pa+=$row['pa_stock'];
|
||||
$total_pmp_actual+=$row['pmp_actual'];
|
||||
$total_pa_actual+=$row['pa_actual'];
|
||||
|
||||
|
||||
if($i%20 === 0)
|
||||
{
|
||||
_headerList($view);
|
||||
@ -126,18 +136,18 @@
|
||||
if(!empty($conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA)){
|
||||
echo '<td align="right" style="background-color: #e8e8ff;">'.price($row['current_pa_stock']).'</td>';
|
||||
$total_current_pa+=$row['current_pa_stock'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<?php } ?>
|
||||
<td align="center"><?php echo $row['qty']; ?> <span id="qty_view_<?php echo $row['k']; ?>"><?php echo $row['qty_view']; ?></span>
|
||||
<input type="hidden" name="det_id_<?php echo $row['k']; ?>" value="<?php echo $row['id']; ?>" />
|
||||
<input type="hidden" name="det_id_<?php echo $row['k']; ?>" value="<?php echo $row['id']; ?>" />
|
||||
</td>
|
||||
<?php if ($can_validate == 1) { ?>
|
||||
<td align="right"><?php echo price($row['pmp_actual']); ?></td>
|
||||
<?php
|
||||
if(!empty($user->rights->stock->changePMP)) {
|
||||
echo '<td align="right">'.$row['pmp_new'].'</td>';
|
||||
echo '<td align="right">'.$row['pmp_new'].'</td>';
|
||||
}
|
||||
?>
|
||||
<td align="right"><?php echo price($row['pa_actual']); ?></td>
|
||||
@ -145,8 +155,8 @@
|
||||
if(!empty($conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA)){
|
||||
echo '<td align="right">'.price($row['current_pa_actual']).'</td>';
|
||||
$total_current_pa_actual+=$row['current_pa_actual'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<td align="center"><?php echo $row['qty_regulated']; ?></td>
|
||||
<?php } ?>
|
||||
@ -154,25 +164,25 @@
|
||||
<td align="center" width="20%"><?php echo $row['action']; ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php $i++;
|
||||
|
||||
}
|
||||
|
||||
<?php $i++;
|
||||
|
||||
}
|
||||
|
||||
_footerList($view,$total_pmp,$total_pmp_actual,$total_pa,$total_pa_actual, $total_current_pa,$total_current_pa_actual);
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
|
||||
<?php if ($object->status != 1) { ?>
|
||||
<div class="tabsAction" style="height:30px;">
|
||||
<?php if ($action!= 'edit') { ?>
|
||||
<!-- <a href="<?php echo $view_url; ?>?id=<?php echo $object->id; ?>&action=exportCSV" class="butAction"><?php echo $langs->trans('ExportCSV') ?></a> -->
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $object->id; ?>&action=edit" class="butAction"><?php echo $langs->trans('Modify') ?></a>
|
||||
<?php
|
||||
<?php
|
||||
if(!empty($user->rights->stock->changePMP)) {
|
||||
echo '<a href="'.$view_url.'?id='.$object->id.'&action=changePMP" class="butAction">'.$langs->trans('ApplyPMP').'</a>';
|
||||
}
|
||||
|
||||
|
||||
if ($can_validate == 1) { ?>
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $object->id; ?>&action=regulate&token=" class="butAction"><?php echo $langs->trans('RegulateStock') ?></a>
|
||||
<?php } ?>
|
||||
@ -193,13 +203,13 @@
|
||||
|
||||
<!-- <a href="<?php echo $view_url; ?>?id=<?php echo $object->id; ?>&action=exportCSV" class="butAction"><?php echo $langs->trans('ExportCSV') ?></a> -->
|
||||
<a href="#" title="<?php echo $langs->trans('InventoryAlreadyValidated'); ?>" class="butActionRefused"><?php echo $langs->trans('Delete') ?></a>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
<p>Date de création : <?php echo $object->getDate('datec') ?>
|
||||
<br />Dernière mise à jour : <?php echo $object->getDate('tms') ?></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
require_once './lib/replenishment.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("stocks");
|
||||
@ -44,9 +45,12 @@ $sref = GETPOST('search_ref', 'alpha');
|
||||
$snom = GETPOST('search_nom', 'alpha');
|
||||
$suser = GETPOST('search_user', 'alpha');
|
||||
$sttc = GETPOST('search_ttc', 'alpha');
|
||||
$sdate = GETPOST('search_date', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$sproduct = GETPOST('sproduct', 'int');
|
||||
$search_dateyear = GETPOST('search_dateyear', 'int');
|
||||
$search_datemonth = GETPOST('search_datemonth', 'int');
|
||||
$search_dateday = GETPOST('search_dateday', 'int');
|
||||
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield");
|
||||
@ -58,7 +62,6 @@ if ($page < 0) $page = 0;
|
||||
$offset = $limit * $page;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -70,7 +73,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$snom="";
|
||||
$suser="";
|
||||
$sttc="";
|
||||
$sdate='';
|
||||
$search_date='';
|
||||
$search_datemonth='';
|
||||
$search_dateday='';
|
||||
$search_dateyear='';
|
||||
$sproduct=0;
|
||||
}
|
||||
|
||||
@ -125,17 +131,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref);
|
||||
if ($snom) $sql .= natural_search('s.nom', $snom);
|
||||
if ($suser) $sql .= natural_search('u.login', $suser);
|
||||
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
|
||||
if ($sdate)
|
||||
|
||||
if ($search_datemonth > 0)
|
||||
{
|
||||
if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int'))
|
||||
{
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$date = dol_stringtotime($sdate);
|
||||
}
|
||||
$sql .= " AND cf.date_creation = '" . $db->idate($date) . "'";
|
||||
if ($search_dateyear > 0 && empty($search_dateday))
|
||||
$sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'";
|
||||
else if ($search_dateyear > 0 && ! empty($search_dateday))
|
||||
$sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'";
|
||||
else
|
||||
$sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'";
|
||||
}
|
||||
else if ($search_dateyear > 0)
|
||||
{
|
||||
$sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'";
|
||||
}
|
||||
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
|
||||
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
|
||||
@ -146,7 +154,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
|
||||
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -158,25 +165,38 @@ if ($resql)
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($sref) $param.='&search_ref='.urlencode($sref);
|
||||
if ($snom) $param.='&search_nom='.urlencode($snom);
|
||||
if ($suser) $param.='&search_user='.urlencode($suser);
|
||||
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
|
||||
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
|
||||
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
|
||||
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre_filter">'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input type="text" class="flat" name="search_ref" value="' . $sref . '">'.
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre">'.
|
||||
'<input type="text" class="flat" name="search_ref" value="' . dol_escape_htmltag($sref) . '">'.
|
||||
'</td>'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input type="text" class="flat" name="search_nom" value="' . $snom . '">'.
|
||||
'<input type="text" class="flat" name="search_nom" value="' . dol_escape_htmltag($snom) . '">'.
|
||||
'</td>'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input type="text" class="flat" name="search_user" value="' . $suser . '">'.
|
||||
'<input type="text" class="flat" name="search_user" value="' . dol_escape_htmltag($suser) . '">'.
|
||||
'</td>'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">'.
|
||||
'<input type="text" class="flat" name="search_ttc" value="' . dol_escape_htmltag($sttc) . '">'.
|
||||
'</td>'.
|
||||
'<td class="liste_titre">'.
|
||||
$form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
|
||||
$form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
|
||||
'</td>'.
|
||||
'<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
@ -190,7 +210,7 @@ if ($resql)
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.ref',
|
||||
'',
|
||||
'',
|
||||
$param,
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
@ -200,7 +220,7 @@ if ($resql)
|
||||
$_SERVER['PHP_SELF'],
|
||||
's.nom',
|
||||
'',
|
||||
'',
|
||||
$param,
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
@ -220,7 +240,7 @@ if ($resql)
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.total_ttc',
|
||||
'',
|
||||
'',
|
||||
$param,
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
@ -230,7 +250,7 @@ if ($resql)
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.date_creation',
|
||||
'',
|
||||
'',
|
||||
$param,
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
@ -240,7 +260,7 @@ if ($resql)
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.fk_statut',
|
||||
'',
|
||||
'',
|
||||
$param,
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
* $object must be defined
|
||||
* $backtopage
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
|
||||
|
||||
@ -17,6 +17,14 @@
|
||||
* $object must be defined
|
||||
* $backtopage
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user