Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_dict
This commit is contained in:
commit
09e71f1390
@ -129,7 +129,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -269,12 +269,12 @@ if ($mode != 'focus')
|
|||||||
{
|
{
|
||||||
if ($mode != 'sortorder')
|
if ($mode != 'sortorder')
|
||||||
{
|
{
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object')); // Must match list into GETPOST
|
$substitutionarray=getCommonSubstitutionArray($langs, 2, array('object','objectamount')); // Must match list into GETPOST
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
unset($substitutionarray['__USER_SIGNATURE__']);
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.' -> '.$val.'<br>';
|
||||||
}
|
}
|
||||||
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,7 +137,17 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
// For update value with percentage
|
||||||
|
$plus='';
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
|
||||||
|
// Update values
|
||||||
|
for($i=0;$i<4;$i++) {
|
||||||
|
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,13 +206,6 @@ if ($action == 'edit')
|
|||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -244,21 +247,30 @@ else
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Boutons d'action
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Show logo for weather
|
// Show logo for weather
|
||||||
print $langs->trans("DescWeather").'<br>';
|
print $langs->trans("DescWeather").'<br>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
|
||||||
|
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
|
||||||
|
else $str_mode_enabled = $str_mode_percentage;
|
||||||
|
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
|
||||||
|
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
|
||||||
|
else print $langs->trans('MeteoPercentageModEnabled');
|
||||||
|
print '<br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
$offset=0;
|
$offset=0;
|
||||||
$cursor=10; // By default
|
$cursor=10; // By default
|
||||||
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
||||||
@ -267,36 +279,143 @@ $level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level
|
|||||||
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
||||||
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||||
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||||
$text=''; $options='height="60px"';
|
$text=''; $options='class="valignmiddle" height="60px"';
|
||||||
print '<table>';
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-clear.png',$options);
|
|
||||||
print '</td><td>= '.$level0.'</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-few-clouds.png',$options);
|
|
||||||
print '</td><td><= '.$level1.'</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-clouds.png',$options);
|
|
||||||
print '</td><td><= '.$level2.'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print img_weather($text,'weather-many-clouds.png',$options);
|
|
||||||
print '</td><td><= '.$level3.'</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-storm.png',$options);
|
|
||||||
print '</td><td>> '.$level3.'</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
if ($action == 'edit') {
|
||||||
|
|
||||||
|
|
||||||
|
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png', $options);
|
||||||
|
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#change_mode").click(function() {
|
||||||
|
var use_percent = $("#MAIN_USE_METEO_WITH_PERCENTAGE");
|
||||||
|
var str_mode_std = "<?php print $str_mode_std; ?>";
|
||||||
|
var str_mode_percentage = "<?php print $str_mode_percentage; ?>";
|
||||||
|
|
||||||
|
if(use_percent.val() == 1) {
|
||||||
|
use_percent.val(0);
|
||||||
|
$("#standard").show();
|
||||||
|
$("#percentage").hide();
|
||||||
|
$(this).html(str_mode_std);
|
||||||
|
} else {
|
||||||
|
use_percent.val(1);
|
||||||
|
$("#standard").hide();
|
||||||
|
$("#percentage").show();
|
||||||
|
$(this).html(str_mode_percentage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$level0;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$level1;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$level2;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$level3;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '> '.$level3;
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||||
|
print '<br></form>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Boutons d'action
|
||||||
|
print '<br><div class="tabsAction">';
|
||||||
|
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -177,7 +177,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
|
|||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||||
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||||
$elementList['all']=$langs->trans('VisibleEverywhere');
|
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ if (empty($reshook))
|
|||||||
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
|
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
|
||||||
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
||||||
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
||||||
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
|
||||||
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ if (! $user->admin)
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_MULTILANGS))
|
if (empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
|
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||||
}
|
}
|
||||||
if ($search_label) $sql.=natural_search('label', $search_label);
|
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||||
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
|
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||||
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,7 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for payment type (content of the paiement dictionary)
|
* API class for dictionaries
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
@ -47,13 +51,14 @@ class Dictionary extends DolibarrApi
|
|||||||
* @param int $limit Number of items per page
|
* @param int $limit Number of items per page
|
||||||
* @param int $page Page number {@min 0}
|
* @param int $page Page number {@min 0}
|
||||||
* @param int $active Payment type is active or not {@min 0} {@max 1}
|
* @param int $active Payment type is active or not {@min 0} {@max 1}
|
||||||
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
|
||||||
*
|
*
|
||||||
* @url GET payments
|
* @url GET payment/types
|
||||||
*
|
*
|
||||||
* @return List of payment types
|
* @return array [List of payment types]
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws 400 RestException
|
||||||
|
* @throws 200 OK
|
||||||
*/
|
*/
|
||||||
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -67,9 +72,9 @@ class Dictionary extends DolibarrApi
|
|||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
}
|
}
|
||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +99,7 @@ class Dictionary extends DolibarrApi
|
|||||||
$list[] = $this->db->fetch_object($result);
|
$list[] = $this->db->fetch_object($result);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(503, 'Error when retrieving list of payment types : '.$this->db->lasterror());
|
throw new RestException(400, $this->db->lasterror());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
@ -449,4 +454,66 @@ class Dictionary extends DolibarrApi
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of payments terms.
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Number of items per page
|
||||||
|
* @param int $page Page number {@min 0}
|
||||||
|
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||||
|
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
||||||
|
*
|
||||||
|
* @url GET payment/terms
|
||||||
|
*
|
||||||
|
* @return array List of payment terms
|
||||||
|
*
|
||||||
|
* @throws 400 RestException
|
||||||
|
* @throws 200 OK
|
||||||
|
*/
|
||||||
|
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
|
{
|
||||||
|
$list = array();
|
||||||
|
|
||||||
|
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
|
$sql.= " WHERE t.active = ".$active;
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0) {
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
for ($i = 0; $i < $min; $i++) {
|
||||||
|
$list[] = $this->db->fetch_object($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(400, $this->db->lasterror());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ use Luracast\Restler\Format\UploadFormat;
|
|||||||
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for receive files
|
* API class for receive files
|
||||||
@ -54,13 +55,57 @@ class Documents extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||||
* @param string $ref Reference of object (This will define subdir automatically)
|
* @param string $ref Reference of object (This will define subdir automatically)
|
||||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
* @param string $subdir NOT YET AVAILABLE : Subdirectory (Only if ref not provided)
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws 400
|
||||||
|
* @throws 401
|
||||||
|
* @throws 200 OK
|
||||||
*/
|
*/
|
||||||
public function index($module_part, $ref='', $subdir='') {
|
public function index($module_part, $ref='', $subdir='') {
|
||||||
return array('note'=>'FeatureNotYetAvailable');
|
global $conf;
|
||||||
|
|
||||||
|
if (empty($module_part)) {
|
||||||
|
throw new RestException(400, 'bad value for parameter modulepart');
|
||||||
|
}
|
||||||
|
if (empty($ref) && empty($subdir)) {
|
||||||
|
throw new RestException(400, 'bad value for parameter ref or subdir');
|
||||||
|
}
|
||||||
|
if (empty($ref)) {
|
||||||
|
throw new RestException(404, 'FeatureNotYetAvailable');
|
||||||
|
}
|
||||||
|
if (!DolibarrApiAccess::$user->rights->ecm->read) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$original_file = str_replace("../","/", $ref.'/'.$ref.'.pdf');
|
||||||
|
$refname=basename(dirname($original_file)."/");
|
||||||
|
$entity=$conf->entity;
|
||||||
|
|
||||||
|
$check_access = dol_check_secure_access_document($module_part,$original_file,$entity,DolibarrApiAccess::$user);
|
||||||
|
$accessallowed = $check_access['accessallowed'];
|
||||||
|
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||||
|
$original_file = $check_access['original_file'];
|
||||||
|
|
||||||
|
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||||
|
{
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if (!$accessallowed) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$filename = basename($original_file);
|
||||||
|
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||||
|
|
||||||
|
if (! file_exists($original_file_osencoded))
|
||||||
|
{
|
||||||
|
throw new RestException(404, 'File not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_content=file_get_contents($original_file_osencoded);
|
||||||
|
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1202,14 +1202,13 @@ if ($id > 0)
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|
||||||
|
|||||||
@ -911,55 +911,62 @@ class ActionComm extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
|
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
function load_board($user)
|
function load_board($user, $load_state_board=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = "SELECT a.id, a.datep as dp";
|
if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
else {
|
||||||
$sql.= ")";
|
$this->nb=array();
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
$sql = "SELECT count(a.id) as nb";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
}
|
||||||
$sql.= " WHERE a.percent >= 0 AND a.percent < 100";
|
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= ")";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
|
$sql.= " WHERE 1";
|
||||||
|
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
|
||||||
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
|
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
||||||
|
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$agenda_static = new ActionComm($this->db);
|
if(empty($load_state_board)) {
|
||||||
|
$agenda_static = new ActionComm($this->db);
|
||||||
|
$response = new WorkboardResponse();
|
||||||
|
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||||
|
$response->label = $langs->trans("ActionsToDo");
|
||||||
|
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||||
|
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||||
|
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
||||||
|
}
|
||||||
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
if(empty($load_state_board)) {
|
||||||
|
$response->nbtodo++;
|
||||||
|
$agenda_static->datep = $this->db->jdate($obj->dp);
|
||||||
|
if ($agenda_static->hasDelay()) $response->nbtodolate++;
|
||||||
|
} else $this->nb["actionscomm"]=$obj->nb;
|
||||||
|
}
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$this->db->free($resql);
|
||||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
if(empty($load_state_board)) return $response;
|
||||||
$response->label = $langs->trans("ActionsToDo");
|
else return 1;
|
||||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
}
|
||||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
else
|
||||||
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
$this->error=$this->db->error();
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
return -1;
|
||||||
{
|
}
|
||||||
$response->nbtodo++;
|
|
||||||
|
|
||||||
$agenda_static->datep = $this->db->jdate($obj->dp);
|
|
||||||
|
|
||||||
if ($agenda_static->hasDelay()) {
|
|
||||||
$response->nbtodolate++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -128,14 +128,13 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -51,6 +51,8 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
@ -66,14 +68,13 @@ $linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("B
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -1530,13 +1530,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array();
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Lines from source
|
// Lines from source
|
||||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
||||||
|
|||||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1162,50 +1162,88 @@ class Account extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function load_board(User $user, $filteraccountid = 0)
|
function load_board(User $user, $filteraccountid = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.datev as datefin";
|
$sql = "SELECT b.rowid, b.datev as datefin";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql.= " WHERE b.rappro=0";
|
$sql.= " WHERE b.rappro=0";
|
||||||
$sql.= " AND b.fk_account = ba.rowid";
|
$sql.= " AND b.fk_account = ba.rowid";
|
||||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||||
$sql.= " AND clos = 0";
|
$sql.= " AND clos = 0";
|
||||||
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
||||||
$response->label=$langs->trans("TransactionsToConciliate");
|
$response->label=$langs->trans("TransactionsToConciliate");
|
||||||
$response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank';
|
$response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank';
|
||||||
$response->img=img_object('',"payment");
|
$response->img=img_object('',"payment");
|
||||||
|
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) {
|
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
* @param int $filteraccountid To get info for a particular account id
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board($filteraccountid = 0)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||||
|
$sql.= " AND clos = 0";
|
||||||
|
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["banklines"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1737,7 +1737,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param User $user User making the deletion.
|
* @param User $user User making the deletion.
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, 0=Refused, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
function delete($user, $notrigger=0, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
@ -1748,9 +1748,13 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
||||||
|
|
||||||
// TODO Test if there is at least one payment. If yes, refuse to delete.
|
// Test to avoid invoice deletion (allowed if draft)
|
||||||
|
$test = $this->is_erasable();
|
||||||
|
|
||||||
|
if ($test <= 0) return $test;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
@ -3357,9 +3361,9 @@ class Facture extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Return if an invoice can be deleted
|
* Return if an invoice can be deleted
|
||||||
* Rule is:
|
* Rule is:
|
||||||
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can
|
|
||||||
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
|
|
||||||
* If invoice is draft and ha a temporary ref -> yes
|
* If invoice is draft and ha a temporary ref -> yes
|
||||||
|
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can. If hidden option INVOICE_CAN_NEVER_BE_REMOVED is on, we can't.
|
||||||
|
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, 0=no, 1=yes
|
* @return int <0 if KO, 0=no, 1=yes
|
||||||
*/
|
*/
|
||||||
@ -3367,30 +3371,36 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
// on verifie si la facture est en numerotation provisoire
|
||||||
|
$facref = substr($this->ref, 1, 4);
|
||||||
|
|
||||||
|
if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // If draft invoice and ref not yet defined
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1;
|
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1;
|
||||||
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
|
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
|
||||||
|
|
||||||
// on verifie si la facture est en numerotation provisoire
|
// TODO Test if there is at least one payment. If yes, refuse to delete.
|
||||||
$facref = substr($this->ref, 1, 4);
|
// ...
|
||||||
|
|
||||||
// If not a draft invoice and not temporary invoice
|
// If not a draft invoice and not temporary invoice
|
||||||
if ($facref != 'PROV')
|
if ($facref != 'PROV')
|
||||||
{
|
{
|
||||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||||
$ventilExportCompta = $this->getVentilExportCompta();
|
$ventilExportCompta = $this->getVentilExportCompta();
|
||||||
|
|
||||||
// If there is no invoice into the reset range and not already dispatched, we can delete
|
// If there is no invoice into the reset range and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
||||||
// If invoice to delete is last one and not already dispatched, we can delete
|
// If invoice to delete is last one and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
||||||
|
|
||||||
if ($this->situation_cycle_ref) {
|
if ($this->situation_cycle_ref) {
|
||||||
$last = $this->is_last_in_cycle();
|
$last = $this->is_last_in_cycle();
|
||||||
return $last;
|
return $last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // Si facture brouillon et provisoire
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -481,10 +481,10 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
function load_board($user)
|
function load_board($user)
|
||||||
{
|
{
|
||||||
@ -533,6 +533,45 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND b.fk_type = 'CHQ'";
|
||||||
|
$sql.= " AND b.amount > 0";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["cheques"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build document
|
* Build document
|
||||||
*
|
*
|
||||||
|
|||||||
@ -214,6 +214,12 @@ if ($action == 'create')
|
|||||||
$pastmonthyear--;
|
$pastmonthyear--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datespmonth = GETPOST('datespmonth', 'int');
|
||||||
|
$datespday = GETPOST('datespday', 'int');
|
||||||
|
$datespyear = GETPOST('datespyear', 'int');
|
||||||
|
$dateepmonth = GETPOST('dateepmonth', 'int');
|
||||||
|
$dateepday = GETPOST('dateepday', 'int');
|
||||||
|
$dateepyear = GETPOST('dateepyear', 'int');
|
||||||
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
||||||
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
||||||
|
|
||||||
@ -253,7 +259,7 @@ if ($action == 'create')
|
|||||||
// Label
|
// Label
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print fieldLabel('Label','label',1).'</td><td>';
|
print fieldLabel('Label','label',1).'</td><td>';
|
||||||
print '<input name="label" id="label" class="minwidth300" value="'.($_POST["label"]?GETPOST("label",'',2):$langs->trans("SalaryPayment")).'">';
|
print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label")?GETPOST("label"):$langs->trans("SalaryPayment")).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date start period
|
// Date start period
|
||||||
|
|||||||
@ -396,6 +396,15 @@ if (empty($reshook))
|
|||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error && empty($errors))
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +550,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td>';
|
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td>';
|
||||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||||
print $objsoc->getNomUrl(1);
|
print $objsoc->getNomUrl(1, 'contact');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<input type="hidden" name="socid" id="socid" value="'.$objsoc->id.'">';
|
print '<input type="hidden" name="socid" id="socid" value="'.$objsoc->id.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1063,7 +1072,7 @@ else
|
|||||||
$objsoc->fetch($object->socid);
|
$objsoc->fetch($object->socid);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ';
|
$morehtmlref.=$langs->trans('ThirdParty') . ' : ';
|
||||||
if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1);
|
if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1, 'contact');
|
||||||
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|||||||
@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -159,6 +159,7 @@ if ($action == 'add')
|
|||||||
$params['options'][$key] = $value;
|
$params['options'][$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$extrafields->addExtraField(
|
$result=$extrafields->addExtraField(
|
||||||
GETPOST('attrname', 'alpha'),
|
GETPOST('attrname', 'alpha'),
|
||||||
GETPOST('label', 'alpha'),
|
GETPOST('label', 'alpha'),
|
||||||
@ -172,7 +173,7 @@ if ($action == 'add')
|
|||||||
$params,
|
$params,
|
||||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||||
(GETPOST('list', 'alpha')?1:0),
|
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||||
(GETPOST('ishidden', 'alpha')?1:0),
|
(GETPOST('ishidden', 'alpha')?1:0),
|
||||||
GETPOST('computed_value','alpha'),
|
GETPOST('computed_value','alpha'),
|
||||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||||
@ -334,7 +335,7 @@ if ($action == 'update')
|
|||||||
$params,
|
$params,
|
||||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||||
(GETPOST('list', 'alpha')?1:0),
|
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||||
(GETPOST('ishidden', 'alpha')?1:0),
|
(GETPOST('ishidden', 'alpha')?1:0),
|
||||||
GETPOST('default_value','alpha'),
|
GETPOST('default_value','alpha'),
|
||||||
GETPOST('computed_value','alpha'),
|
GETPOST('computed_value','alpha'),
|
||||||
|
|||||||
@ -418,6 +418,21 @@ abstract class CommonDocGenerator
|
|||||||
$resarray[$array_key.'_total_discount_ht'] = '';
|
$resarray[$array_key.'_total_discount_ht'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch project information if there is a project assigned to this object
|
||||||
|
if ($object->element != "project" && ! empty($object->fk_project) && $object->fk_project > 0)
|
||||||
|
{
|
||||||
|
if (! is_object($object->project))
|
||||||
|
{
|
||||||
|
$object->fetch_projet();
|
||||||
|
}
|
||||||
|
|
||||||
|
$resarray[$array_key.'_project_ref'] = $object->project->ref;
|
||||||
|
$resarray[$array_key.'_project_title'] = $object->project->title;
|
||||||
|
$resarray[$array_key.'_project_description'] = $object->project->description;
|
||||||
|
$resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day');
|
||||||
|
$resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day');
|
||||||
|
}
|
||||||
|
|
||||||
// Add vat by rates
|
// Add vat by rates
|
||||||
if (is_array($object->lines) && count($object->lines)>0)
|
if (is_array($object->lines) && count($object->lines)>0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4594,23 +4594,28 @@ abstract class CommonObject
|
|||||||
}else {
|
}else {
|
||||||
$colspan='3';
|
$colspan='3';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
$value=$this->array_options["options_".$key];
|
$value=$this->array_options["options_".$key];
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
if (isset($_POST["options_" . $key])) {
|
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
||||||
if (is_array($_POST["options_" . $key])) {
|
$getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
||||||
// $_POST["options"] is an array but following code expects a comma separated string
|
if (isset($getposttemp)) {
|
||||||
$value = implode(",", $_POST["options_" . $key]);
|
if (is_array($getposttemp)) {
|
||||||
|
// $getposttemp is an array but following code expects a comma separated string
|
||||||
|
$value = implode(",", $getposttemp);
|
||||||
} else {
|
} else {
|
||||||
$value = $_POST["options_" . $key];
|
$value = $getposttemp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$value = $this->array_options["options_" . $key];
|
$value = $this->array_options["options_" . $key]; // No GET, no POST, no default value, so we take value of object.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//var_dump($value);
|
||||||
|
|
||||||
if ($extrafields->attribute_type[$key] == 'separate')
|
if ($extrafields->attribute_type[$key] == 'separate')
|
||||||
{
|
{
|
||||||
$out .= $extrafields->showSeparator($key);
|
$out .= $extrafields->showSeparator($key);
|
||||||
|
|||||||
@ -259,9 +259,8 @@ class Conf
|
|||||||
// Load translation object with current language
|
// Load translation object with current language
|
||||||
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
|
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
|
||||||
|
|
||||||
// By default, we repeat info on all tabs
|
//if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
|
||||||
if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
|
//if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
|
||||||
if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
|
|
||||||
|
|
||||||
$rootfordata = DOL_DATA_ROOT;
|
$rootfordata = DOL_DATA_ROOT;
|
||||||
$rootforuser = DOL_DATA_ROOT;
|
$rootforuser = DOL_DATA_ROOT;
|
||||||
|
|||||||
@ -140,14 +140,14 @@ class ExtraFields
|
|||||||
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||||
* @param string $perms Permission to check
|
* @param string $perms Permission to check
|
||||||
* @param int $list Into list view by default
|
* @param int $list Into list view by default (-1, 0 or 1)
|
||||||
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
* @param string $entity Entity of extrafields
|
* @param string $entity Entity of extrafields
|
||||||
* @param string $langfile Language file
|
* @param string $langfile Language file
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='', $entity='', $langfile='')
|
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $computed='', $entity='', $langfile='')
|
||||||
{
|
{
|
||||||
if (empty($attrname)) return -1;
|
if (empty($attrname)) return -1;
|
||||||
if (empty($label)) return -1;
|
if (empty($label)) return -1;
|
||||||
@ -279,7 +279,7 @@ class ExtraFields
|
|||||||
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||||
* @param string $perms Permission to check
|
* @param string $perms Permission to check
|
||||||
* @param int $list Into list view by default
|
* @param int $list Into list view by default (-1, 0 or 1)
|
||||||
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
||||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
@ -287,7 +287,7 @@ class ExtraFields
|
|||||||
* @param string $langfile Language file
|
* @param string $langfile Language file
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='',$entity='', $langfile='')
|
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $default='', $computed='',$entity='', $langfile='')
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
@ -893,7 +893,7 @@ class ExtraFields
|
|||||||
if (! is_object($form)) $form=new Form($this->db);
|
if (! is_object($form)) $form=new Form($this->db);
|
||||||
|
|
||||||
// TODO Must also support $moreparam
|
// TODO Must also support $moreparam
|
||||||
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
|
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
|
||||||
}
|
}
|
||||||
elseif (in_array($type,array('int')))
|
elseif (in_array($type,array('int')))
|
||||||
{
|
{
|
||||||
@ -1323,7 +1323,8 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
elseif ($type == 'password')
|
elseif ($type == 'password')
|
||||||
{
|
{
|
||||||
$out='<input type="password" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||||
|
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
if (!empty($hidden)) {
|
if (!empty($hidden)) {
|
||||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
||||||
|
|||||||
@ -5975,7 +5975,7 @@ class Form
|
|||||||
|
|
||||||
if ($previous_ref || $next_ref || $morehtml)
|
if ($previous_ref || $next_ref || $morehtml)
|
||||||
{
|
{
|
||||||
$ret.='<div class="pagination"><ul>';
|
$ret.='<div class="pagination paginationref"><ul class="right">';
|
||||||
}
|
}
|
||||||
if ($morehtml)
|
if ($morehtml)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,21 +57,22 @@ class FormFile
|
|||||||
/**
|
/**
|
||||||
* Show form to upload a new file
|
* Show form to upload a new file
|
||||||
*
|
*
|
||||||
* @param string $url Url
|
* @param string $url Url
|
||||||
* @param string $title Title zone (Title or '' or 'none')
|
* @param string $title Title zone (Title or '' or 'none')
|
||||||
* @param int $addcancel 1=Add 'Cancel' button
|
* @param int $addcancel 1=Add 'Cancel' button
|
||||||
* @param int $sectionid If upload must be done inside a particular ECM section
|
* @param int $sectionid If upload must be done inside a particular ECM section
|
||||||
* @param int $perm Value of permission to allow upload
|
* @param int $perm Value of permission to allow upload
|
||||||
* @param int $size Length of input file area. Deprecated.
|
* @param int $size Length of input file area. Deprecated.
|
||||||
* @param Object $object Object to use (when attachment is done on an element)
|
* @param Object $object Object to use (when attachment is done on an element)
|
||||||
* @param string $options Add an option column
|
* @param string $options Add an option column
|
||||||
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
|
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
|
||||||
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
||||||
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
|
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
|
||||||
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
|
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
|
||||||
|
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile')
|
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='')
|
||||||
{
|
{
|
||||||
global $conf,$langs, $hookmanager;
|
global $conf,$langs, $hookmanager;
|
||||||
$hookmanager->initHooks(array('formfile'));
|
$hookmanager->initHooks(array('formfile'));
|
||||||
@ -130,6 +131,7 @@ class FormFile
|
|||||||
$out .= '<input class="flat minwidth400" type="file"';
|
$out .= '<input class="flat minwidth400" type="file"';
|
||||||
$out .= ((! empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic')?' name="userfile"':' name="userfile[]" multiple');
|
$out .= ((! empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic')?' name="userfile"':' name="userfile[]" multiple');
|
||||||
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
|
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
|
||||||
|
$out .= (!empty($accept)?' accept="'.$accept.'"':'accept=""');
|
||||||
$out .= '>';
|
$out .= '>';
|
||||||
$out .= ' ';
|
$out .= ' ';
|
||||||
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
|
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
|
||||||
|
|||||||
@ -301,7 +301,7 @@ class FormMail extends Form
|
|||||||
{
|
{
|
||||||
$model_id=$this->param["models_id"];
|
$model_id=$this->param["models_id"];
|
||||||
}
|
}
|
||||||
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
|
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, ($model_id ? $model_id : -1)); // we set -1 if model_id empty
|
||||||
}
|
}
|
||||||
//var_dump($this->param["models"]);
|
//var_dump($this->param["models"]);
|
||||||
//var_dump($model_id);
|
//var_dump($model_id);
|
||||||
@ -914,7 +914,7 @@ class FormMail extends Form
|
|||||||
* @param string $type_template Get message for type=$type_template, type='all' also included.
|
* @param string $type_template Get message for type=$type_template, type='all' also included.
|
||||||
* @param string $user Use template public or limited to this user
|
* @param string $user Use template public or limited to this user
|
||||||
* @param Translate $outputlangs Output lang object
|
* @param Translate $outputlangs Output lang object
|
||||||
* @param int $id Id template to find
|
* @param int $id Id of template to find, or -1 for first found with position = 0, or 0 for all
|
||||||
* @param int $active 1=Only active template, 0=Only disabled, -1=All
|
* @param int $active 1=Only active template, 0=Only disabled, -1=All
|
||||||
* @return array array('topic'=>,'content'=>,..)
|
* @return array array('topic'=>,'content'=>,..)
|
||||||
*/
|
*/
|
||||||
@ -929,8 +929,10 @@ class FormMail extends Form
|
|||||||
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
||||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||||
if (!empty($id)) $sql.= " AND rowid=".$id;
|
if ($id > 0) $sql.= " AND rowid=".$id;
|
||||||
|
if ($id == -1) $sql.= " AND position=0";
|
||||||
$sql.= $db->order("position,lang,label","ASC");
|
$sql.= $db->order("position,lang,label","ASC");
|
||||||
|
if ($id == -1) $sql.= $db->plimit(1);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -506,26 +506,26 @@ function getDateFromFormat(val,format)
|
|||||||
if (substr == "MM" ||substr == "M")
|
if (substr == "MM" ||substr == "M")
|
||||||
{
|
{
|
||||||
month=getIntegerInString(val,d,1,2);
|
month=getIntegerInString(val,d,1,2);
|
||||||
d -= 2- month.length;
|
if (month) d -= 2- month.length;
|
||||||
}
|
}
|
||||||
if (substr == "dd")
|
if (substr == "dd")
|
||||||
{
|
{
|
||||||
day=getIntegerInString(val,d,1,2);
|
day=getIntegerInString(val,d,1,2);
|
||||||
d -= 2- day.length;
|
if (day) d -= 2- day.length;
|
||||||
}
|
}
|
||||||
if (substr == "HH" ||substr == "hh" )
|
if (substr == "HH" ||substr == "hh" )
|
||||||
{
|
{
|
||||||
hour=getIntegerInString(val,d,1,2);
|
hour=getIntegerInString(val,d,1,2);
|
||||||
d -= 2- hour.length;
|
if (dhouray) d -= 2- hour.length;
|
||||||
}
|
}
|
||||||
if (substr == "mm"){
|
if (substr == "mm"){
|
||||||
minute=getIntegerInString(val,d,1,2);
|
minute=getIntegerInString(val,d,1,2);
|
||||||
d -= 2- minute.length;
|
if (minute) d -= 2- minute.length;
|
||||||
}
|
}
|
||||||
if (substr == "ss")
|
if (substr == "ss")
|
||||||
{
|
{
|
||||||
seconde=getIntegerInString(val,d,1,2);
|
seconde=getIntegerInString(val,d,1,2);
|
||||||
d -= 2- seconde.length;
|
if (seconde) d -= 2- seconde.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
i+=substr.length;
|
i+=substr.length;
|
||||||
|
|||||||
@ -48,6 +48,28 @@ function societe_prepare_head(Societe $object)
|
|||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||||
|
{
|
||||||
|
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||||
|
$nbContact = 0; // TODO
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(p.rowid) as nb";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||||
|
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) $nbContact = $obj->nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||||
|
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||||
|
$head[$h][2] = 'contact';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
if ($object->client==1 || $object->client==2 || $object->client==3)
|
if ($object->client==1 || $object->client==2 || $object->client==3)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
|
||||||
@ -748,7 +770,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
print '<div class="div-table-responsive-nomin">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
$param="socid=".$object->id;
|
$param="socid=".$object->id;
|
||||||
|
|||||||
@ -314,111 +314,126 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
|||||||
{
|
{
|
||||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||||
{
|
{
|
||||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values
|
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||||
{
|
{
|
||||||
$qualified=1;
|
if (isset($user->default_values[$relativepathstring]['createform']))
|
||||||
if (isset($user->default_values[$relativepathstring]['createform_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
|
||||||
{
|
|
||||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['createform_queries']);
|
|
||||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
|
||||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
|
||||||
{
|
|
||||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($qualified)
|
|
||||||
{
|
{
|
||||||
//var_dump($user->default_values[$relativepathstring]['createform']);
|
foreach($user->default_values[$relativepathstring]['createform'] as $defkey => $defval)
|
||||||
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
|
{
|
||||||
|
$qualified = 0;
|
||||||
|
if ($defkey != '_noquery_')
|
||||||
|
{
|
||||||
|
$tmpqueryarraytohave=explode('&', $defkey);
|
||||||
|
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||||
|
$foundintru=0;
|
||||||
|
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||||
|
{
|
||||||
|
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||||
|
}
|
||||||
|
if (! $foundintru) $qualified=1;
|
||||||
|
//var_dump($defkey.'-'.$qualified);
|
||||||
|
}
|
||||||
|
else $qualified = 1;
|
||||||
|
|
||||||
|
if ($qualified)
|
||||||
|
{
|
||||||
|
//var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
|
||||||
|
if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
|
||||||
|
{
|
||||||
|
$out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Management of default search_filters and sort order
|
// Management of default search_filters and sort order
|
||||||
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||||
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||||
{
|
{
|
||||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values
|
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||||
{
|
{
|
||||||
//var_dump($user->default_values[$relativepathstring]);
|
//var_dump($user->default_values[$relativepathstring]);
|
||||||
if ($paramname == 'sortfield') // Sorted on which fields ?
|
if ($paramname == 'sortfield' || $paramname == 'sortorder') // Sorted on which fields ? ASC or DESC ?
|
||||||
{
|
{
|
||||||
$qualified=1;
|
if (isset($user->default_values[$relativepathstring]['sortorder'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
||||||
if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
|
||||||
{
|
{
|
||||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
|
foreach($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval)
|
||||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
|
||||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
|
||||||
{
|
{
|
||||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
$qualified = 0;
|
||||||
}
|
if ($defkey != '_noquery_')
|
||||||
}
|
{
|
||||||
if ($qualified)
|
$tmpqueryarraytohave=explode('&', $defkey);
|
||||||
{
|
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||||
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the key of $user->default_values[path][sortorder]
|
$foundintru=0;
|
||||||
{
|
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
{
|
||||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||||
{
|
}
|
||||||
if ($out) $out.=', ';
|
if (! $foundintru) $qualified=1;
|
||||||
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
|
//var_dump($defkey.'-'.$qualified);
|
||||||
}
|
}
|
||||||
|
else $qualified = 1;
|
||||||
|
|
||||||
|
if ($qualified)
|
||||||
|
{
|
||||||
|
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||||
|
foreach($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val)
|
||||||
|
{
|
||||||
|
if ($out) $out.=', ';
|
||||||
|
if ($paramname == 'sortfield')
|
||||||
|
{
|
||||||
|
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
|
||||||
|
}
|
||||||
|
if ($paramname == 'sortorder')
|
||||||
|
{
|
||||||
|
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($paramname == 'sortorder') // ASC or DESC ?
|
elseif (isset($user->default_values[$relativepathstring]['filters']))
|
||||||
{
|
{
|
||||||
$qualified=1;
|
foreach($user->default_values[$relativepathstring]['filters'] as $defkey => $defval)
|
||||||
if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
|
|
||||||
{
|
{
|
||||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
|
$qualified = 0;
|
||||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
if ($defkey != '_noquery_')
|
||||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
|
||||||
{
|
|
||||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($qualified)
|
|
||||||
{
|
|
||||||
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the val of $user->default_values[path][sortorder]
|
|
||||||
{
|
|
||||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
|
||||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
|
|
||||||
{
|
|
||||||
if ($out) $out.=', ';
|
|
||||||
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
|
|
||||||
{
|
|
||||||
$qualified=1;
|
|
||||||
if (isset($user->default_values[$relativepathstring]['filters_queries']))
|
|
||||||
{
|
|
||||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
|
|
||||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
|
||||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
|
||||||
{
|
|
||||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($qualified)
|
|
||||||
{
|
|
||||||
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
|
|
||||||
{
|
{
|
||||||
// We made a search from quick search menu, do we still use default filter ?
|
$tmpqueryarraytohave=explode('&', $defkey);
|
||||||
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
|
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||||
|
$foundintru=0;
|
||||||
|
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||||
{
|
{
|
||||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
|
|
||||||
}
|
}
|
||||||
|
if (! $foundintru) $qualified=1;
|
||||||
|
//var_dump($defkey.'-'.$qualified);
|
||||||
}
|
}
|
||||||
else
|
else $qualified = 1;
|
||||||
{
|
|
||||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
if ($qualified)
|
||||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
|
{
|
||||||
}
|
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
|
||||||
}
|
{
|
||||||
|
// We made a search from quick search menu, do we still use default filter ?
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
|
||||||
|
{
|
||||||
|
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||||
|
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||||
|
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,14 +441,14 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
||||||
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
||||||
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
|
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
|
||||||
if (! is_array($out) && empty($_POST[$paramname]))
|
if (! is_array($out) && empty($_POST[$paramname]))
|
||||||
|
{
|
||||||
|
$maxloop=20; $loopnb=0; // Protection against infinite loop
|
||||||
|
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
|
||||||
{
|
{
|
||||||
$maxloop=20; $loopnb=0; // Protection against infinite loop
|
|
||||||
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
|
|
||||||
{
|
|
||||||
$loopnb++; $newout = '';
|
$loopnb++; $newout = '';
|
||||||
|
|
||||||
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
|
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
|
||||||
@ -464,57 +479,57 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
|||||||
else $newout = ''; // Key not found, we replace with empty string
|
else $newout = ''; // Key not found, we replace with empty string
|
||||||
//var_dump('__'.$reg[1].'__ -> '.$newout);
|
//var_dump('__'.$reg[1].'__ -> '.$newout);
|
||||||
$out = preg_replace('/__'.preg_quote($reg[1],'/').'__/', $newout, $out);
|
$out = preg_replace('/__'.preg_quote($reg[1],'/').'__/', $newout, $out);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check is done after replacement
|
// Check is done after replacement
|
||||||
switch ($check)
|
switch ($check)
|
||||||
{
|
{
|
||||||
case 'none':
|
case 'none':
|
||||||
break;
|
break;
|
||||||
case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
|
case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
|
||||||
if (! is_numeric($out)) { $out=''; }
|
if (! is_numeric($out)) { $out=''; }
|
||||||
break;
|
break;
|
||||||
case 'intcomma':
|
case 'intcomma':
|
||||||
if (preg_match('/[^0-9,]+/i',$out)) $out='';
|
if (preg_match('/[^0-9,]+/i',$out)) $out='';
|
||||||
break;
|
break;
|
||||||
case 'alpha':
|
case 'alpha':
|
||||||
$out=trim($out);
|
$out=trim($out);
|
||||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||||
// '../' is dangerous because it allows dir transversals
|
// '../' is dangerous because it allows dir transversals
|
||||||
if (preg_match('/"/',$out)) $out='';
|
if (preg_match('/"/',$out)) $out='';
|
||||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||||
break;
|
break;
|
||||||
case 'san_alpha':
|
case 'san_alpha':
|
||||||
$out=filter_var($out,FILTER_SANITIZE_STRING);
|
$out=filter_var($out,FILTER_SANITIZE_STRING);
|
||||||
break;
|
break;
|
||||||
case 'aZ':
|
case 'aZ':
|
||||||
$out=trim($out);
|
$out=trim($out);
|
||||||
if (preg_match('/[^a-z]+/i',$out)) $out='';
|
if (preg_match('/[^a-z]+/i',$out)) $out='';
|
||||||
break;
|
break;
|
||||||
case 'aZ09':
|
case 'aZ09':
|
||||||
$out=trim($out);
|
$out=trim($out);
|
||||||
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
|
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
|
||||||
break;
|
break;
|
||||||
case 'array':
|
case 'array':
|
||||||
if (! is_array($out) || empty($out)) $out=array();
|
if (! is_array($out) || empty($out)) $out=array();
|
||||||
break;
|
break;
|
||||||
case 'nohtml':
|
case 'nohtml':
|
||||||
$out=dol_string_nohtmltag($out);
|
$out=dol_string_nohtmltag($out);
|
||||||
break;
|
break;
|
||||||
case 'alphanohtml': // Recommended for search params
|
case 'alphanohtml': // Recommended for search params
|
||||||
$out=trim($out);
|
$out=trim($out);
|
||||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||||
// '../' is dangerous because it allows dir transversals
|
// '../' is dangerous because it allows dir transversals
|
||||||
if (preg_match('/"/',$out)) $out='';
|
if (preg_match('/"/',$out)) $out='';
|
||||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||||
$out=dol_string_nohtmltag($out);
|
$out=dol_string_nohtmltag($out);
|
||||||
break;
|
break;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
if (empty($filter)) return 'BadFourthParameterForGETPOST';
|
if (empty($filter)) return 'BadFourthParameterForGETPOST';
|
||||||
$out=filter_var($out, $filter, $options);
|
$out=filter_var($out, $filter, $options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code for search criteria persistence.
|
// Code for search criteria persistence.
|
||||||
// Save data into session if key start with 'search_' or is 'smonth', 'syear', 'month', 'year'
|
// Save data into session if key start with 'search_' or is 'smonth', 'syear', 'month', 'year'
|
||||||
@ -5236,7 +5251,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
|||||||
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
|
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
|
||||||
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
|
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
|
||||||
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
|
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
|
||||||
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
|
'__MYCOMPANY_FULLADDRESS__' => $mysoc->getFullAddress(1, ', '),
|
||||||
|
'__MYCOMPANY_ADDRESS__' => $mysoc->address,
|
||||||
|
'__MYCOMPANY_ZIP__' => $mysoc->zip,
|
||||||
|
'__MYCOMPANY_TOWN__' => $mysoc->town,
|
||||||
|
'__MYCOMPANY_COUNTRY__' => $mysoc->country,
|
||||||
|
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude)))
|
if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude)))
|
||||||
@ -5392,8 +5412,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
|||||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||||
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user,
|
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user,
|
||||||
'__SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
|
'__USER_SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
// For backward compatibility
|
||||||
|
if ($onlykey != 2)
|
||||||
|
{
|
||||||
|
$substitutionarray['__SIGNATURE__'] = (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (! empty($conf->multicompany->enabled))
|
if (! empty($conf->multicompany->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -159,3 +159,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
|||||||
return $rep;
|
return $rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function get second level domain name.
|
||||||
|
* For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain'
|
||||||
|
*
|
||||||
|
* @param string $url Full URL.
|
||||||
|
* @return string Returns domaine name
|
||||||
|
*/
|
||||||
|
function getDomainFromURL($url)
|
||||||
|
{
|
||||||
|
$tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
|
||||||
|
$tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
|
||||||
|
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
|
||||||
|
$tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name
|
||||||
|
return $tmpdomain;
|
||||||
|
}
|
||||||
|
|||||||
@ -48,6 +48,16 @@ function commande_prepare_head(Commande $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||||
|
{
|
||||||
|
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||||
|
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
||||||
|
$head[$h][2] = 'contact';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|
||||||
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
|
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
|
||||||
{
|
{
|
||||||
@ -60,16 +70,6 @@ function commande_prepare_head(Commande $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
|
||||||
{
|
|
||||||
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
|
||||||
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
|
|
||||||
$head[$h][2] = 'contact';
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
|||||||
@ -252,7 +252,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
|
|||||||
{
|
{
|
||||||
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
|
||||||
if (empty($user->rights->$feature->creer)
|
if (empty($user->rights->$feature->creer)
|
||||||
&& empty($user->rights->$feature->write)) { $createok=0; $nbko++; }
|
&& empty($user->rights->$feature->write)
|
||||||
|
&& empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,8 @@ class pdf_paiement
|
|||||||
|
|
||||||
$month = sprintf("%02d",$month);
|
$month = sprintf("%02d",$month);
|
||||||
$year = sprintf("%04d",$year);
|
$year = sprintf("%04d",$year);
|
||||||
|
|
||||||
|
$file = $dir . "/payments-".$year."-".$month.".pdf";
|
||||||
switch ($this->doc_type) {
|
switch ($this->doc_type) {
|
||||||
case "client":
|
case "client":
|
||||||
$file = $dir . "/payments-".$year."-".$month.".pdf";
|
$file = $dir . "/payments-".$year."-".$month.".pdf";
|
||||||
|
|||||||
@ -26,6 +26,8 @@
|
|||||||
* $elementtype
|
* $elementtype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$langs->load("modulebuilder");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->
|
||||||
@ -101,13 +103,13 @@
|
|||||||
|
|
||||||
if (type == 'separate')
|
if (type == 'separate')
|
||||||
{
|
{
|
||||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
default_value.removeAttr('disabled');
|
default_value.removeAttr('disabled');
|
||||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
|
init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
|
||||||
@ -178,12 +180,9 @@
|
|||||||
<?php if ($conf->multicompany->enabled) { ?>
|
<?php if ($conf->multicompany->enabled) { ?>
|
||||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall','alpha') ? '':' checked'); ?>></td></tr>
|
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall','alpha') ? '':' checked'); ?>></td></tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
|
|
||||||
<!-- By default visible into list -->
|
<!-- By default visible into list -->
|
||||||
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>
|
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("ByDefaultInList"), $langs->trans("VisibleDesc")); ?>
|
||||||
<?php echo img_info($langs->trans("FeatureNotYetSupported")); ?>
|
</td><td class="valeur"><input id="list" size="1" type="text" name="list" value="<?php echo GETPOST('list','int')!='' ? GETPOST('list','int') : '1'; ?>"></td></tr>
|
||||||
</td><td class="valeur"><input id="list" type="checkbox" name="list" <?php echo (GETPOST('list','alpha')?' checked':''); ?>></td></tr>
|
|
||||||
<?php } ?>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php dol_fiche_end(); ?>
|
<?php dol_fiche_end(); ?>
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
* $elementtype
|
* $elementtype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$langs->load("modulebuilder");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE admin_extrafields_edit.tpl.php -->
|
||||||
@ -96,13 +98,13 @@
|
|||||||
|
|
||||||
if (type == 'separate')
|
if (type == 'separate')
|
||||||
{
|
{
|
||||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
default_value.removeAttr('disabled');
|
default_value.removeAttr('disabled');
|
||||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init_typeoffields(jQuery("#type").val());
|
init_typeoffields(jQuery("#type").val());
|
||||||
@ -238,11 +240,8 @@ else
|
|||||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ?' checked':''); ?>></td></tr>
|
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ?' checked':''); ?>></td></tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<!-- By default visible into list -->
|
<!-- By default visible into list -->
|
||||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
|
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("ByDefaultInList"), $langs->trans("VisibleDesc")); ?>
|
||||||
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>
|
</td><td class="valeur"><input id="list" size="1" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||||
<?php echo img_info($langs->trans("FeatureNotYetSupported")); ?>
|
|
||||||
</td><td class="valeur"><input id="list" type="checkbox" name="list" <?php echo ($list?' checked':''); ?>></td></tr>
|
|
||||||
<?php } ?>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php dol_fiche_end(); ?>
|
<?php dol_fiche_end(); ?>
|
||||||
|
|||||||
@ -22,6 +22,9 @@
|
|||||||
* $extrafield
|
* $extrafield
|
||||||
* $elementtype
|
* $elementtype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$langs->load("modulebuilder");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
|
||||||
@ -48,6 +51,7 @@ print '<td align="center">'.$langs->trans("Unique").'</td>';
|
|||||||
print '<td>'.$langs->trans("ComputedFormula").'</td>';
|
print '<td>'.$langs->trans("ComputedFormula").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Required").'</td>';
|
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
|
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
|
||||||
|
print '<td align="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>';
|
||||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.$langs->trans("Hidden").'</td>';
|
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.$langs->trans("Hidden").'</td>';
|
||||||
if ($conf->multicompany->enabled) {
|
if ($conf->multicompany->enabled) {
|
||||||
print '<td align="center">'.$langs->trans("Entities").'</td>';
|
print '<td align="center">'.$langs->trans("Entities").'</td>';
|
||||||
@ -70,7 +74,8 @@ if (count($extrafields->attribute_type))
|
|||||||
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n";
|
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n";
|
||||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||||
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
||||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
print '<td align="center">'.$extrafields->attribute_list[$key]."</td>\n";
|
||||||
|
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||||
if ($conf->multicompany->enabled) {
|
if ($conf->multicompany->enabled) {
|
||||||
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,16 +34,19 @@ if ($action == 'presend')
|
|||||||
|
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
if (! in_array($object->element, array('societe', 'user')))
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
//
|
|
||||||
if ($object->element == 'invoice_supplier')
|
|
||||||
{
|
{
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
}
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
//
|
||||||
|
if ($object->element == 'invoice_supplier')
|
||||||
|
{
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
||||||
|
}
|
||||||
|
|
||||||
$file = $fileparams['fullname'];
|
$file = $fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -72,16 +75,19 @@ if ($action == 'presend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file)) {
|
if (! in_array($object->element, array('societe', 'user')))
|
||||||
if ($object->element != 'member')
|
{
|
||||||
{
|
if (! $file || ! is_readable($file)) {
|
||||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
if ($object->element != 'member')
|
||||||
if ($result <= 0) {
|
{
|
||||||
dol_print_error($db, $object->error, $object->errors);
|
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
exit();
|
if ($result <= 0) {
|
||||||
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
$file = $fileparams['fullname'];
|
||||||
}
|
}
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +112,7 @@ if ($action == 'presend')
|
|||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, $trackid);
|
||||||
}
|
}
|
||||||
$formmail->withfrom = 1;
|
$formmail->withfrom = 1;
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$disablemove=1;
|
$disablemove=1;
|
||||||
if ($modulepart == 'produit') $disablemove=0;
|
if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
|
||||||
|
|
||||||
// List of document
|
// List of document
|
||||||
$formfile->list_of_documents(
|
$formfile->list_of_documents(
|
||||||
|
|||||||
40
htdocs/core/tpl/extrafields_add.tpl.php
Normal file
40
htdocs/core/tpl/extrafields_add.tpl.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Need to have following variables defined:
|
||||||
|
* $object (invoice, order, ...)
|
||||||
|
* $action
|
||||||
|
* $conf
|
||||||
|
* $langs
|
||||||
|
*
|
||||||
|
* $parameters
|
||||||
|
* $cols
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<!-- BEGIN PHP TEMPLATE extrafields_add.tpl.php -->
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
||||||
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!-- END PHP TEMPLATE extrafields_add.tpl.php -->
|
||||||
40
htdocs/core/tpl/extrafields_edit.tpl.php
Normal file
40
htdocs/core/tpl/extrafields_edit.tpl.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Need to have following variables defined:
|
||||||
|
* $object (invoice, order, ...)
|
||||||
|
* $action
|
||||||
|
* $conf
|
||||||
|
* $langs
|
||||||
|
*
|
||||||
|
* $parameters
|
||||||
|
* $cols
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<!-- BEGIN PHP TEMPLATE extrafields_edit.tpl.php -->
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
||||||
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!-- END PHP TEMPLATE extrafields_edit.tpl.php -->
|
||||||
@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $permission must be defined by caller.
|
// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
|
||||||
// $cssclass must be defined by caller. For example cssclass='fieldtitle"
|
// $cssclass must be defined by caller. For example $cssclass='fieldtitle"
|
||||||
$module = $object->element;
|
$module = $object->element;
|
||||||
$note_public = 'note_public';
|
$note_public = 'note_public';
|
||||||
$note_private = 'note_private';
|
$note_private = 'note_private';
|
||||||
|
|
||||||
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
|
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
|
||||||
|
// Set $permission from the $permissionnote var defined on calling page
|
||||||
$permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
|
$permission=(isset($permissionnote)?$permissionnote:(isset($permission)?$permission:(isset($user->rights->$module->create)?$user->rights->$module->create:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0))));
|
||||||
$moreparam=(isset($moreparam)?$moreparam:'');
|
$moreparam=(isset($moreparam)?$moreparam:'');
|
||||||
$value_public=$object->note_public;
|
$value_public=$object->note_public;
|
||||||
$value_private=$object->note_private;
|
$value_private=$object->note_private;
|
||||||
|
|||||||
@ -117,9 +117,9 @@ if (! ($result >= 0))
|
|||||||
if ($cancel)
|
if ($cancel)
|
||||||
{
|
{
|
||||||
$action ='';
|
$action ='';
|
||||||
if ($backtourl)
|
if ($backtopage)
|
||||||
{
|
{
|
||||||
header("Location: ".$backtourl);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -387,7 +387,7 @@ if ($action != 'edit')
|
|||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||||
|
|
||||||
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtourl='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
|
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if ($user->rights->ecm->setup)
|
if ($user->rights->ecm->setup)
|
||||||
|
|||||||
@ -110,7 +110,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -561,6 +561,7 @@ if (empty($reshook))
|
|||||||
if (!$res) dol_print_error($db);
|
if (!$res) dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$productsupplier = new ProductFournisseur($db);
|
||||||
if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
|
if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
|
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
|
||||||
|
|||||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
120
htdocs/index.php
120
htdocs/index.php
@ -373,135 +373,135 @@ require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
|||||||
// Number of actions to do (late)
|
// Number of actions to do (late)
|
||||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
|
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
$board=new ActionComm($db);
|
$board=new ActionComm($db);
|
||||||
|
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of project opened
|
// Number of project opened
|
||||||
if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
|
if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
$board=new Project($db);
|
$board=new Project($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of tasks to do (late)
|
// Number of tasks to do (late)
|
||||||
if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire)
|
if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
$board=new Task($db);
|
$board=new Task($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of commercial proposals opened (expired)
|
// Number of commercial proposals opened (expired)
|
||||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
$board=new Propal($db);
|
$board=new Propal($db);
|
||||||
$dashboardlines[] = $board->load_board($user,"opened");
|
$dashboardlines[] = $board->load_board($user,"opened");
|
||||||
// Number of commercial proposals CLOSED signed (billed)
|
// Number of commercial proposals CLOSED signed (billed)
|
||||||
$dashboardlines[] = $board->load_board($user,"signed");
|
$dashboardlines[] = $board->load_board($user,"signed");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of commercial proposals opened (expired)
|
// Number of commercial proposals opened (expired)
|
||||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||||
$board=new SupplierProposal($db);
|
$board=new SupplierProposal($db);
|
||||||
$dashboardlines[] = $board->load_board($user,"opened");
|
$dashboardlines[] = $board->load_board($user,"opened");
|
||||||
// Number of commercial proposals CLOSED signed (billed)
|
// Number of commercial proposals CLOSED signed (billed)
|
||||||
$dashboardlines[] = $board->load_board($user,"signed");
|
$dashboardlines[] = $board->load_board($user,"signed");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of customer orders a deal
|
// Number of customer orders a deal
|
||||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
$board=new Commande($db);
|
$board=new Commande($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of suppliers orders a deal
|
// Number of suppliers orders a deal
|
||||||
if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire)
|
if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
$board=new CommandeFournisseur($db);
|
$board=new CommandeFournisseur($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of services enabled (delayed)
|
// Number of services enabled (delayed)
|
||||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
$board=new Contrat($db);
|
$board=new Contrat($db);
|
||||||
$dashboardlines[] = $board->load_board($user,"inactives");
|
$dashboardlines[] = $board->load_board($user,"inactives");
|
||||||
// Number of active services (expired)
|
// Number of active services (expired)
|
||||||
$dashboardlines[] = $board->load_board($user,"expired");
|
$dashboardlines[] = $board->load_board($user,"expired");
|
||||||
}
|
}
|
||||||
// Number of invoices customers (has paid)
|
// Number of invoices customers (has paid)
|
||||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$board=new Facture($db);
|
$board=new Facture($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of supplier invoices (has paid)
|
// Number of supplier invoices (has paid)
|
||||||
if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fournisseur->facture->lire))
|
if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fournisseur->facture->lire))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
$board=new FactureFournisseur($db);
|
$board=new FactureFournisseur($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of transactions to conciliate
|
// Number of transactions to conciliate
|
||||||
if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id)
|
if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
$board=new Account($db);
|
$board=new Account($db);
|
||||||
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
|
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
|
||||||
if ($nb > 0)
|
if ($nb > 0)
|
||||||
{
|
{
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of cheque to send
|
// Number of cheque to send
|
||||||
if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT))
|
if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||||
$board=new RemiseCheque($db);
|
$board=new RemiseCheque($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of foundation members
|
// Number of foundation members
|
||||||
if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $user->societe_id)
|
if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $user->societe_id)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
$board=new Adherent($db);
|
$board=new Adherent($db);
|
||||||
$dashboardlines[] = $board->load_board($user);
|
$dashboardlines[] = $board->load_board($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of expense reports to approve
|
// Number of expense reports to approve
|
||||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->approve)
|
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->approve)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
$board=new ExpenseReport($db);
|
$board=new ExpenseReport($db);
|
||||||
$dashboardlines[] = $board->load_board($user,'toapprove');
|
$dashboardlines[] = $board->load_board($user,'toapprove');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of expense reports to pay
|
// Number of expense reports to pay
|
||||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid)
|
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
$board=new ExpenseReport($db);
|
$board=new ExpenseReport($db);
|
||||||
$dashboardlines[] = $board->load_board($user,'topay');
|
$dashboardlines[] = $board->load_board($user,'topay');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total nb of late
|
// Calculate total nb of late
|
||||||
$totallate=0;
|
$totallate=$totaltodo=0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
//Remove any invalid response
|
//Remove any invalid response
|
||||||
@ -516,11 +516,13 @@ foreach($dashboardlines as $tmp)
|
|||||||
foreach($valid_dashboardlines as $board)
|
foreach($valid_dashboardlines as $board)
|
||||||
{
|
{
|
||||||
if ($board->nbtodolate > 0) {
|
if ($board->nbtodolate > 0) {
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totaltodo += $board->nbtodo;
|
||||||
$totallate += $board->nbtodolate;
|
$totallate += $board->nbtodolate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//var_dump($totallate, $totaltodo);
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||||
|
//var_dump($totallate);
|
||||||
$boxwork='';
|
$boxwork='';
|
||||||
$boxwork.='<div class="box">';
|
$boxwork.='<div class="box">';
|
||||||
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
||||||
@ -533,7 +535,7 @@ if ($showweather)
|
|||||||
$boxwork.='<tr class="nohover">';
|
$boxwork.='<tr class="nohover">';
|
||||||
$boxwork.='<td class="nohover hideonsmartphone center valignmiddle">';
|
$boxwork.='<td class="nohover hideonsmartphone center valignmiddle">';
|
||||||
$text='';
|
$text='';
|
||||||
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
|
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||||
$text.='. '.$langs->trans("LateDesc");
|
$text.='. '.$langs->trans("LateDesc");
|
||||||
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
||||||
$options='height="64px"';
|
$options='height="64px"';
|
||||||
@ -691,10 +693,12 @@ function showWeather($totallate,$text,$options)
|
|||||||
$offset=0;
|
$offset=0;
|
||||||
$factor=10; // By default
|
$factor=10; // By default
|
||||||
|
|
||||||
$level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level0=$conf->global->MAIN_METEO_LEVEL0;
|
$used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
|
||||||
$level1=$offset+1*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
|
||||||
$level2=$offset+2*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level0=$offset; if (! empty($conf->global->{$used_conf.'0'})) $level0=$conf->global->{$used_conf.'0'};
|
||||||
$level3=$offset+3*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level1=$offset+1*$factor; if (! empty($conf->global->{$used_conf.'1'})) $level1=$conf->global->{$used_conf.'1'};
|
||||||
|
$level2=$offset+2*$factor; if (! empty($conf->global->{$used_conf.'2'})) $level2=$conf->global->{$used_conf.'2'};
|
||||||
|
$level3=$offset+3*$factor; if (! empty($conf->global->{$used_conf.'3'})) $level3=$conf->global->{$used_conf.'3'};
|
||||||
|
|
||||||
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
||||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
|||||||
@ -20,4 +20,7 @@
|
|||||||
-- de l'install et tous les sigles '--' sont supprimés.
|
-- de l'install et tous les sigles '--' sont supprimés.
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__<br />\n__(ID)__ : __ID__<br />\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br />\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br />\n__(Lastname)__ : __MEMBER_LASTNAME__<br />\n__(Fullname)__ : __MEMBER_FULLNAME__<br />\n__(Company)__ : __MEMBER_COMPANY__<br />\n__(Address)__ : __MEMBER_ADDRESS__<br />\n__(Zip)__ : __MEMBER_ZIP__<br />\n__(Town)__ : __MEMBER_TOWN__<br />\n__(Country)__ : __MEMBER_COUNTRY__<br />\n__(Email)__ : __MEMBER_EMAIL__<br />\n__(Birthday)__ : __MEMBER_BIRTH__<br />\n__(Photo)__ : __MEMBER_PHOTO__<br />\n__(Login)__ : __MEMBER_LOGIN__<br />\n__(Password)__ : __MEMBER_PASSWORD__<br />\n__(Phone)__ : __MEMBER_PHONE__<br />\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br />\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
|
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'adherent','member','',0,null,null,'(SendAnEMailToMember)',1,1,1,'__(CardContent)__','__(Hello)__,<br><br>\n\n__(ThisIsContentOfYourCard)__<br>\n__(ID)__ : __ID__<br>\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br>\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br />\n__(Lastname)__ : __MEMBER_LASTNAME__<br />\n__(Fullname)__ : __MEMBER_FULLNAME__<br />\n__(Company)__ : __MEMBER_COMPANY__<br />\n__(Address)__ : __MEMBER_ADDRESS__<br />\n__(Zip)__ : __MEMBER_ZIP__<br />\n__(Town)__ : __MEMBER_TOWN__<br />\n__(Country)__ : __MEMBER_COUNTRY__<br />\n__(Email)__ : __MEMBER_EMAIL__<br />\n__(Birthday)__ : __MEMBER_BIRTH__<br />\n__(Photo)__ : __MEMBER_PHOTO__<br />\n__(Login)__ : __MEMBER_LOGIN__<br />\n__(Password)__ : __MEMBER_PASSWORD__<br />\n__(Phone)__ : __MEMBER_PHONE__<br />\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br />\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null);
|
||||||
|
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,1,0,'__(YourSEPAMandate)__','__(Hello)__,<br><br>\n\n__(FindYourSEPAMandate)__ :<br>\n__MYCOMPANY_NAME__<br>\n__MYCOMPANY_FULLADDRESS__<br><br>\n__(Sincerely)__<br>\n__USER_SIGNATURE__',null);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -70,8 +70,12 @@ ALTER TABLE llx_contrat MODIFY COLUMN ref_ext varchar(50);
|
|||||||
|
|
||||||
|
|
||||||
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
|
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
|
||||||
|
UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL;
|
||||||
|
|
||||||
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__<br />\n__(ID)__ : __ID__<br />\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br />\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br />\n__(Lastname)__ : __MEMBER_LASTNAME__<br />\n__(Fullname)__ : __MEMBER_FULLNAME__<br />\n__(Company)__ : __MEMBER_COMPANY__<br />\n__(Address)__ : __MEMBER_ADDRESS__<br />\n__(Zip)__ : __MEMBER_ZIP__<br />\n__(Town)__ : __MEMBER_TOWN__<br />\n__(Country)__ : __MEMBER_COUNTRY__<br />\n__(Email)__ : __MEMBER_EMAIL__<br />\n__(Birthday)__ : __MEMBER_BIRTH__<br />\n__(Photo)__ : __MEMBER_PHOTO__<br />\n__(Login)__ : __MEMBER_LOGIN__<br />\n__(Password)__ : __MEMBER_PASSWORD__<br />\n__(Phone)__ : __MEMBER_PHONE__<br />\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br />\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
|
ALTER TABLE llx_c_email_templates ADD COLUMN enabled varchar(255) DEFAULT '1';
|
||||||
|
|
||||||
|
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'adherent','member','',0,null,null,'(SendAnEMailToMember)',1,1,1,'__(CardContent)__','__(Hello)__,<br><br>\n\n__(ThisIsContentOfYourCard)__<br>\n__(ID)__ : __ID__<br>\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br>\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br />\n__(Lastname)__ : __MEMBER_LASTNAME__<br />\n__(Fullname)__ : __MEMBER_FULLNAME__<br />\n__(Company)__ : __MEMBER_COMPANY__<br />\n__(Address)__ : __MEMBER_ADDRESS__<br />\n__(Zip)__ : __MEMBER_ZIP__<br />\n__(Town)__ : __MEMBER_TOWN__<br />\n__(Country)__ : __MEMBER_COUNTRY__<br />\n__(Email)__ : __MEMBER_EMAIL__<br />\n__(Birthday)__ : __MEMBER_BIRTH__<br />\n__(Photo)__ : __MEMBER_PHOTO__<br />\n__(Login)__ : __MEMBER_LOGIN__<br />\n__(Password)__ : __MEMBER_PASSWORD__<br />\n__(Phone)__ : __MEMBER_PHONE__<br />\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br />\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null);
|
||||||
|
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,1,0,'__(YourSEPAMandate)__','__(Hello)__,<br><br>\n\n__(FindYourSEPAMandate)__ :<br>\n__MYCOMPANY_NAME__<br>\n__MYCOMPANY_FULLADDRESS__<br><br>\n__(Sincerely)__<br>\n__USER_SIGNATURE__',null);
|
||||||
|
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
|
||||||
@ -99,6 +103,7 @@ ALTER TABLE llx_website_page MODIFY COLUMN pageurl varchar(255);
|
|||||||
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
|
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
|
||||||
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
|
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
|
||||||
ALTER TABLE llx_website_page ADD COLUMN grabbed_from varchar(255);
|
ALTER TABLE llx_website_page ADD COLUMN grabbed_from varchar(255);
|
||||||
|
ALTER TABLE llx_website_page ADD COLUMN htmlheader text;
|
||||||
|
|
||||||
ALTER TABLE llx_website_page MODIFY COLUMN status INTEGER DEFAULT 1;
|
ALTER TABLE llx_website_page MODIFY COLUMN status INTEGER DEFAULT 1;
|
||||||
UPDATE llx_website_page set status = 1 WHERE status IS NULL;
|
UPDATE llx_website_page set status = 1 WHERE status IS NULL;
|
||||||
@ -257,6 +262,12 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer;
|
|||||||
ALTER TABLE llx_extrafields ADD COLUMN datec datetime;
|
ALTER TABLE llx_extrafields ADD COLUMN datec datetime;
|
||||||
ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||||
|
|
||||||
|
-- We fix value of 'list' fro m0 to 1 for all extrafields created before this migration
|
||||||
|
UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
|
||||||
|
--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
|
||||||
|
|
||||||
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
|
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
|
||||||
|
|
||||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
||||||
|
|||||||
@ -23,13 +23,14 @@ create table llx_c_email_templates
|
|||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
module varchar(32), -- Nom du module en rapport avec le modele
|
module varchar(32), -- Nom du module en rapport avec le modele
|
||||||
type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...)
|
type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...)
|
||||||
lang varchar(6),
|
lang varchar(6) DEFAULT '', -- We use a default to '' so the unique index that include this field will work
|
||||||
private smallint DEFAULT 0 NOT NULL, -- Template public or private
|
private smallint DEFAULT 0 NOT NULL, -- Template public or private
|
||||||
fk_user integer, -- Id user owner if template is private, or null
|
fk_user integer, -- Id user owner if template is private, or null
|
||||||
datec datetime,
|
datec datetime,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
label varchar(255), -- Label of predefined email
|
label varchar(255), -- Label of predefined email
|
||||||
position smallint, -- Position
|
position smallint, -- Position
|
||||||
|
enabled varchar(255) DEFAULT '1', -- Condition to have this module visible
|
||||||
active tinyint DEFAULT 1 NOT NULL,
|
active tinyint DEFAULT 1 NOT NULL,
|
||||||
topic text, -- Predefined topic
|
topic text, -- Predefined topic
|
||||||
content text, -- Predefined text
|
content text, -- Predefined text
|
||||||
|
|||||||
@ -34,7 +34,7 @@ create table llx_extrafields
|
|||||||
pos integer DEFAULT 0,
|
pos integer DEFAULT 0,
|
||||||
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
|
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
|
||||||
param text, -- extra parameters to define possible values of field
|
param text, -- extra parameters to define possible values of field
|
||||||
list integer DEFAULT 0, -- list of values for field that are combo lists
|
list integer DEFAULT 1, -- list of values for field that are combo lists
|
||||||
langs varchar(64), -- example: fileofmymodule@mymodule
|
langs varchar(64), -- example: fileofmymodule@mymodule
|
||||||
ishidden integer DEFAULT 0, -- Can be foreign key of external system
|
ishidden integer DEFAULT 0, -- Can be foreign key of external system
|
||||||
fk_user_author integer, -- user making creation
|
fk_user_author integer, -- user making creation
|
||||||
|
|||||||
@ -27,6 +27,7 @@ CREATE TABLE llx_website_page
|
|||||||
keywords varchar(255),
|
keywords varchar(255),
|
||||||
lang varchar(6),
|
lang varchar(6),
|
||||||
fk_page integer,
|
fk_page integer,
|
||||||
|
htmlheader text,
|
||||||
content mediumtext, -- text is not enough in size
|
content mediumtext, -- text is not enough in size
|
||||||
status integer DEFAULT 1,
|
status integer DEFAULT 1,
|
||||||
grabbed_from varchar(255),
|
grabbed_from varchar(255),
|
||||||
|
|||||||
@ -452,8 +452,8 @@ DependsOn=This module need the module(s)
|
|||||||
RequiredBy=This module is required by module(s)
|
RequiredBy=This module is required by module(s)
|
||||||
TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field.
|
TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field.
|
||||||
PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples:
|
PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples:
|
||||||
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
|
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>,<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||||
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
|
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>,<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||||
EnableDefaultValues=Enable usage of personalized default values
|
EnableDefaultValues=Enable usage of personalized default values
|
||||||
EnableOverwriteTranslation=Enable usage of overwrote translation
|
EnableOverwriteTranslation=Enable usage of overwrote translation
|
||||||
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation.
|
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation.
|
||||||
@ -1089,6 +1089,11 @@ ShowProfIdInAddress=Show professionnal id with addresses on documents
|
|||||||
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
|
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
|
||||||
TranslationUncomplete=Partial translation
|
TranslationUncomplete=Partial translation
|
||||||
MAIN_DISABLE_METEO=Disable meteo view
|
MAIN_DISABLE_METEO=Disable meteo view
|
||||||
|
MeteoStdMod=Standard mode
|
||||||
|
MeteoStdModEnabled=Standard mode enabled
|
||||||
|
MeteoPercentageMod=Percentage mode
|
||||||
|
MeteoPercentageModEnabled=Percentage mode enabled
|
||||||
|
MeteoUseMod=Click to use %s
|
||||||
TestLoginToAPI=Test login to API
|
TestLoginToAPI=Test login to API
|
||||||
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
|
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
|
||||||
ExternalAccess=External access
|
ExternalAccess=External access
|
||||||
|
|||||||
@ -158,3 +158,5 @@ VariousPayment=Miscellaneous payments
|
|||||||
VariousPayments=Miscellaneous payments
|
VariousPayments=Miscellaneous payments
|
||||||
ShowVariousPayment=Show miscellaneous payments
|
ShowVariousPayment=Show miscellaneous payments
|
||||||
AddVariousPayment=Add miscellaneous payments
|
AddVariousPayment=Add miscellaneous payments
|
||||||
|
YourSEPAMandate=Your SEPA mandate
|
||||||
|
FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Thanks to return it signed (scan of the signed document) or sent it by mail to
|
||||||
|
|||||||
@ -262,6 +262,7 @@ DateBuild=Report build date
|
|||||||
DatePayment=Date of payment
|
DatePayment=Date of payment
|
||||||
DateApprove=Approving date
|
DateApprove=Approving date
|
||||||
DateApprove2=Approving date (second approval)
|
DateApprove2=Approving date (second approval)
|
||||||
|
RegistrationDate=Registration date
|
||||||
UserCreation=Creation user
|
UserCreation=Creation user
|
||||||
UserModification=Modification user
|
UserModification=Modification user
|
||||||
UserCreationShort=Creat. user
|
UserCreationShort=Creat. user
|
||||||
@ -770,6 +771,7 @@ Genderwoman=Woman
|
|||||||
ViewList=List view
|
ViewList=List view
|
||||||
Mandatory=Mandatory
|
Mandatory=Mandatory
|
||||||
Hello=Hello
|
Hello=Hello
|
||||||
|
GoodBye=GoodBye
|
||||||
Sincerely=Sincerely
|
Sincerely=Sincerely
|
||||||
DeleteLine=Delete line
|
DeleteLine=Delete line
|
||||||
ConfirmDeleteLine=Are you sure you want to delete this line?
|
ConfirmDeleteLine=Are you sure you want to delete this line?
|
||||||
|
|||||||
@ -87,8 +87,8 @@ PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here
|
|||||||
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendShipping=__CONTACTCIVNAME__\n\nYou will find here the shipping __SHIPPINGREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendShipping=__CONTACTCIVNAME__\n\nYou will find here the shipping __SHIPPINGREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendFichInter=__CONTACTCIVNAME__\n\nYou will find here the intervention __FICHINTERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendFichInter=__CONTACTCIVNAME__\n\nYou will find here the intervention __FICHINTERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentThirdparty=__CONTACTCIVNAME__\n\n__PERSONALIZED__\n\n__SIGNATURE__
|
PredefinedMailContentThirdparty=\n\n__SIGNATURE__
|
||||||
PredefinedMailContentUser=aa__PERSONALIZED__\n\n__SIGNATURE__
|
PredefinedMailContentUser=\n\n__SIGNATURE__
|
||||||
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
|
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
|
||||||
ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
|
ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
|
||||||
ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection)
|
ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection)
|
||||||
|
|||||||
@ -37,7 +37,7 @@ VirtualHostUrlNotDefined=URL of the virtual host served by external web server n
|
|||||||
NoPageYet=No pages yet
|
NoPageYet=No pages yet
|
||||||
SyntaxHelp=Help on specific syntax tips
|
SyntaxHelp=Help on specific syntax tips
|
||||||
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
|
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
|
||||||
YouCanEditHtmlSource=You can include PHP code into this source using tags <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br>You can also include content of another Page/Container with the following syntax: <strong><?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?></strong><br><br>To include a link to download a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong><a href="/document.php?modulepart=ecm&file=reldir/filename.ext"></strong>.<br>for a file into documents/media (open public access), syntax is:<br><strong><a href="/document.php?modulepart=medias[&hashp=publicsharekey if modulepart != medias]"></strong>.<br><br>To include an image stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/media (open access), syntax is:<br><strong><a href="/viewimage.php?modulepart=medias&file=filename.ext"></strong>.
|
YouCanEditHtmlSource=You can include PHP code into this source using tags <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br>You can also include content of another Page/Container with the following syntax:<br><strong><?php dolIncludeHtmlContent($websitekey.'/alias_of_content_to_include.php'); ?></strong><br><br>To include a <strong>link to download</strong> a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong><a href="/document.php?modulepart=ecm&file=relative_dir/filename.ext"></strong><br>For same file into documents/ecm (open access using the sharing hash key), syntax is:<br><strong><a href="/document.php?modulepart=ecm&file=relative_dir/filename.ext&hashp=publicsharekeyoffile"></strong><br>For a file into documents/media (open directory for public access), syntax is:<br><strong><a href="/document.php?modulepart=medias&file=relative_dir/filename.ext"></strong><br><br>To include an <strong>image</strong> stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/media (open access), syntax is:<br><strong><a href="/viewimage.php?modulepart=medias&file=relative_dir/filename.ext"></strong>
|
||||||
ClonePage=Clone page/container
|
ClonePage=Clone page/container
|
||||||
CloneSite=Clone site
|
CloneSite=Clone site
|
||||||
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
|
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
|
||||||
@ -49,3 +49,4 @@ CreateByFetchingExternalPage=Create page/container by fetching page from externa
|
|||||||
OrEnterPageInfoManually=Or create empty page from scratch...
|
OrEnterPageInfoManually=Or create empty page from scratch...
|
||||||
FetchAndCreate=Fetch and Create
|
FetchAndCreate=Fetch and Create
|
||||||
ExportSite=Export site
|
ExportSite=Export site
|
||||||
|
IDOfPage=Id of page
|
||||||
@ -81,8 +81,10 @@ class MyObject extends CommonObject
|
|||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||||
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'),
|
||||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
|
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
|
||||||
|
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
||||||
|
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
function myobjectPrepareHead($object)
|
function myobjectPrepareHead($object)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
|
|
||||||
$langs->load("mymodule@mymodule");
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
@ -40,17 +40,30 @@ function myobjectPrepareHead($object)
|
|||||||
$head[$h][1] = $langs->trans("Card");
|
$head[$h][1] = $langs->trans("Card");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
if (isset($object->fields['note_public']) || isset($object->fields['note_pricate']))
|
|
||||||
|
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||||
{
|
{
|
||||||
$head[$h][0] = dol_buildpath("/mymodule/myobject_note.php", 1).'?id='.$object->id;
|
$nbNote = 0;
|
||||||
$head[$h][1] = $langs->trans("Notes");
|
if(!empty($object->fields['note_private'])) $nbNote++;
|
||||||
|
if(!empty($object->fields['note_public'])) $nbNote++;
|
||||||
|
$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'note';
|
$head[$h][2] = 'note';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
|
$upload_dir = $conf->mymodule->dir_output . "/myobject/" . dol_sanitizeFileName($object->ref);
|
||||||
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||||
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Documents");
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
$head[$h][2] = 'document';
|
$head[$h][2] = 'document';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = dol_buildpath("/mymodule/myobject_agenda.php", 1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath("/mymodule/myobject_agenda.php", 1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Events");
|
$head[$h][1] = $langs->trans("Events");
|
||||||
$head[$h][2] = 'agenda';
|
$head[$h][2] = 'agenda';
|
||||||
|
|||||||
@ -166,8 +166,9 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||||
|
|
||||||
$object->$key=GETPOST($key,'alpha');
|
$object->$key=GETPOST($key,'alpha');
|
||||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
|
||||||
if ($val['notnull'] > 0 && $object->$key == '')
|
if ($val['notnull'] > 0 && $object->$key == '')
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -280,6 +281,7 @@ if ($action == 'create')
|
|||||||
print $langs->trans($val['label']);
|
print $langs->trans($val['label']);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
$defaultcss='minwidth100';
|
||||||
if ($val['type'] == 'text')
|
if ($val['type'] == 'text')
|
||||||
{
|
{
|
||||||
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||||
@ -292,12 +294,16 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cssforinput = 'minwidth100';
|
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||||
print '<input class="flat" class="'.$cssforinput.'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'">';
|
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" class="'.$cssforinput.'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -307,8 +313,6 @@ if ($action == 'create')
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Part to edit record
|
// Part to edit record
|
||||||
if (($id || $ref) && $action == 'edit')
|
if (($id || $ref) && $action == 'edit')
|
||||||
{
|
{
|
||||||
@ -325,6 +329,7 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||||
|
|
||||||
print '<tr><td';
|
print '<tr><td';
|
||||||
print ' class="titlefieldcreate';
|
print ' class="titlefieldcreate';
|
||||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
@ -332,24 +337,29 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
print '"';
|
print '"';
|
||||||
print '>'.$langs->trans($val['label']).'</td>';
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
$defaultcss='minwidth100';
|
||||||
if ($val['type'] == 'text')
|
if ($val['type'] == 'text')
|
||||||
{
|
{
|
||||||
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
print '<textarea class="flat quatrevingtpercent" rows="'.ROWS_4.'" name="'.$key.'">';
|
||||||
print GETPOST($key,'none');
|
print GETPOST($key,'none')?GETPOST($key,'none'):$object->$key;
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
}
|
}
|
||||||
elseif (is_array($val['arrayofkeyval']))
|
elseif (is_array($val['arrayofkeyval']))
|
||||||
{
|
{
|
||||||
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int'));
|
print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int')!=''?GETPOST($key, 'int'):$object->$key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cssforinput = 'minwidth100';
|
$cssforinput = empty($val['css'])?$defaultcss:$val['css'];
|
||||||
print '<input class="flat" class="'.$cssforinput.'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'">';
|
print '<input class="flat'.($cssforinput?' '.$cssforinput:'').'" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):$object->$key).'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -361,9 +371,6 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Part to show record
|
// Part to show record
|
||||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||||
{
|
{
|
||||||
@ -463,18 +470,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||||
|
|
||||||
print '<tr><td';
|
print '<tr><td';
|
||||||
print ' class="titlefieldcreate';
|
print ' class="titlefield';
|
||||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
print '"';
|
print '"';
|
||||||
print '>'.$langs->trans($val['label']).'</td>';
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
print '<td><input class="flat" type="text" name="'.$key.'" value="'.(GETPOST($key,'alpha')?GETPOST($key,'alpha'):'').'"></td>';
|
print '<td>';
|
||||||
|
print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
|
||||||
|
|
||||||
// Other attributes
|
//if ($key == 'targetsrcfile3') break; // key used for break on second column
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -483,7 +492,30 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// ...
|
$alreadyoutput = 1;
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if ($alreadyoutput)
|
||||||
|
{
|
||||||
|
//if ($key == 'targetsrcfile3') $alreadyoutput = 0; // key used for break on second column
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($key, array('rowid', 'ref', 'entity', 'note_public', 'note_private', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
|
||||||
|
|
||||||
|
print '<tr><td';
|
||||||
|
print ' class="titlefield';
|
||||||
|
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||||
|
print '"';
|
||||||
|
print '>'.$langs->trans($val['label']).'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print dol_escape_htmltag($object->$key, 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -512,6 +544,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($user->rights->sellyoursaas->create)
|
||||||
|
{
|
||||||
|
if ($object->status == 1)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($user->rights->mymodule->delete)
|
if ($user->rights->mymodule->delete)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||||
|
|||||||
@ -79,7 +79,9 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject');
|
|||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id;
|
|
||||||
|
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
|
||||||
|
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->ref);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -167,10 +169,16 @@ if ($object->id)
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'societe';
|
$modulepart = 'mymodule';
|
||||||
$permission = $user->rights->societe->creer;
|
//$permission = $user->rights->mymodule->create;
|
||||||
$permtoedit = $user->rights->societe->creer;
|
$permission = 1;
|
||||||
|
//$permtoedit = $user->rights->mymodule->create;
|
||||||
|
$permtoedit = 1;
|
||||||
$param = '&id=' . $object->id;
|
$param = '&id=' . $object->id;
|
||||||
|
|
||||||
|
//$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->id).'/';
|
||||||
|
$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->ref).'/';
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -183,7 +183,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1703,65 +1703,114 @@ class Task extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function load_board($user)
|
function load_board($user)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$mine=0; $socid=$user->societe_id;
|
$mine=0; $socid=$user->societe_id;
|
||||||
|
|
||||||
$projectstatic = new Project($this->db);
|
$projectstatic = new Project($this->db);
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||||
|
|
||||||
// List of tasks (does not care about permissions. Filtering will be done later)
|
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||||
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
||||||
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
||||||
$sql.= " t.dateo as date_start, t.datee as datee";
|
$sql.= " t.dateo as date_start, t.datee as datee";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||||
$sql.= " AND p.fk_statut = 1";
|
$sql.= " AND p.fk_statut = 1";
|
||||||
$sql.= " AND t.fk_projet = p.rowid";
|
$sql.= " AND t.fk_projet = p.rowid";
|
||||||
$sql.= " AND t.progress < 100"; // tasks to do
|
$sql.= " AND t.progress < 100"; // tasks to do
|
||||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$task_static = new Task($this->db);
|
$task_static = new Task($this->db);
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
|
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("OpenedTasks");
|
$response->label = $langs->trans("OpenedTasks");
|
||||||
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
|
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
|
||||||
else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
|
else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
|
||||||
$response->img = img_object('',"task");
|
$response->img = img_object('',"task");
|
||||||
|
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$task_static->projectstatus = $obj->projectstatus;
|
$task_static->projectstatus = $obj->projectstatus;
|
||||||
$task_static->progress = $obj->progress;
|
$task_static->progress = $obj->progress;
|
||||||
$task_static->fk_statut = $obj->status;
|
$task_static->fk_statut = $obj->status;
|
||||||
$task_static->date_end = $this->db->jdate($obj->datee);
|
$task_static->date_end = $this->db->jdate($obj->datee);
|
||||||
|
|
||||||
if ($task_static->hasDelay()) {
|
if ($task_static->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$mine=0; $socid=$user->societe_id;
|
||||||
|
|
||||||
|
$projectstatic = new Project($this->db);
|
||||||
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||||
|
|
||||||
|
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||||
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
|
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||||
|
$sql.= " AND t.fk_projet = p.rowid"; // tasks to do
|
||||||
|
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||||
|
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
|
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["tasks"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -622,7 +622,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,14 +205,13 @@ else
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($act->datep,'%Y').'&month='.dol_print_date($act->datep,'%m').'&day='.dol_print_date($act->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -59,7 +59,7 @@ $action = (GETPOST('action','aZ09') ? GETPOST('action','aZ09') : 'view');
|
|||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$backtopage = GETPOST('backtopage','alpha');
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
$confirm = GETPOST('confirm');
|
$confirm = GETPOST('confirm');
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int')?GETPOST('socid','int'):GETPOST('id','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
if (empty($socid) && $action == 'view') $action='create';
|
if (empty($socid) && $action == 'view') $action='create';
|
||||||
|
|
||||||
@ -94,8 +94,6 @@ if (! empty($canvas))
|
|||||||
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
|
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -310,159 +308,155 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (GETPOST('client') < 0)
|
if (GETPOST('client') < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (GETPOST('fournisseur') < 0)
|
if (GETPOST('fournisseur') < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($socid);
|
if ($action == 'update')
|
||||||
$object->oldcopy = clone $object;
|
{
|
||||||
}
|
$ret=$object->fetch($socid);
|
||||||
else $object->canvas=$canvas;
|
$object->oldcopy = clone $object;
|
||||||
|
}
|
||||||
|
else $object->canvas=$canvas;
|
||||||
|
|
||||||
if (GETPOST("private") == 1) // Ask to create a contact
|
if (GETPOST("private") == 1) // Ask to create a contact
|
||||||
{
|
{
|
||||||
$object->particulier = GETPOST("private");
|
$object->particulier = GETPOST("private");
|
||||||
|
|
||||||
$object->name = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('name','alpha'));
|
$object->name = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('name','alpha'));
|
||||||
$object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int
|
$object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int
|
||||||
// Add non official properties
|
// Add non official properties
|
||||||
$object->name_bis = GETPOST('name','alpha');
|
$object->name_bis = GETPOST('name','alpha');
|
||||||
$object->firstname = GETPOST('firstname','alpha');
|
$object->firstname = GETPOST('firstname','alpha');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$object->name = GETPOST('name', 'alpha');
|
$object->name = GETPOST('name', 'alpha');
|
||||||
}
|
}
|
||||||
$object->name_alias = GETPOST('name_alias');
|
$object->name_alias = GETPOST('name_alias');
|
||||||
$object->address = GETPOST('address');
|
$object->address = GETPOST('address');
|
||||||
$object->zip = GETPOST('zipcode', 'alpha');
|
$object->zip = GETPOST('zipcode', 'alpha');
|
||||||
$object->town = GETPOST('town', 'alpha');
|
$object->town = GETPOST('town', 'alpha');
|
||||||
$object->country_id = GETPOST('country_id', 'int');
|
$object->country_id = GETPOST('country_id', 'int');
|
||||||
$object->state_id = GETPOST('state_id', 'int');
|
$object->state_id = GETPOST('state_id', 'int');
|
||||||
$object->skype = GETPOST('skype', 'alpha');
|
$object->skype = GETPOST('skype', 'alpha');
|
||||||
$object->phone = GETPOST('phone', 'alpha');
|
$object->phone = GETPOST('phone', 'alpha');
|
||||||
$object->fax = GETPOST('fax','alpha');
|
$object->fax = GETPOST('fax','alpha');
|
||||||
$object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL));
|
$object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL));
|
||||||
$object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
$object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||||
$object->idprof1 = trim(GETPOST('idprof1', 'alpha'));
|
$object->idprof1 = trim(GETPOST('idprof1', 'alpha'));
|
||||||
$object->idprof2 = trim(GETPOST('idprof2', 'alpha'));
|
$object->idprof2 = trim(GETPOST('idprof2', 'alpha'));
|
||||||
$object->idprof3 = trim(GETPOST('idprof3', 'alpha'));
|
$object->idprof3 = trim(GETPOST('idprof3', 'alpha'));
|
||||||
$object->idprof4 = trim(GETPOST('idprof4', 'alpha'));
|
$object->idprof4 = trim(GETPOST('idprof4', 'alpha'));
|
||||||
$object->idprof5 = trim(GETPOST('idprof5', 'alpha'));
|
$object->idprof5 = trim(GETPOST('idprof5', 'alpha'));
|
||||||
$object->idprof6 = trim(GETPOST('idprof6', 'alpha'));
|
$object->idprof6 = trim(GETPOST('idprof6', 'alpha'));
|
||||||
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');
|
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');
|
||||||
$object->code_client = GETPOST('code_client', 'alpha');
|
$object->code_client = GETPOST('code_client', 'alpha');
|
||||||
$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
|
$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
|
||||||
$object->capital = GETPOST('capital', 'alpha');
|
$object->capital = GETPOST('capital', 'alpha');
|
||||||
$object->barcode = GETPOST('barcode', 'alpha');
|
$object->barcode = GETPOST('barcode', 'alpha');
|
||||||
|
|
||||||
$object->tva_intra = GETPOST('tva_intra', 'alpha');
|
$object->tva_intra = GETPOST('tva_intra', 'alpha');
|
||||||
$object->tva_assuj = GETPOST('assujtva_value', 'alpha');
|
$object->tva_assuj = GETPOST('assujtva_value', 'alpha');
|
||||||
$object->status = GETPOST('status', 'alpha');
|
$object->status = GETPOST('status', 'alpha');
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha');
|
$object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha');
|
||||||
$object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha');
|
$object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha');
|
||||||
|
|
||||||
$object->localtax1_value = GETPOST('lt1', 'alpha');
|
$object->localtax1_value = GETPOST('lt1', 'alpha');
|
||||||
$object->localtax2_value = GETPOST('lt2', 'alpha');
|
$object->localtax2_value = GETPOST('lt2', 'alpha');
|
||||||
|
|
||||||
$object->forme_juridique_code = GETPOST('forme_juridique_code', 'int');
|
$object->forme_juridique_code = GETPOST('forme_juridique_code', 'int');
|
||||||
$object->effectif_id = GETPOST('effectif_id', 'int');
|
$object->effectif_id = GETPOST('effectif_id', 'int');
|
||||||
$object->typent_id = GETPOST('typent_id','int');
|
$object->typent_id = GETPOST('typent_id','int');
|
||||||
|
|
||||||
$object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type
|
$object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type
|
||||||
|
|
||||||
$object->client = GETPOST('client', 'int');
|
$object->client = GETPOST('client', 'int');
|
||||||
$object->fournisseur = GETPOST('fournisseur', 'int');
|
$object->fournisseur = GETPOST('fournisseur', 'int');
|
||||||
|
|
||||||
$object->commercial_id = GETPOST('commercial_id', 'int');
|
$object->commercial_id = GETPOST('commercial_id', 'int');
|
||||||
$object->default_lang = GETPOST('default_lang');
|
$object->default_lang = GETPOST('default_lang');
|
||||||
|
|
||||||
// Webservices url/key
|
// Webservices url/key
|
||||||
$object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
|
$object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
|
||||||
$object->webservices_key = GETPOST('webservices_key', 'san_alpha');
|
$object->webservices_key = GETPOST('webservices_key', 'san_alpha');
|
||||||
|
|
||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$action = ($action=='add'?'create':'edit');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (GETPOST('deletephoto')) $object->logo = '';
|
if (GETPOST('deletephoto')) $object->logo = '';
|
||||||
else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
|
else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! GETPOST('cancel','alpha'))
|
if (! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (! empty($object->email) && ! isValidEMail($object->email))
|
if (! empty($object->email) && ! isValidEMail($object->email))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages('', $langs->trans("ErrorBadEMail",$object->email), 'errors');
|
setEventMessages('', $langs->trans("ErrorBadEMail",$object->email), 'errors');
|
||||||
$action = ($action=='add'?'create':'edit');
|
}
|
||||||
}
|
if (! empty($object->url) && ! isValidUrl($object->url))
|
||||||
if (! empty($object->url) && ! isValidUrl($object->url))
|
{
|
||||||
{
|
$langs->load("errors");
|
||||||
$langs->load("errors");
|
setEventMessages('', $langs->trans("ErrorBadUrl",$object->url), 'errors');
|
||||||
setEventMessages('', $langs->trans("ErrorBadUrl",$object->url), 'errors');
|
}
|
||||||
$action = ($action=='add'?'create':'edit');
|
if ($object->fournisseur && ! $conf->fournisseur->enabled)
|
||||||
}
|
{
|
||||||
if ($object->fournisseur && ! $conf->fournisseur->enabled)
|
$langs->load("errors");
|
||||||
{
|
setEventMessages('', $langs->trans("ErrorSupplierModuleNotEnabled"), 'errors');
|
||||||
$langs->load("errors");
|
}
|
||||||
setEventMessages('', $langs->trans("ErrorSupplierModuleNotEnabled"), 'errors');
|
if (! empty($object->webservices_url)) {
|
||||||
$action = ($action=='add'?'create':'edit');
|
//Check if has transport, without any the soap client will give error
|
||||||
}
|
if (strpos($object->webservices_url, "http") === false)
|
||||||
if (! empty($object->webservices_url)) {
|
{
|
||||||
//Check if has transport, without any the soap client will give error
|
$object->webservices_url = "http://".$object->webservices_url;
|
||||||
if (strpos($object->webservices_url, "http") === false)
|
}
|
||||||
{
|
if (! isValidUrl($object->webservices_url)) {
|
||||||
$object->webservices_url = "http://".$object->webservices_url;
|
$langs->load("errors");
|
||||||
}
|
$error++; $errors[] = $langs->trans("ErrorBadUrl",$object->webservices_url);
|
||||||
if (! isValidUrl($object->webservices_url)) {
|
}
|
||||||
$langs->load("errors");
|
}
|
||||||
$error++; $errors[] = $langs->trans("ErrorBadUrl",$object->webservices_url);
|
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We set country_id, country_code and country for the selected country
|
// We set country_id, country_code and country for the selected country
|
||||||
$object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id;
|
$object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id;
|
||||||
if ($object->country_id)
|
if ($object->country_id)
|
||||||
{
|
{
|
||||||
$tmparray=getCountry($object->country_id,'all');
|
$tmparray=getCountry($object->country_id,'all');
|
||||||
$object->country_code=$tmparray['code'];
|
$object->country_code=$tmparray['code'];
|
||||||
$object->country=$tmparray['label'];
|
$object->country=$tmparray['label'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -992,7 +986,7 @@ else
|
|||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||||
|
|
||||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc" autocomplete="off">'; // Chrome ignor autocomplete
|
||||||
|
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
@ -2372,69 +2366,68 @@ else
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">'."\n";
|
if ($action != 'presend')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">'."\n";
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
|
||||||
$at_least_one_email_contact = false;
|
|
||||||
$TContact = $object->contact_array_objects();
|
|
||||||
foreach ($TContact as &$contact)
|
|
||||||
{
|
{
|
||||||
if (!empty($contact->email))
|
$at_least_one_email_contact = false;
|
||||||
|
$TContact = $object->contact_array_objects();
|
||||||
|
foreach ($TContact as &$contact)
|
||||||
{
|
{
|
||||||
$at_least_one_email_contact = true;
|
if (!empty($contact->email))
|
||||||
break;
|
{
|
||||||
|
$at_least_one_email_contact = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($object->email) || $at_least_one_email_contact)
|
||||||
|
{
|
||||||
|
$langs->load("mails");
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("mails");
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans('SendMail').'</a></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->societe->creer)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->societe->supprimer)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->societe->supprimer)
|
||||||
|
{
|
||||||
|
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($object->email) || $at_least_one_email_contact)
|
print '</div>'."\n";
|
||||||
{
|
}
|
||||||
$langs->load("mails");
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("mails");
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans('SendMail').'</a></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->rights->societe->creer)
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->rights->societe->supprimer)
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->rights->societe->supprimer)
|
|
||||||
{
|
|
||||||
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</div>'."\n";
|
|
||||||
|
|
||||||
//Select mail models is same action as presend
|
//Select mail models is same action as presend
|
||||||
if (GETPOST('modelselected')) {
|
if (GETPOST('modelselected')) {
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
if ($action == 'presend')
|
/*if ($action == 'presend')
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Affiche formulaire mail
|
|
||||||
*/
|
|
||||||
|
|
||||||
// By default if $action=='presend'
|
// By default if $action=='presend'
|
||||||
$titreform='SendMail';
|
$titreform='SendMail';
|
||||||
$topicmail='';
|
$topicmail='';
|
||||||
@ -2491,31 +2484,6 @@ else
|
|||||||
$formmail->substit['__PERSONALIZED__']=''; // deprecated
|
$formmail->substit['__PERSONALIZED__']=''; // deprecated
|
||||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||||
|
|
||||||
//Find the good contact adress
|
|
||||||
/*
|
|
||||||
$custcontact='';
|
|
||||||
$contactarr=array();
|
|
||||||
$contactarr=$object->liste_contact(-1,'external');
|
|
||||||
|
|
||||||
if (is_array($contactarr) && count($contactarr)>0)
|
|
||||||
{
|
|
||||||
foreach($contactarr as $contact)
|
|
||||||
{
|
|
||||||
if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) {
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
|
||||||
|
|
||||||
$contactstatic=new Contact($db);
|
|
||||||
$contactstatic->fetch($contact['id']);
|
|
||||||
$custcontact=$contactstatic->getFullName($langs,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($custcontact)) {
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
$formmail->param['action']=$action;
|
$formmail->param['action']=$action;
|
||||||
@ -2533,14 +2501,15 @@ else
|
|||||||
print $formmail->get_form();
|
print $formmail->get_form();
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}*/
|
||||||
else
|
|
||||||
|
if ($action != 'presend')
|
||||||
{
|
{
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
|
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
|
||||||
{
|
{
|
||||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
print '<a name="builddoc"></a>'; // ancre
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents generes
|
* Documents generes
|
||||||
@ -2553,35 +2522,34 @@ else
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
|
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
|
||||||
|
|
||||||
|
|
||||||
print '</div></div></div>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="fichecenter"><br></div>';
|
|
||||||
|
|
||||||
// Subsidiaries list
|
// Subsidiaries list
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES))
|
if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES))
|
||||||
{
|
{
|
||||||
$result=show_subsidiaries($conf,$langs,$db,$object);
|
$result=show_subsidiaries($conf,$langs,$db,$object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contacts list
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
|
||||||
{
|
|
||||||
$result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Addresses list
|
$MAX = 5;
|
||||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
|
||||||
{
|
// List of actions on element
|
||||||
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
}
|
$formactions = new FormActions($db);
|
||||||
|
$somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAX); // Show all action for thirdparty
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Presend form
|
||||||
|
$modelmail='thirdparty';
|
||||||
|
$defaulttopic='Information';
|
||||||
|
$diroutput = $conf->societe->dir_output;
|
||||||
|
$trackid = 'thi'.$object->id;
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1898,6 +1898,11 @@ class Societe extends CommonObject
|
|||||||
$label.= '<u>' . $langs->trans("ShowMargin") . '</u>';
|
$label.= '<u>' . $langs->trans("ShowMargin") . '</u>';
|
||||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
|
||||||
}
|
}
|
||||||
|
else if ($option == 'contact')
|
||||||
|
{
|
||||||
|
$label.= '<u>' . $langs->trans("ShowContacts") . '</u>';
|
||||||
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
|
||||||
|
}
|
||||||
|
|
||||||
// By default
|
// By default
|
||||||
if (empty($linkstart))
|
if (empty($linkstart))
|
||||||
|
|||||||
196
htdocs/societe/contact.php
Normal file
196
htdocs/societe/contact.php
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||||
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||||
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/societe/card.php
|
||||||
|
* \ingroup societe
|
||||||
|
* \brief Third party card page
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("commercial");
|
||||||
|
$langs->load("bills");
|
||||||
|
$langs->load("banks");
|
||||||
|
$langs->load("users");
|
||||||
|
if (! empty($conf->categorie->enabled)) $langs->load("categories");
|
||||||
|
if (! empty($conf->incoterm->enabled)) $langs->load("incoterm");
|
||||||
|
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||||
|
|
||||||
|
$mesg=''; $error=0; $errors=array();
|
||||||
|
|
||||||
|
$action = (GETPOST('action','aZ09') ? GETPOST('action','aZ09') : 'view');
|
||||||
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
|
$confirm = GETPOST('confirm');
|
||||||
|
$socid = GETPOST('socid','int')?GETPOST('socid','int'):GETPOST('id','int');
|
||||||
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
if (empty($socid) && $action == 'view') $action='create';
|
||||||
|
|
||||||
|
$object = new Societe($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('thirdpartycard','globalcard'));
|
||||||
|
|
||||||
|
if ($action == 'view' && $object->fetch($socid)<=0)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print($langs->trans('ErrorRecordNotFound'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
$object->getCanvas($socid);
|
||||||
|
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||||
|
$objcanvas=null;
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||||
|
$objcanvas = new Canvas($db, $action);
|
||||||
|
$objcanvas->getCanvas('thirdparty', 'card', $canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
$action='';
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
$formadmin = new FormAdmin($db);
|
||||||
|
$formcompany = new FormCompany($db);
|
||||||
|
|
||||||
|
if ($socid > 0 && empty($object->id))
|
||||||
|
{
|
||||||
|
$result=$object->fetch($socid);
|
||||||
|
if ($result <= 0) dol_print_error('',$object->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$title=$langs->trans("ThirdParty");
|
||||||
|
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Card');
|
||||||
|
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||||
|
llxHeader('',$title,$help_url);
|
||||||
|
|
||||||
|
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||||
|
|
||||||
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
|
{
|
||||||
|
// -----------------------------------------
|
||||||
|
// When used with CANVAS
|
||||||
|
// -----------------------------------------
|
||||||
|
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
|
||||||
|
$objcanvas->display_canvas($action); // Show template
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels);
|
||||||
|
//if ($res < 0) { dol_print_error($db); exit; }
|
||||||
|
|
||||||
|
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
if ($action != 'presend')
|
||||||
|
{
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
|
// Contacts list
|
||||||
|
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||||
|
{
|
||||||
|
$result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Addresses list
|
||||||
|
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||||
|
{
|
||||||
|
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -197,7 +197,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1233,6 +1233,9 @@ div.heightref {
|
|||||||
div.divphotoref {
|
div.divphotoref {
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
div.paginationref {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
div.statusref {
|
div.statusref {
|
||||||
float: right;
|
float: right;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
@ -2933,13 +2936,11 @@ span.dashboardlineko {
|
|||||||
float: right;
|
float: right;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
top: -24px;
|
top: -26px;
|
||||||
padding: 1px 2px 1px 2px;
|
padding: 0px 5px 0px 5px;
|
||||||
border-radius: .25em;
|
border-radius: .25em;
|
||||||
|
|
||||||
background-color: #9f4705;
|
background-color: #9f4705;
|
||||||
padding: 0px 5px 0px 5px;
|
|
||||||
top: -26px;
|
|
||||||
}
|
}
|
||||||
.imglatecoin {
|
.imglatecoin {
|
||||||
padding: 1px 3px 1px 1px;
|
padding: 1px 3px 1px 1px;
|
||||||
|
|||||||
@ -1273,6 +1273,9 @@ div.heightref {
|
|||||||
div.divphotoref {
|
div.divphotoref {
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
div.paginationref {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
div.statusref {
|
div.statusref {
|
||||||
float: right;
|
float: right;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
|
|||||||
@ -384,7 +384,9 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! empty($obj->page) && ! empty($obj->type) && ! empty($obj->param))
|
if (! empty($obj->page) && ! empty($obj->type) && ! empty($obj->param))
|
||||||
{
|
{
|
||||||
// $obj->page is relative URL with or without params, $obj->type can be 'filters', 'sortorder', 'createform', ...
|
// $obj->page is relative URL with or without params
|
||||||
|
// $obj->type can be 'filters', 'sortorder', 'createform', ...
|
||||||
|
// $obj->param is key or param
|
||||||
$pagewithoutquerystring=$obj->page;
|
$pagewithoutquerystring=$obj->page;
|
||||||
$pagequeries='';
|
$pagequeries='';
|
||||||
if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) // There is query param
|
if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) // There is query param
|
||||||
@ -392,10 +394,20 @@ class User extends CommonObject
|
|||||||
$pagewithoutquerystring=$reg[1];
|
$pagewithoutquerystring=$reg[1];
|
||||||
$pagequeries=$reg[2];
|
$pagequeries=$reg[2];
|
||||||
}
|
}
|
||||||
$this->default_values[$pagewithoutquerystring][$obj->type][$obj->param]=$obj->value;
|
$this->default_values[$pagewithoutquerystring][$obj->type][$pagequeries?$pagequeries:'_noquery_'][$obj->param]=$obj->value;
|
||||||
if ($pagequeries) $this->default_values[$pagewithoutquerystring][$obj->type.'_queries']=$pagequeries;
|
//if ($pagequeries) $this->default_values[$pagewithoutquerystring][$obj->type.'_queries']=$pagequeries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Sort by key, so _noquery_ is last
|
||||||
|
if(!empty($this->default_values)) {
|
||||||
|
foreach($this->default_values as $a => $b)
|
||||||
|
{
|
||||||
|
foreach($b as $c => $d)
|
||||||
|
{
|
||||||
|
krsort($this->default_values[$a][$c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2058,7 +2070,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
$label.= '<div class="centpercent">';
|
$label.= '<div class="centpercent">';
|
||||||
$label.= '<u>' . $langs->trans("User") . '</u><br>';
|
$label.= '<u>' . $langs->trans("User") . '</u><br>';
|
||||||
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
|
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'');
|
||||||
if (! empty($this->login))
|
if (! empty($this->login))
|
||||||
$label.= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
|
$label.= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
|
||||||
$label.= '<br><b>' . $langs->trans("EMail").':</b> '.$this->email;
|
$label.= '<br><b>' . $langs->trans("EMail").':</b> '.$this->email;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class WebsitePage extends CommonObject
|
|||||||
public $title;
|
public $title;
|
||||||
public $description;
|
public $description;
|
||||||
public $keywords;
|
public $keywords;
|
||||||
|
public $htmlheader;
|
||||||
public $content;
|
public $content;
|
||||||
public $status;
|
public $status;
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
@ -67,11 +68,12 @@ class WebsitePage extends CommonObject
|
|||||||
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
|
||||||
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
|
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
|
||||||
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
|
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
|
||||||
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
|
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
|
||||||
|
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
|
||||||
|
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
|
||||||
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
|
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
@ -126,6 +128,7 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= " t.title,";
|
$sql .= " t.title,";
|
||||||
$sql .= " t.description,";
|
$sql .= " t.description,";
|
||||||
$sql .= " t.keywords,";
|
$sql .= " t.keywords,";
|
||||||
|
$sql .= " t.htmlheader,";
|
||||||
$sql .= " t.content,";
|
$sql .= " t.content,";
|
||||||
$sql .= " t.lang,";
|
$sql .= " t.lang,";
|
||||||
$sql .= " t.fk_page,";
|
$sql .= " t.fk_page,";
|
||||||
@ -162,6 +165,7 @@ class WebsitePage extends CommonObject
|
|||||||
$this->title = $obj->title;
|
$this->title = $obj->title;
|
||||||
$this->description = $obj->description;
|
$this->description = $obj->description;
|
||||||
$this->keywords = $obj->keywords;
|
$this->keywords = $obj->keywords;
|
||||||
|
$this->htmlheader = $obj->htmlheader;
|
||||||
$this->content = $obj->content;
|
$this->content = $obj->content;
|
||||||
$this->lang = $obj->lang;
|
$this->lang = $obj->lang;
|
||||||
$this->fk_page = $obj->fk_page;
|
$this->fk_page = $obj->fk_page;
|
||||||
@ -210,6 +214,7 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= " t.title,";
|
$sql .= " t.title,";
|
||||||
$sql .= " t.description,";
|
$sql .= " t.description,";
|
||||||
$sql .= " t.keywords,";
|
$sql .= " t.keywords,";
|
||||||
|
$sql .= " t.htmlheader,";
|
||||||
$sql .= " t.content,";
|
$sql .= " t.content,";
|
||||||
$sql .= " t.lang,";
|
$sql .= " t.lang,";
|
||||||
$sql .= " t.fk_page,";
|
$sql .= " t.fk_page,";
|
||||||
@ -255,6 +260,7 @@ class WebsitePage extends CommonObject
|
|||||||
$record->title = $obj->title;
|
$record->title = $obj->title;
|
||||||
$record->description = $obj->description;
|
$record->description = $obj->description;
|
||||||
$record->keywords = $obj->keywords;
|
$record->keywords = $obj->keywords;
|
||||||
|
$record->htmlheader = $obj->htmlheader;
|
||||||
$record->content = $obj->content;
|
$record->content = $obj->content;
|
||||||
$record->lang = $obj->lang;
|
$record->lang = $obj->lang;
|
||||||
$record->fk_page = $obj->fk_page;
|
$record->fk_page = $obj->fk_page;
|
||||||
@ -469,6 +475,7 @@ class WebsitePage extends CommonObject
|
|||||||
$this->title = 'My Page';
|
$this->title = 'My Page';
|
||||||
$this->description = 'This is my page';
|
$this->description = 'This is my page';
|
||||||
$this->keywords = 'keyword1, keyword2';
|
$this->keywords = 'keyword1, keyword2';
|
||||||
|
$this->htmlheader = '';
|
||||||
$this->content = '<html><body>This is a html content</body></html>';
|
$this->content = '<html><body>This is a html content</body></html>';
|
||||||
$this->status = '';
|
$this->status = '';
|
||||||
$this->grabbed_from = '';
|
$this->grabbed_from = '';
|
||||||
|
|||||||
@ -94,6 +94,7 @@ $pageid=GETPOST('pageid', 'int');
|
|||||||
$pageref=GETPOST('pageref', 'aZ09');
|
$pageref=GETPOST('pageref', 'aZ09');
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
|
|
||||||
if (GETPOST('delete')) { $action='delete'; }
|
if (GETPOST('delete')) { $action='delete'; }
|
||||||
if (GETPOST('preview')) $action='preview';
|
if (GETPOST('preview')) $action='preview';
|
||||||
if (GETPOST('createsite')) { $action='createsite'; }
|
if (GETPOST('createsite')) { $action='createsite'; }
|
||||||
@ -246,7 +247,11 @@ if ($action == 'add')
|
|||||||
|
|
||||||
$urltograbwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\/?/i', '', $urltograbwithoutdomain);
|
$urltograbwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\/?/i', '', $urltograbwithoutdomain);
|
||||||
$objectpage->pageurl = basename($urltograbwithoutdomain);
|
$objectpage->pageurl = basename($urltograbwithoutdomain);
|
||||||
if (empty($objectpage->pageurl)) $objectpage->pageurl='home';
|
if (empty($objectpage->pageurl))
|
||||||
|
{
|
||||||
|
$tmpdomain = getDomainFromURL($urltograb);
|
||||||
|
$objectpage->pageurl='home'.$tmpdomain;
|
||||||
|
}
|
||||||
|
|
||||||
if (preg_match('/<title>(.*)<\/title>/ims', $head, $regtmp))
|
if (preg_match('/<title>(.*)<\/title>/ims', $head, $regtmp))
|
||||||
{
|
{
|
||||||
@ -270,6 +275,52 @@ if ($action == 'add')
|
|||||||
$objectpage->content = preg_replace('/^.*<body[^>]*>/ims', '', $objectpage->content);
|
$objectpage->content = preg_replace('/^.*<body[^>]*>/ims', '', $objectpage->content);
|
||||||
$objectpage->content = preg_replace('/<\/body[^>]*>.*$/ims', '', $objectpage->content);
|
$objectpage->content = preg_replace('/<\/body[^>]*>.*$/ims', '', $objectpage->content);
|
||||||
|
|
||||||
|
|
||||||
|
// Now loop to fetch all css files. Include them inline into header of page
|
||||||
|
// TODO...
|
||||||
|
|
||||||
|
|
||||||
|
$tmp = $objectpage->content;
|
||||||
|
|
||||||
|
// Now loop to fetch all images
|
||||||
|
preg_match_all('/<img([^\.\/]+)src="([^>"]+)"([^>]*)>/i', $objectpage->content, $regs);
|
||||||
|
foreach ($regs[0] as $key => $val)
|
||||||
|
{
|
||||||
|
$urltograbbis = $urltograb.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||||
|
$linkwithoutdomain = $regs[2][$key];
|
||||||
|
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $regs[2][$key])?'':'/').$regs[2][$key];
|
||||||
|
if (preg_match('/^http/', $regs[2][$key]))
|
||||||
|
{
|
||||||
|
$urltograbbis = $regs[2][$key];
|
||||||
|
$linkwithoutdomain = preg_replace('/^https?:\/\/[^\/]+\//i', '', $regs[2][$key]);
|
||||||
|
$filetosave = $conf->medias->multidir_output[$conf->entity].'/image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpgeturl = getURLContent($urltograbbis);
|
||||||
|
if ($tmpgeturl['curl_error_no'])
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($tmpgeturl['curl_error_msg'], null, 'errors');
|
||||||
|
$action='create';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_mkdir(dirname($filetosave));
|
||||||
|
|
||||||
|
$fp = fopen($filetosave, "w");
|
||||||
|
fputs($fp, $tmpgeturl['content']);
|
||||||
|
fclose($fp);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
|
||||||
|
$tmp = preg_replace('/'.preg_quote($regs[0][$key],'/').'/i', '<img'.$regs[1][$key].'src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file='.$filename.'"'.$regs[3][$key].'>', $tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//print dol_escape_htmltag($tmp);exit;
|
||||||
|
$objectpage->content = $tmp;
|
||||||
|
|
||||||
$objectpage->grabbed_from = $urltograb;
|
$objectpage->grabbed_from = $urltograb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,6 +363,33 @@ if ($action == 'add')
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! empty($objectpage->content))
|
||||||
|
{
|
||||||
|
$filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php';
|
||||||
|
$filetpl=$pathofwebsite.'/page'.$objectpage->id.'.tpl.php';
|
||||||
|
|
||||||
|
// Save page alias
|
||||||
|
$result=dolSavePageAlias($filealias, $object, $objectpage);
|
||||||
|
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
|
|
||||||
|
// Save page of content
|
||||||
|
$result=dolSavePageContent($filetpl, $object, $objectpage);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||||
|
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||||
|
//exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages('Failed to write file '.$filetpl, null, 'errors');
|
||||||
|
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||||
|
//exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -326,8 +404,36 @@ if ($action == 'add')
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$action = 'preview';
|
$pageid = $objectpage->id;
|
||||||
$pageid = $objectpage->id;
|
|
||||||
|
// To generate the CSS, robot and htmlheader file.
|
||||||
|
|
||||||
|
if (! dol_is_file($filehtmlheader))
|
||||||
|
{
|
||||||
|
// TODO use header of page for common header ?
|
||||||
|
$htmlheadercontent = "<!-- HTML header content (common for all pages) -->";
|
||||||
|
$result=dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! dol_is_file($filecss))
|
||||||
|
{
|
||||||
|
$csscontent = "/* CSS content (all pages) */\nbody.bodywebsite { margin: 0; }'";
|
||||||
|
$result=dolSaveCssFile($filecss, $csscontent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! dol_is_file($filerobot))
|
||||||
|
{
|
||||||
|
$robotcontent = "# Robot file. Generated with Dolibarr\nUser-agent: *\nAllow: /public/\nDisallow: /administrator/";
|
||||||
|
$result=dolSaveRobotFile($filerobot, $robotcontent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! dol_is_file($filehtaccess))
|
||||||
|
{
|
||||||
|
$htaccesscontent = "# Order allow,deny\n# Deny from all";
|
||||||
|
$result=dolSaveHtaccessFile($filehtaccess, $htaccesscontent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = 'preview';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,18 +506,8 @@ if ($action == 'updatecss')
|
|||||||
|
|
||||||
$htmlheadercontent = trim($htmlheadercontent)."\n";
|
$htmlheadercontent = trim($htmlheadercontent)."\n";
|
||||||
|
|
||||||
dol_syslog("Save html header into ".$filehtmlheader);
|
dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent);
|
||||||
|
|
||||||
dol_mkdir($pathofwebsite);
|
|
||||||
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
|
||||||
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
|
|
||||||
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Css file
|
// Css file
|
||||||
$csscontent ='';
|
$csscontent ='';
|
||||||
@ -1446,6 +1542,12 @@ if ($action == 'editmeta' || $action == 'create')
|
|||||||
|
|
||||||
if ($action != 'create')
|
if ($action != 'create')
|
||||||
{
|
{
|
||||||
|
print '<tr><td class="titlefield">';
|
||||||
|
print $langs->trans('IDOfPage');
|
||||||
|
print '</td><td>';
|
||||||
|
print $pageid;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('WEBSITE_PAGEURL');
|
print $langs->trans('WEBSITE_PAGEURL');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -1737,3 +1839,117 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $filetpl Full path of filename to generate
|
||||||
|
* @param string $htmlheadercontent Content of file
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
|
||||||
|
{
|
||||||
|
global $conf, $pathofwebsite;
|
||||||
|
|
||||||
|
dol_syslog("Save html header into ".$filehtmlheader);
|
||||||
|
|
||||||
|
dol_mkdir($pathofwebsite);
|
||||||
|
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $filecss Full path of filename to generate
|
||||||
|
* @param string $csscontent Content of file
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolSaveCssFile($filecss, $csscontent)
|
||||||
|
{
|
||||||
|
global $conf, $pathofwebsite;
|
||||||
|
|
||||||
|
dol_syslog("Save html header into ".$filecss);
|
||||||
|
|
||||||
|
dol_mkdir($pathofwebsite);
|
||||||
|
$result = file_put_contents($filecss, $csscontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $filerobot Full path of filename to generate
|
||||||
|
* @param string $robotcontent Content of file
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolSaveRobotFile($filerobot, $robotcontent)
|
||||||
|
{
|
||||||
|
global $conf, $pathofwebsite;
|
||||||
|
|
||||||
|
dol_syslog("Save html header into ".$filerobot);
|
||||||
|
|
||||||
|
dol_mkdir($pathofwebsite);
|
||||||
|
$result = file_put_contents($filerobot, $robotcontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save content of a page on disk
|
||||||
|
*
|
||||||
|
* @param string $filehtaccess Full path of filename to generate
|
||||||
|
* @param string $htaccess Content of file
|
||||||
|
* @return boolean True if OK
|
||||||
|
*/
|
||||||
|
function dolSaveHtaccessFile($filehtaccess, $htaccess)
|
||||||
|
{
|
||||||
|
global $conf, $pathofwebsite;
|
||||||
|
|
||||||
|
dol_syslog("Save html header into ".$filehtaccess);
|
||||||
|
|
||||||
|
dol_mkdir($pathofwebsite);
|
||||||
|
$result = file_put_contents($filehtaccess, $htaccess);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -272,12 +272,41 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
// Force default setup
|
||||||
|
unset($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED);
|
||||||
|
unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$result=$localobject->fetch($id);
|
$result=$localobject->fetch($id);
|
||||||
$result=$localobject->delete($user);
|
|
||||||
|
|
||||||
|
// Create another invoice and validate it after $localobject
|
||||||
|
$localobject2=new Facture($this->savdb);
|
||||||
|
$result=$localobject2->initAsSpecimen();
|
||||||
|
$result=$localobject2->create($user);
|
||||||
|
$result=$localobject2->validate($user);
|
||||||
|
print 'Invoice localobject ref = '.$localobject->ref."\n";
|
||||||
|
print 'Invoice $localobject2 created with ref = '.$localobject2->ref."\n";
|
||||||
|
|
||||||
|
$conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1;
|
||||||
|
|
||||||
|
$result=$localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
$this->assertGreaterThanOrEqual(0, $result);
|
$this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on');
|
||||||
|
|
||||||
|
unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
|
||||||
|
|
||||||
|
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||||
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
|
$this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice');
|
||||||
|
|
||||||
|
$result=$localobject2->delete($user); // Deletion is OK, it is last invoice
|
||||||
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
|
$this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');
|
||||||
|
|
||||||
|
$result=$localobject->delete($user); // Deletion is KO, it is not last invoice
|
||||||
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
|
$this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice');
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user