Merge branch 'develop' of ssh://github.com/Dolibarr/dolibarr into api_dev

This commit is contained in:
nka11 2016-04-10 14:00:00 +02:00
commit 65e4273fdf
539 changed files with 11737 additions and 16681 deletions

View File

@ -14,7 +14,7 @@ Component Version License GPL Compatible
PHP libraries:
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG
CKEditor 4.5.8 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management

View File

@ -24,7 +24,12 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
So if you included it into your module, change your code like this to be compatible with all version:
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';

1141
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,11 @@ with:
TCPDF:
------
* To avoid to have QRcode changed because generated with a random mask, replace
define('QR_FIND_FROM_RANDOM', 2);
with
define('QR_FIND_FROM_RANDOM', false);
* Removed all fonts except
dejavusans* (used by greek, arab, persan, romanian, turkish),
freemono* (russian),
@ -62,12 +67,6 @@ In htdocs/includes/tcpdf/tcpdf.php
* Renamed getmypid into dol_getmypid().
To avoid to have QRcode changed because generated with a random mask, replace
define('QR_FIND_FROM_RANDOM', 2);
with
define('QR_FIND_FROM_RANDOM', false);
TCPDI:
------

View File

@ -17,16 +17,16 @@ fi
# To detec
if [ "x$1" = "xlist" ]
then
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix $fic
dos2unix "$fic"
done;
fi

View File

@ -43,7 +43,9 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
if (! $res) die("Include of main fails");
// Change this following line to use the correct relative path from htdocs
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/mymodule/class/skeleton_class.class.php');
// Load traductions files requiredby by page
@ -124,6 +126,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
* Put here all code to do according to value of "action" parameter
********************************************************************/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array();
$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');
@ -142,6 +147,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
// Action to delete
if ($action == 'confirm_delete')
{
@ -266,6 +284,7 @@ if ($resql)
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -297,8 +316,8 @@ if ($resql)
// Fields title
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -315,8 +334,8 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n";
@ -379,7 +398,9 @@ if ($resql)
print '</tr>'."\n";
$i = 0;
$i=0;
$var=true;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
@ -387,8 +408,16 @@ if ($resql)
{
// You can use here results
print '<tr>';
if (! empty($arrayfields['t.field1']['checked'])) print '<td>'.$obj->field1.'</td>';
if (! empty($arrayfields['t.field2']['checked'])) print '<td>'.$obj->field2.'</td>';
if (! empty($arrayfields['t.field1']['checked']))
{
print '<td>'.$obj->field1.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.field2']['checked']))
{
print '<td>'.$obj->field2.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -403,6 +432,7 @@ if ($resql)
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
@ -416,6 +446,7 @@ if ($resql)
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['t.tms']['checked']))
@ -423,6 +454,7 @@ if ($resql)
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
/*
@ -431,9 +463,12 @@ if ($resql)
$userstatic->statut=$obj->statut;
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
}*/
// Action column
print '<td></td>';
print '</tr>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
}
$i++;
}

View File

@ -216,12 +216,8 @@ if ($action == 'create') {
$head = accounting_prepare_head($object);
// Edit mode
if ($action == 'update') {
$soc = new Societe($db);
if ($object->socid) {
$soc->fetch($object->socid);
}
if ($action == 'update')
{
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";

View File

@ -69,7 +69,6 @@ class AccountancyExport
$this->db = &$db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = "\n";
return 1;
}
/**
@ -277,7 +276,7 @@ class AccountancyExport
/**
*
* @param unknown $str data
* @param unknown $size data
* @param integer $size data
*/
public static function trunc($str, $size)
{

View File

@ -356,13 +356,8 @@ if (empty($reshook))
}
else
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
// Create thumbs
$object->addThumbs($newfile);
}
}
}

View File

@ -98,12 +98,14 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
// Create thumbs of logo (Note that PDF use original file and not thumbs)
if ($isimage > 0)
{
// Create small thumbs for company (Ratio is near 16/9)
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbSmall);
@ -111,9 +113,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbMini);
@ -203,12 +205,14 @@ if ($action == 'addthumb')
// Create thumbs of logo
if ($isimage > 0)
{
// Create small thumbs for company (Ratio is near 16/9)
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbSmall);
@ -218,7 +222,7 @@ if ($action == 'addthumb')
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbMini);

View File

@ -41,6 +41,7 @@ $page_y=GETPOST('page_y','int');
$search_keyword=GETPOST('search_keyword','alpha');
$search_status=GETPOST('search_status','alpha');
$search_nature=GETPOST('search_nature','alpha');
$search_version=GETPOST('search_version','alpha');
if (! $user->admin)
accessforbidden();
@ -64,8 +65,9 @@ $familyinfo=array(
$param='';
if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
if ($search_status) $param.='&search_status='.urlencode($search_status);
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
if ($search_status) $param.='&search_status='.urlencode($search_status);
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
if ($search_version) $param.='&search_version='.urlencode($search_version);
@ -94,6 +96,7 @@ if (GETPOST('buttonreset'))
$search_keyword='';
$search_status='';
$search_nature='';
$search_version='';
}
@ -109,6 +112,7 @@ $_SESSION["mode"]=$mode;
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url);
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
// Search modules dirs
$modulesdir = dolGetModulesDirs();
@ -170,11 +174,30 @@ foreach ($modulesdir as $dir)
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
// We discard modules according to property disabled
if (! empty($objMod->hidden)) $modulequalified=false;
// We discard modules according to property disabled
if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0)
{
$publisher=dol_escape_htmltag($objMod->getPublisher());
$external=($objMod->isCoreOrExternalModule() == 'external');
if ($external)
{
if ($publisher)
{
$arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
}
else
{
$arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
}
}
ksort($arrayofnatures);
}
// Define array $categ with categ with at least one qualified module
if ($modulequalified)
if ($modulequalified > 0)
{
$modules[$i] = $objMod;
$filename[$i]= $modName;
@ -199,6 +222,7 @@ foreach ($modulesdir as $dir)
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
@ -254,15 +278,15 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>
$h = 0;
$categidx='common'; // Main
if (! empty($categ[$categidx]))
{
//if (! empty($categ[$categidx]))
//{
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
$head[$h][1] = $langs->trans("AvailableModules");
$head[$h][2] = 'common';
$h++;
}
//}
$categidx='expdev';
/*$categidx='expdev';
if (! empty($categ[$categidx]))
{
$categidx='expdev';
@ -270,7 +294,7 @@ if (! empty($categ[$categidx]))
$head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3);
$head[$h][2] = 'expdev';
$h++;
}
}*/
$categidx='marketplace';
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
@ -299,10 +323,20 @@ if ($mode != 'marketplace')
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
$moreforfilter.= '</div>';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1);
$moreforfilter.= '</div>';
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
{
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated");
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental");
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1);
$moreforfilter.= '</div>';
}
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', array('standard'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External")), $search_nature, 1);
$moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
$moreforfilter.= '</div>';
$moreforfilter.=' ';
$moreforfilter.='<div class="divsearchfield">';
@ -337,7 +371,8 @@ if ($mode != 'marketplace')
$modName = $filename[$key];
$objMod = $modules[$key];
$dirofmodule = $dirmod[$key];
$special = $objMod->special;
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
@ -358,6 +393,8 @@ if ($mode != 'marketplace')
$moduledesc=$objMod->getDesc();
$moduledesclong=$objMod->getDescLong();
$moduleauthor=$objMod->getPublisher();
// We discard showing according to filters
if ($search_keyword)
{
$qualified=0;
@ -375,8 +412,22 @@ if ($mode != 'marketplace')
}
if ($search_nature)
{
if ($search_nature == 'external' && $objMod->isCoreOrExternalModule() != 'external') continue;
if ($search_nature == 'standard' && $objMod->isCoreOrExternalModule() == 'external') continue;
if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue;
if (preg_match('/^external_(.*)$/',$search_nature, $reg))
{
//print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
$publisher=dol_escape_htmltag($objMod->getPublisher());
if ($reg[1] && $reg[1] != $publisher) continue;
if (! $reg[1] && ! empty($publisher)) continue;
}
if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
}
if ($search_version)
{
if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue;
if ($objMod->version != 'development' && ($search_version == 'development')) continue;
if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue;
if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue;
}
// Load all lang files of module
@ -394,7 +445,7 @@ if ($mode != 'marketplace')
if ($familykey!=$oldfamily)
{
print '<tr class="liste_titre">'."\n";
print '<td colspan="5">';
print '<td colspan="6">';
$familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
print $familytext;
print "</td>\n";
@ -442,18 +493,171 @@ if ($mode != 'marketplace')
print nl2br($objMod->getDesc());
print "</td>\n";
// Version
print '<td align="center" valign="top" class="nowrap">';
$version=$objMod->getVersion();
$dirofmodule=$dirmod[$key];
// Help
print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
$text='';
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'.$objMod->getDescLong().'<br>';
else $text.=$objMod->getDesc().'<br>';
$textexternal='';
if ($objMod->isCoreOrExternalModule() == 'external')
{
$text=$langs->trans("ExternalModule",$dirofmodule);
if (! empty($objMod->editor_name) && $objMod->editor_name != 'dolibarr') $text.=' - '.$objMod->editor_name;
if (! empty($objMod->editor_web) && $objMod->editor_web != 'www.dolibarr.org') $text.=' - '.$objMod->editor_web;
print $form->textwithpicto($version, $text, 1, 'help');
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
$text.=$textexternal;
$text.='<br>';
}
else print $version;
else
{
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
}
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i=0;
foreach($objMod->tabs as $val)
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
$i=0;
foreach($objMod->dictionaries['tablib'] as $val)
{
$text.=($i?', ':'').$val;
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i=0;
foreach($objMod->boxes as $val)
{
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
$i=0;
foreach($objMod->cronjobs as $val)
{
$text.=($i?', ':'').($val['label']);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
$i=0;
foreach($objMod->module_parts['hooks'] as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i=0;
foreach($objMod->rights as $val)
{
$text.=($i?', ':'').($val[1]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu)
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
$i=0;
foreach($objMod->export_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
$i=0;
foreach($objMod->import_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text.=$langs->trans("DetectionNotPossible");
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
// Picto warning
$version=$objMod->getVersion(0);
$versiontrans=$objMod->getVersion(1);
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"');
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"');
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"');
// Picto external
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"');
print '</td>';
// Version
print '<td align="center" valign="top" class="nowrap">';
print $versiontrans;
print "</td>\n";
// Activate/Disable and Setup (2 columns)
@ -498,11 +702,11 @@ if ($mode != 'marketplace')
{
if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
{
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>';
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
}
else
{
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>';
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
}
}
}
@ -510,16 +714,16 @@ if ($mode != 'marketplace')
}
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
{
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
}
else
{
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
}
}
else
{
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').'</td>';
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
}
}
@ -542,7 +746,7 @@ if ($mode != 'marketplace')
print "</a>\n";
}
print "</td>\n";
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').'</td>';
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
}
print "</tr>\n";

View File

@ -114,9 +114,8 @@ llxHeader('',$langs->trans("Files"),$wikihelp);
print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
//print $langs->trans("FilesDesc")."<br>\n";
//print "<br>\n";
print $langs->trans("SecurityFilesDesc")."<br>\n";
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -40,7 +40,7 @@ $form = new Form($db);
$title=$langs->trans("SystemToolsArea");
if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools");
llxHeader(array(),$title);
llxHeader('', $title);
print load_fiche_titre($title,'','title_setup');

View File

@ -1451,8 +1451,8 @@ class Categorie extends CommonObject
if (file_exists($originImage))
{
// Cree fichier en taille vignette
$this->add_thumb($originImage);
// Create thumbs
$this->addThumbs($originImage);
}
}
}
@ -1478,7 +1478,7 @@ class Categorie extends CommonObject
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) != false)
while (($file = readdir($handle)) !== false)
{
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
{

View File

@ -79,7 +79,7 @@ if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->
if ($action == 'addthumb' && $_GET["file"])
{
$object->add_thumb($upload_dir."/".$_GET["file"]);
$object->addThumbs($upload_dir."/".$_GET["file"]);
}

View File

@ -1090,17 +1090,22 @@ if ($id > 0)
// Thirdparty - Contact
if ($conf->societe->enabled)
{
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
print '<td>';
print '<div class="maxwidth200onsmartphone">';
$events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($object->socid,'socid','',1,1,0,$events);
print '</td>';
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0);
print '</div>';
print '</td></tr>';
// Contact
print '<td>'.$langs->trans("Contact").'</td><td>';
print '<tr><td>'.$langs->trans("Contact").'</td><td>';
print '<div class="maxwidth200onsmartphone">';
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>';
print '</div>';
print '</td>';
print '</tr>';
}
// Project
@ -1108,10 +1113,10 @@ if ($id > 0)
{
$formproject=new FormProjets($db);
$langs->load("project");
$langs->load("projects");
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").'</a>';
@ -1120,7 +1125,7 @@ if ($id > 0)
}
// Priority
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>';
@ -1136,7 +1141,7 @@ if ($id > 0)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
$doleditor->Create();
print '</td></tr>';
@ -1281,7 +1286,7 @@ if ($id > 0)
// Third party - Contact
if ($conf->societe->enabled)
{
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
print '<tr><td>'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
{
if ($object->thirdparty->fetch($object->thirdparty->id))

View File

@ -124,6 +124,14 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// customer preferred shipping method
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
{
$object->fetch($id);
$result = $object->setShippingMethod(GETPOST('shipping_method_id','int'));
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// assujetissement a la TVA
if ($action == 'setassujtva' && $user->rights->societe->creer)
{
@ -239,8 +247,8 @@ if ($id > 0)
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
print ($object->prefix_comm?$object->prefix_comm:'&nbsp;');
print '</td></tr>';
print ($object->prefix_comm?$object->prefix_comm:'&nbsp;');
print '</td></tr>';
}
if ($object->client)
@ -431,6 +439,27 @@ if ($id > 0)
print '</div></td></tr>';
}
// Preferred shipping Method
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('SendingMethod');
print '<td>';
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editshipping')
{
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id');
}
else
{
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'none');
}
print "</td>";
print '</tr>';
}
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';

View File

@ -1320,6 +1320,9 @@ if ($action == 'create')
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
print '</td>';
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
$shipping_method_id = $soc->shipping_method_id;
}
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1);
@ -2421,10 +2424,7 @@ if ($action == 'create')
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='pro'.$object->id;
}
$formmail->trackid='pro'.$object->id;
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';

View File

@ -547,7 +547,7 @@ class Propal extends CommonObject
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la propale meme
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();
@ -2037,9 +2037,10 @@ class Propal extends CommonObject
*/
function classer_facturee()
{
global $user;
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $this->classifyBilled();
return $this->classifyBilled($user);
}
/**
@ -2841,8 +2842,8 @@ class Propal extends CommonObject
/**
* Retrieve an array of propal lines
*
* @return int <0 if ko, >0 if ok
*
* @return int >0 if OK, <0 if KO
*/
function getLinesArray()
{

View File

@ -59,7 +59,7 @@ $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_author=GETPOST('search_author','alpha');
$search_login=GETPOST('search_login','alpha');
$search_product_category=GETPOST('search_product_category','int');
$search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha');
@ -90,9 +90,6 @@ if (! $sortorder) $sortorder='DESC';
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='proposallist';
// Nombre de ligne pour choix de produit/service predefinis
$NBLINES=4;
// Security check
$module='propal';
$dbtable='';
@ -106,6 +103,7 @@ if (! empty($socid))
}
$result = restrictedArea($user, $module, $objectid, $dbtable);
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist'));
@ -129,11 +127,11 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'p.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
@ -160,6 +158,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -179,7 +179,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_montant_ht='';
$search_montant_vat='';
$search_montant_ttc='';
$search_author='';
$search_login='';
$search_product_category='';
$search_town='';
$search_zip="";
@ -196,6 +196,25 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
}
if ($object_statut != '') $viewstatut=$object_statut;
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
}
@ -259,7 +278,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
if ($search_login) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_login))."%'";
if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1);
@ -344,7 +363,7 @@ if ($result)
if ($search_user > 0) $param.='&search_user='.$search_user;
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_author) $param.='&search_author='.$search_author;
if ($search_login) $param.='&search_login='.$search_login;
if ($search_town) $param.='&search_town='.$search_town;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
@ -355,6 +374,8 @@ if ($result)
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
// Lignes des champs de filtre
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -417,20 +438,20 @@ if ($result)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['p.ref_customer']['checked'])) print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans('Town'),$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans('Zip'),$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER["PHP_SELF"],'p.total_ttc','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER["PHP_SELF"],'p.total_vat','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -447,9 +468,9 @@ if ($result)
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
@ -460,7 +481,7 @@ if ($result)
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
}
if (! empty($arrayfields['p.ref_customer']['checked']))
if (! empty($arrayfields['p.ref_client']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
@ -587,20 +608,20 @@ if ($result)
print '</td>';
}
// Action column
print '<td class="liste_titre" align="right">';
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
$now = dol_now();
$i=0;
$var=true;
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$now = dol_now();
$var=!$var;
print '<tr '.$bc[$var].'>';
@ -638,7 +659,7 @@ if ($result)
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.ref_customer']['checked']))
if (! empty($arrayfields['p.ref_client']['checked']))
{
// Customer ref
print '<td class="nocellnopadd nowrap">';
@ -649,11 +670,12 @@ if ($result)
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid;
// Company
$companystatic->id=$obj->rowid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client=$obj->code_client;
// Thirdparty
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td>';
@ -754,6 +776,7 @@ if ($result)
$userstatic->id=$obj->fk_user_author;
$userstatic->login=$obj->login;
// Author
if (! empty($arrayfields['u.login']['checked']))
{

View File

@ -178,7 +178,7 @@ if (! $mesg)
$px2->draw($filenameamount,$fileurlamount);
}
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter);
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$fileurl_avg='';
if (!$user->rights->societe->client->voir || $user->societe_id)

View File

@ -466,7 +466,7 @@ if (empty($reshook))
else if ($action == 'classifybilled' && $user->rights->commande->creer)
{
$ret=$object->classifyBilled();
$ret=$object->classifyBilled($user);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -1953,7 +1953,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="18%">' . $langs->trans('Ref') . '</td>';
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
@ -1993,7 +1993,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($action == 'editthirdparty') {
$form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0');
} else {
print ' &nbsp;' . $soc->getNomUrl(1, 'compta');
print $soc->getNomUrl(1, 'compta');
}
print '</tr>';
@ -2672,10 +2672,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='ord'.$object->id;
}
$formmail->trackid='ord'.$object->id;
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';

View File

@ -202,7 +202,7 @@ class CommandeApi extends DolibarrApi
*
* @url POST order/
*
* @return int ID of commande
* @return string ID of commande
*/
function post($request_data = NULL)
{

View File

@ -2420,9 +2420,10 @@ class Commande extends CommonOrder
/**
* Classify the order as invoiced
*
* @return int <0 if ko, >0 if ok
* @param User $user Object user making the change
* @return int <0 if KO, >0 if OK
*/
function classifyBilled()
function classifyBilled(User $user)
{
global $conf, $user, $langs;
$error = 0;
@ -2476,9 +2477,10 @@ class Commande extends CommonOrder
*/
function classer_facturee()
{
global $user;
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $this->classifyBilled();
return $this->classifyBilled($user);
}
@ -3301,86 +3303,6 @@ class Commande extends CommonOrder
function getLinesArray()
{
return $this->fetch_lines();
/*
$lines = array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, ';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
$sql.= ' l.date_start, l.date_end,';
$sql.= ' l.fk_unit,';
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
$sql.= ' p.description as product_desc, p.stock as stock_reel,';
$sql.= ' p.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$this->id;
$sql.= ' ORDER BY l.rang ASC, l.rowid';
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->lines[$i] = new OrderLine($this->db);
$this->lines[$i]->id = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label;
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->ref;
$this->lines[$i]->entity = $obj->entity; // Product entity
$this->lines[$i]->product_label = $obj->product_label;
$this->lines[$i]->product_desc = $obj->product_desc;
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
$this->lines[$i]->product_type = $obj->product_type;
$this->lines[$i]->qty = $obj->qty;
$this->lines[$i]->subprice = $obj->subprice;
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
$this->lines[$i]->remise_percent = $obj->remise_percent;
$this->lines[$i]->tva_tx = $obj->tva_tx;
$this->lines[$i]->info_bits = $obj->info_bits;
$this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->stock = $obj->stock_reel;
$this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
$this->lines[$i]->pa_ht = $marginInfos[0];
$this->lines[$i]->marge_tx = $marginInfos[1];
$this->lines[$i]->marque_tx = $marginInfos[2];
$this->lines[$i]->fk_unit = $obj->fk_unit;
// Multicurrency
$this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency;
$this->lines[$i]->multicurrency_code = $obj->multicurrency_code;
$this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice;
$this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$i++;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error=$this->db->error();
return -1;
}*/
}
/**

View File

@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print "</td></tr>";

File diff suppressed because it is too large Load Diff

View File

@ -220,7 +220,7 @@ if (($action == 'create' || $action == 'add') && !$error)
{
if ($closeOrders)
{
$objectsrc->classifyBilled();
$objectsrc->classifyBilled($user);
$objectsrc->setStatut(3);
}
$lines = $objectsrc->lines;

View File

@ -276,7 +276,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
// Label
@ -360,7 +360,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Sold
print '<tr><td width="25%">'.$langs->trans("InitialBankBalance").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td>';
@ -382,7 +382,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// If bank account
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
print '</tr>';
@ -482,14 +482,14 @@ if ($action == 'create')
{
if (! empty($conf->accounting->enabled))
{
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
print '</td></tr>';
}
else
{
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
}
}
@ -497,14 +497,14 @@ if ($action == 'create')
{
if (! empty($conf->accounting->enabled))
{
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
print '</td></tr>';
}
else
{
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
}
}
@ -566,7 +566,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
@ -646,7 +646,7 @@ else
{
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
print '<tr><td valign="top" class="titlefield">'.$langs->trans("BankName").'</td>';
print '<td colspan="3">'.$account->bank.'</td></tr>';
// Show fields of bank account
@ -754,7 +754,7 @@ else
print '<table class="border" width="100%">';
// Accountancy code
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
// Accountancy journal
@ -831,7 +831,7 @@ else
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
// Label
@ -932,7 +932,7 @@ else
print '<table class="border" width="100%">';
// If bank account
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
print '</tr>';
@ -1030,14 +1030,14 @@ else
print '<table class="border" width="100%">';
// Accountancy code
$tdextra = '';
$tdextra = ' class="titlefieldcreate"';
if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
$tdextra = ' class="fieldrequired"';
$tdextra = ' class="fieldrequired titlefieldcreate"';
}
print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"'.$tdextra.'>';
print '<td colspan="3">';
if (!empty($conf->accounting->enabled)) {
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
} else {

View File

@ -92,18 +92,10 @@ if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
$upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),
0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) {
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name'])
== 1) {
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'],
$maxwidthsmall, $maxheightsmall, '_small', $quality,
"thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'],
$maxwidthmini, $maxheightmini, '_mini', $quality,
"thumbs");
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{
// Create thumbs
$object->addThumbs($upload_dir . "/" . $_FILES['userfile']['name']);
}
$mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
}
@ -172,14 +164,14 @@ if ($id > 0 || !empty($ref)) {
$totalsize+=$file['size'];
}
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
print '<table class="border"width="100%">';
// Ref
// Ref
print '<tr><td valign="top" width="25%">' . $langs->trans("Ref") . '</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'ref', '', 1, 'ref');
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label

View File

@ -1963,7 +1963,7 @@ if ($action == 'create')
$objectsrc->fetch_thirdparty();
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : (! empty($objectsrc->ref_customer) ? $objectsrc->ref_customer:''));
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
// only if socid not filled else it's allready done upper
@ -4141,10 +4141,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='inv'.$object->id;
}
$formmail->trackid='inv'.$object->id;
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';

View File

@ -3681,92 +3681,6 @@ class Facture extends CommonInvoice
function getLinesArray()
{
return $this->fetch_lines();
/*
$sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
$sql .= ' l.situation_percent, l.fk_prev_id,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.date_start, l.date_end,';
$sql.= ' l.fk_unit,';
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
$sql.= ' p.description as product_desc,';
$sql.= ' p.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_facture = '.$this->id;
$sql.= ' ORDER BY l.rang ASC, l.rowid';
dol_syslog(get_class($this).'::getLinesArray',LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->lines[$i] = new FactureLigne($this->db);
$this->lines[$i]->id = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label; // deprecated
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->product_ref;
$this->lines[$i]->product_ref = $obj->product_ref;
$this->lines[$i]->product_label = $obj->product_label;
$this->lines[$i]->product_desc = $obj->product_desc;
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
$this->lines[$i]->product_type = $obj->product_type;
$this->lines[$i]->entity = $obj->entity; // Product entity
$this->lines[$i]->qty = $obj->qty;
$this->lines[$i]->subprice = $obj->subprice;
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
$this->lines[$i]->remise_percent = $obj->remise_percent;
$this->lines[$i]->tva_tx = $obj->tva_tx;
$this->lines[$i]->info_bits = $obj->info_bits;
$this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->localtax1_tx = $obj->localtax1_tx;
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
$this->lines[$i]->localtax1_type = $obj->localtax1_type;
$this->lines[$i]->localtax2_type = $obj->localtax2_type;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->situation_percent = $obj->situation_percent;
$this->lines[$i]->fk_prev_id = $obj->fk_prev_id;
$this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
$this->lines[$i]->pa_ht = $marginInfos[0];
$this->lines[$i]->marge_tx = $marginInfos[1];
$this->lines[$i]->marque_tx = $marginInfos[2];
$this->lines[$i]->fk_unit = $obj->fk_unit;
// Multicurrency
$this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency;
$this->lines[$i]->multicurrency_code = $obj->multicurrency_code;
$this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice;
$this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$i++;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error=$this->db->error();
return -1;
}*/
}
/**

View File

@ -35,6 +35,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
@ -42,11 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('bills');
$langs->load('companies');
@ -70,9 +69,15 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al
$search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('search_status','int');
$search_paymentmode=GETPOST('search_paymentmode','int');
$search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0';
@ -80,9 +85,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) {
$page = 0;
}
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
if (! $sortorder) $sortorder='DESC';
@ -90,6 +93,9 @@ if (! $sortfield) $sortfield='f.datef';
$pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='invoicelist';
$search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int');
@ -106,15 +112,19 @@ $fieldid = (! empty($ref)?'facnumber':'rowid');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp';
if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user
$diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id;
$object=new Facture($db);
$now=dol_now();
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('invoicelist'));
$extrafields = new ExtraFields($db);
$now=dol_now();
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('facture');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
@ -126,6 +136,36 @@ $fieldstosearchall = array(
);
if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
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]);
}
}
/*
* Actions
@ -133,10 +173,45 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array('socid'=>$socid);
$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');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_user='';
$search_sale='';
$search_product_category='';
$search_ref='';
$search_refcustomer='';
$search_societe='';
$search_montant_ht='';
$search_montant_vat='';
$search_montant_ttc='';
$search_status='';
$search_paymentmode='';
$search_town='';
$search_zip="";
$search_state="";
$search_type='';
$search_country='';
$search_type_thirdparty='';
$day='';
$year='';
$month='';
$toselect='';
$option='';
$filter='';
$day_lim='';
$year_lim='';
$month_lim='';
$search_array_options=array();
}
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
@ -498,7 +573,7 @@ if (empty($reshook))
}
// Create output dir if not exists
dol_mkdir($diroutputpdf);
dol_mkdir($diroutputmassaction);
// Save merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
@ -512,7 +587,7 @@ if (empty($reshook))
if ($pagecount)
{
$now=dol_now();
$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
@ -532,7 +607,7 @@ if (empty($reshook))
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $diroutputpdf;
$upload_dir = $diroutputmassaction;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
@ -542,30 +617,6 @@ if (empty($reshook))
}
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_user='';
$search_sale='';
$search_product_category='';
$search_ref='';
$search_refcustomer='';
$search_societe='';
$search_montant_ht='';
$search_montant_ttc='';
$search_status='';
$search_paymentmode='';
$day='';
$year='';
$month='';
$toselect='';
$option='';
$filter='';
$day_lim='';
$year_lim='';
$month_lim='';
}
/*
@ -579,16 +630,30 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
$bankaccountstatic=new Account($db);
$facturestatic=new Facture($db);
$formcompany=new FormCompany($db);
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client ';
$sql.= ' f.datec as date_creation, f.tms as date_update,';
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)";
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
@ -622,7 +687,14 @@ if ($filtre)
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total', $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status);
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
@ -659,17 +731,37 @@ if ($search_user > 0)
{
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
}
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
if (! $sall)
{
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid, s.code_client, s.client';
$sql.= ' f.datec, f.tms,';
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client';
}
else
{
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
$sql.= ' ORDER BY ';
$listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.',';
@ -713,11 +805,20 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode;
if ($show_files) $param.='&show_files=' .$show_files;
$param.=(! empty($option)?"&amp;option=".$option:"");
if ($option) $param.="&option=".$option;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
@ -875,188 +976,471 @@ if ($resql)
print '</div>';
}
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentModeShort"),$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Taxes'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'],$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Filters lines
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
print '</td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right">';
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
print $searchpitco;
// Ref
if (! empty($arrayfields['f.facnumber']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
}
// Ref customer
if (! empty($arrayfields['f.ref_client']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>';
}
// Date invoice
if (! empty($arrayfields['f.date']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
}
// Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
print '</td>';
}
// Thirpdarty
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Company type
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
}
// Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
print '</td>';
}
if (! empty($arrayfields['f.total_ht']['checked']))
{
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.$search_montant_ht.'">';
print '</td>';
}
if (! empty($arrayfields['f.total_vat']['checked']))
{
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.$search_montant_vat.'">';
print '</td>';
}
if (! empty($arrayfields['f.total_ttc']['checked']))
{
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
print '</td>';
}
if (! empty($arrayfields['am']['checked']))
{
print '<td class="liste_titre" align="right">';
print '</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['f.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['f.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status
if (! empty($arrayfields['f.fk_statut']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
}
// Action column
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
print $searchpitco;
print '</td>';
print "</tr>\n";
if ($num > 0)
{
$i=0;
$var=true;
$total_ht=0;
$total_tva=0;
$total_ttc=0;
$totalrecu=0;
$totalarray=array();
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$obj = $db->fetch_object($resql);
$var=!$var;
$datelimit=$db->jdate($objp->datelimite);
$datelimit=$db->jdate($obj->datelimite);
print '<tr '.$bc[$var].'>';
print '<td class="nowrap">';
$facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type;
$facturestatic->statut=$objp->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($objp->datelimite);
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note_private),1);
$paiement = $facturestatic->getSommePaiement();
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
print $objp->increment;
print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if (! empty($objp->note_private))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$objp->facid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
$filename=dol_sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->facid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>';
print '</tr>';
print '</table>';
print "</td>\n";
if (! empty($arrayfields['f.facnumber']['checked']))
{
print '<td class="nowrap">';
$facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->facnumber;
$facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
$paiement = $facturestatic->getSommePaiement();
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
print $obj->increment;
print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if (! empty($obj->note_private))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$obj->facid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
$filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>';
print '</tr>';
print '</table>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Customer ref
print '<td class="nowrap">';
print $objp->ref_client;
print '</td>';
if (! empty($arrayfields['f.ref_client']['checked']))
{
print '<td class="nowrap">';
print $obj->ref_client;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($objp->df),'day');
print '</td>';
if (! empty($arrayfields['f.date']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->df),'day');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date limit
print '<td align="center" class="nowrap">'.dol_print_date($datelimit,'day');
if ($facturestatic->hasDelay())
{
print img_warning($langs->trans('Late'));
}
print '</td>';
print '<td>';
$thirdparty=new Societe($db);
$thirdparty->id=$objp->socid;
$thirdparty->name=$objp->name;
$thirdparty->client=$objp->client;
$thirdparty->code_client=$objp->code_client;
print $thirdparty->getNomUrl(1,'customer');
print '</td>';
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{
print '<td align="center" class="nowrap">'.dol_print_date($datelimit,'day');
if ($facturestatic->hasDelay())
{
print img_warning($langs->trans('Late'));
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td>';
$thirdparty=new Societe($db);
$thirdparty->id=$obj->socid;
$thirdparty->name=$obj->name;
$thirdparty->client=$obj->client;
$thirdparty->code_client=$obj->code_client;
print $thirdparty->getNomUrl(1,'customer');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Town
if (! empty($arrayfields['s.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['s.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type ent
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Payment mode
print '<td>';
$form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none', '', -1);
print '</td>';
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
print '<td>';
$form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount HT
if (! empty($arrayfields['f.total_ht']['checked']))
{
print '<td align="right">'.price($obj->total_ht)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
$totalarray['totalht'] += $obj->total_ht;
}
// Amount VAT
if (! empty($arrayfields['f.total_vat']['checked']))
{
print '<td align="right">'.price($obj->total_vat)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
$totalarray['totalvat'] += $obj->total_vat;
}
// Amount TTC
if (! empty($arrayfields['f.total_ttc']['checked']))
{
print '<td align="right">'.price($obj->total_ttc)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
$totalarray['totalttc'] += $obj->total_ttc;
}
if (! empty($arrayfields['am']['checked']))
{
print '<td align="right">'.(! empty($paiement)?price($paiement,0,$langs):'&nbsp;').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $paiement;
}
print '<td align="right">'.price($objp->total_ht,0,$langs).'</td>';
print '<td align="right">'.price($objp->total_tva,0,$langs).'</td>';
print '<td align="right">'.price($objp->total_ttc,0,$langs).'</td>';
print '<td align="right">'.(! empty($paiement)?price($paiement,0,$langs):'&nbsp;').'</td>';
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['f.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['f.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
print '<td align="right" class="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$paiement,$objp->type);
print "</td>";
// Checkbox
if (! empty($arrayfields['f.fk_statut']['checked']))
{
print '<td align="right" class="nowrap">';
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
print "</td>";
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td class="nowrap" align="center">';
$selected=0;
if (in_array($objp->facid, $arrayofselected)) $selected=1;
print '<input id="cb'.$objp->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->facid.'"'.($selected?' checked="checked"':'').'>';
print '</td>' ;
if (in_array($obj->facid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
print '</td>' ;
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$total_ht+=$objp->total_ht;
$total_tva+=$objp->total_tva;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$paiement;
$i++;
}
if (($offset + $num) <= $limit)
{
// Print total
print '<tr class="liste_total">';
print '<td class="liste_total" colspan="6" align="left">'.$langs->trans('Total').'</td>';
print '<td class="liste_total" align="right">'.price($total_ht,0,$langs).'</td>';
print '<td class="liste_total" align="right">'.price($total_tva,0,$langs).'</td>';
print '<td class="liste_total" align="right">'.price($total_ttc,0,$langs).'</td>';
print '<td class="liste_total" align="right">'.price($totalrecu,0,$langs).'</td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '</tr>';
}
// Show total line
if (isset($totalarray['totalhtfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td align="right">'.price($totalarray['totalam']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
}
print "</table>\n";
print "</form>\n";
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
@ -1066,7 +1450,7 @@ if ($resql)
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputpdf;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire;
@ -1074,7 +1458,7 @@ if ($resql)
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
$formfile->show_documents('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
print $formfile->showdocuments('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{

View File

@ -213,7 +213,6 @@ if ($resql)
}
else
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="7">'.$langs->trans("None")."</td>";
print '</tr>';

View File

@ -151,7 +151,7 @@ if ($id > 0)
if (GETPOST('error','alpha')!='')
{
print '<div class="error">'.$bon->ReadError(GETPOST('error','alpha')).'</div>';
print '<div class="error">'.$bon->getErrorString(GETPOST('error','alpha')).'</div>';
}
/*if ($action == 'credite')

View File

@ -245,16 +245,18 @@ class BonPrelevement extends CommonObject
}
/**
* Read errors
* Return error string
*
* @param int $error id of error
* @return array Array of errors
* @param int $error Id of error
* @return string Error string
*/
function ReadError($error)
function getErrorString($error)
{
global $langs;
$errors = array();
$errors[1027] = "Date invalide";
$errors[1027] = $langs->trans("DateInvalid");
return $errors[abs($error)];
}

View File

@ -314,13 +314,9 @@ if (empty($reshook))
else
{
$object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
// Create thumbs
$object->addThumbs($newfile);
}
}
}

View File

@ -87,13 +87,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
}
else
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
// Create thumbs
$object->addThumbs($newfile);
}
}
}

View File

@ -8,7 +8,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@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
@ -1514,7 +1514,7 @@ class Contrat extends CommonObject
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
$tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -34,6 +34,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
$res=@include '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
//global $hookmanager;
$hookmanager->initHooks(array('searchform'));
$search_boxvalue=GETPOST('q');
@ -115,7 +117,7 @@ if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFO
}
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
{
$langs->load("hrm");
@ -124,9 +126,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO
*/
// Execute hook addSearchEntry
$hookmanager->initHooks(array('searchform','leftblock'));
$parameters=array();
$parameters=array('search_boxvalue'=>$search_boxvalue);
$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
if (empty($reshook))
{
@ -135,7 +135,6 @@ if (empty($reshook))
else $arrayresult=$hookmanager->resArray;
print json_encode($arrayresult);
if (is_object($db)) $db->close();

View File

@ -1733,10 +1733,10 @@ abstract class CommonObject
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
*
* @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
* @param boolean $renum True to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return int <0 if KO, >0 if OK
*/
function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true)
{
@ -1813,6 +1813,7 @@ abstract class CommonObject
dol_print_error($this->db);
}
}
return 1;
}
/**
@ -2154,9 +2155,9 @@ abstract class CommonObject
* Must be called at end of methods addline or updateline.
*
* @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force mode total of rounding, '1'=Force mode rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object and for this, we need seller object.
* @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null)
@ -3004,7 +3005,7 @@ abstract class CommonObject
/**
* Set extra parameters
*
* @return void
* @return int <0 if KO, >0 if OK
*/
function setExtraParameters()
{
@ -3091,7 +3092,7 @@ abstract class CommonObject
{
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null");
$sql.= ", location_incoterms = '".($id_incoterm > 0 ? $this->db->escape($location) : "null")."'";
$sql.= ", location_incoterms = ".($id_incoterm > 0 ? "'".$this->db->escape($location)."'" : "null");
$sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG);
$resql=$this->db->query($sql);
@ -3272,18 +3273,18 @@ abstract class CommonObject
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td class="linecolqty" align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td class="linecolqty" align="right">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit" align="left" width="50">'.$langs->trans('Unit').'</td>';
print '<td class="linecoluseunit" align="left">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td class="linecoldiscount" align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecoldiscount" align="right">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref" align="right" width="50">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
@ -3300,10 +3301,10 @@ abstract class CommonObject
}
// Total HT
print '<td class="linecolht" align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right" width="50">'.$langs->trans('TotalHTShortCurrency').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency').'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim
@ -3910,7 +3911,7 @@ abstract class CommonObject
* @param string $file Path file in UTF8 to original file to create thumbs from.
* @return void
*/
function add_thumb($file)
function addThumbs($file)
{
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
@ -3942,15 +3943,15 @@ abstract class CommonObject
* 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table).
* 4) Return value found into database (TODO No yet implemented)
*
* @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use
* @return string Default value
* @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use
* @return string|string[] Default value (can be an array if the GETPOST return an array)
**/
function getDefaultCreateValueFor($fieldname, $alternatevalue=null)
{
global $conf, $_POST;
// If param is has been posted with use this value first.
// If param here has been posted, we use this value first.
if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2);
if (isset($alternatevalue)) return $alternatevalue;
@ -4391,7 +4392,7 @@ abstract class CommonObject
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param array $tables Tables that need to be changed
* @param string[] $tables Tables that need to be changed
* @return bool
*/
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)

View File

@ -138,7 +138,7 @@ class DolEditor
/**
* Output edit area inside the HTML stream.
* Output depends on this->tool (fckeditor, ckeditor, texatrea, ...)
* Output depends on this->tool (fckeditor, ckeditor, textarea, ...)
*
* @param int $noprint 1=Return HTML string instead of printing it to output
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });"

View File

@ -219,7 +219,7 @@ class FileUpload
}
/**
* Enter description here ...
* getFileObject
*
* @param string $file_name Filename
* @return stdClass|NULL
@ -247,7 +247,7 @@ class FileUpload
}
/**
* Enter description here ...
* getFileObjects
*
* @return void
*/
@ -257,11 +257,11 @@ class FileUpload
}
/**
* Create thumbs
* Create thumbs of a file uploaded. Only the "mini" thumb is generated.
*
* @param string $file_name Filename
* @param string $options is array('max_width', 'max_height')
* @return void
* @return boolean
*/
protected function createScaledImage($file_name, $options)
{
@ -277,9 +277,8 @@ class FileUpload
return false;
}
$res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini');
$res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini'); // We don't use ->addThumbs here because there is no object and we don't need all thumbs, only the "mini".
//return $success;
if (preg_match('/error/i',$res)) return false;
return true;
}
@ -296,7 +295,7 @@ class FileUpload
* @param string $file File
* @param string $error Error
* @param string $index Index
* @return unknown|string
* @return boolean True if OK, False if KO
*/
protected function validate($uploaded_file, $file, $error, $index)
{
@ -376,12 +375,12 @@ class FileUpload
}
/**
* Enter description here ...
* trimFileName
*
* @param unknown_type $name Filename
* @param unknown_type $type ???
* @param unknown_type $index ???
* @return void
* @param string $name Filename
* @param string $type ???
* @param string $index ???
* @return string
*/
protected function trimFileName($name, $type, $index)
{
@ -405,43 +404,7 @@ class FileUpload
}
/**
* Enter description here ...
*
* @param unknown_type $file_path ???
* @return int Success or not
*/
protected function orientImage($file_path)
{
$exif = @exif_read_data($file_path);
if ($exif === false) {
return false;
}
$orientation = intval(@$exif['Orientation']);
if (!in_array($orientation, array(3, 6, 8))) {
return false;
}
$image = @imagecreatefromjpeg($file_path);
switch ($orientation) {
case 3:
$image = @imagerotate($image, 180, 0);
break;
case 6:
$image = @imagerotate($image, 270, 0);
break;
case 8:
$image = @imagerotate($image, 90, 0);
break;
default:
return false;
}
$success = imagejpeg($image, $file_path);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($image);
return $success;
}
/**
* Enter description here ...
* handleFileUpload
*
* @param string $uploaded_file Uploade file
* @param string $name Name

View File

@ -64,7 +64,7 @@ class HookManager
* class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context).
* Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed.
*
* @param array $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ...
* @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ...
* @return int Always 1
*/
function initHooks($arraycontext)

View File

@ -169,7 +169,8 @@ class Form
else if (preg_match('/^(numeric|amount)/',$typeofdata))
{
$tmp=explode(':',$typeofdata);
$ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.price(price2num($editvalue?$editvalue:$value)).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>';
$valuetoshow=price2num($editvalue?$editvalue:$value);
$ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow!=''?price($valuetoshow):'').'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>';
}
else if (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata))
{
@ -1344,7 +1345,7 @@ class Form
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request
* @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
@ -2095,7 +2096,8 @@ class Form
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
$sql.= " pfp.supplier_reputation";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
@ -2234,6 +2236,15 @@ class Form
$opt .= " - ".dol_trunc($objp->name,8);
$outval.=" - ".dol_trunc($objp->name,8);
}
if ($objp->supplier_reputation)
{
//TODO dictionnary
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
$opt .= " - ".$reputations[$objp->supplier_reputation];
$outval.=" - ".$reputations[$objp->supplier_reputation];
}
}
else
{
@ -2277,7 +2288,7 @@ class Form
*
* @param int $productid Id of product
* @param string $htmlname Name of HTML field
* @return void
* @return string|null
*/
function select_product_fourn_price($productid,$htmlname='productfournpriceid')
{
@ -2389,7 +2400,7 @@ class Form
* @param int $socid Id of company
* @param string $htmlname Name of HTML field
* @param int $showempty Add an empty field
* @return void
* @return integer|null
*/
function select_address($selected, $socid, $htmlname='address_id',$showempty=0)
{
@ -3640,7 +3651,7 @@ class Form
* @param int $displayhour Display hour selector
* @param int $displaymin Display minutes selector
* @param int $nooutput 1=No print output, return string
* @return void
* @return string
* @see select_date
*/
function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0)
@ -4137,11 +4148,18 @@ class Form
$return='';
// Define defaultnpr and defaultttx
// Define defaultnpr, defaultttx and defaultcode
$defaultnpr=($info_bits & 0x01);
$defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr);
$defaulttx=str_replace('*','',$selectedrate);
$defaultcode='';
if (preg_match('/\s*\((.*)\)/', $defaulttx, $reg))
{
$defaultcode=$reg[1];
$defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
}
//var_dump($defaulttx.'-'.$defaultnpr.'-'.$defaultcode);
// Check parameters
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
{
@ -4237,9 +4255,13 @@ class Form
$return.= $rate['nprtva'] ? '*': '';
if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')';
$return.= '"';
if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
if ($defaultcode)
{
$return.= ' selected';
if ($defaultcode == $rate['code']) $return.= ' selected';
}
elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
{
$return.= ' selected';
}
$return.= '>'.vatrate($rate['libtva']);
//$return.=($rate['code']?' '.$rate['code']:'');
@ -4280,7 +4302,7 @@ class Form
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return mixed Nothing or string if nooutput is 1
* @return string|null Nothing or string if nooutput is 1
* @see form_date
*/
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
@ -4563,9 +4585,9 @@ class Form
* @param int $iSecond Default preselected duration (number of seconds or '')
* @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo
* @param string $minunderhours If 1, show minutes selection under the hours
* @param integer $minunderhours If 1, show minutes selection under the hours
* @param int $nooutput Do not output html string but return it
* @return void
* @return string|null
*/
function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0)
{
@ -4747,7 +4769,7 @@ class Form
* @param string $morecss Add more class to css styles
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
* @param string $placeholder String to use as placeholder
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @param integer $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)

View File

@ -52,8 +52,8 @@ class FormActions
* @param string $selected Preselected value (-1..100)
* @param int $canedit 1=can edit, 0=read only
* @param string $htmlname Name of html prefix for html fields (selectX and valX)
* @param string $showempty Show an empty line if select is used
* @param string $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running)
* @param integer $showempty Show an empty line if select is used
* @param integer $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running)
* @return void
*/
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete',$showempty=0,$onlyselect=0)
@ -136,7 +136,7 @@ class FormActions
if (empty($onlyselect))
{
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled').'>';
print '<span class="hideifna">%</span>';
print '<span class="hideonsmartphone hideifna">%</span>';
}
}
else
@ -153,9 +153,10 @@ class FormActions
* @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
* @param int $socid socid of user
* @param int $forceshowtitle Show title even if there is no actions to show
* @param string $morecss More css on table
* @return int <0 if KO, >=0 if OK
*/
function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
function showactions($object,$typeelement,$socid=0,$forceshowtitle=0,$morecss='listactions')
{
global $langs,$conf,$user;
global $bc;
@ -182,7 +183,7 @@ class FormActions
print load_fiche_titre($title,'','');
$total = 0; $var=true;
print '<table class="noborder" width="100%">';
print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">';
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans('Ref').'</th>';
print '<th class="liste_titre">'.$langs->trans('Action').'</th>';
@ -245,7 +246,7 @@ class FormActions
* @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx')
* @param string $htmlname Name of select field
* @param string $excludetype A type to exclude ('systemauto', 'system', '')
* @param string $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
* @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
* @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value
* @param int $multiselect 1=Allow multiselect of action type
* @return void

View File

@ -64,9 +64,9 @@ class FormFile
* @param int $size Length of input file area
* @param Object $object Object to use (when attachment is done on an element)
* @param string $options Add an option column
* @param boolean $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 $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
* @return int <0 if KO, >0 if OK
*/
@ -227,16 +227,17 @@ class FormFile
* @param int $genallowed Generation is allowed (1/0 or array of formats)
* @param int $delallowed Remove is allowed (1/0)
* @param string $modelselected Model to preselect by default
* @param string $allowgenifempty Show warning if no model activated
* @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param integer $allowgenifempty Show warning if no model activated
* @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param int $iconPDF Show only PDF icon with link (1/0)
* @param int $maxfilenamelength Max length for filename shown
* @param string $noform Do not output html form tags
* @param integer $noform Do not output html form tags
* @param string $param More param on http links
* @param string $title Title to show on top of form
* @param string $buttonlabel Label on submit button
* @param string $codelang Default language code to use on lang combo box if multilang is enabled
* @return int <0 if KO, number of shown files if OK
* @deprecated Use print xxx->showdocuments() instead.
*/
function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
@ -256,11 +257,11 @@ class FormFile
* @param int $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0)
* @param string $modelselected Model to preselect by default
* @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning)
* @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param integer $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning)
* @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param int $iconPDF Deprecated, see getDocumentsLink
* @param int $maxfilenamelength Max length for filename shown
* @param string $noform Do not output html form tags
* @param integer $noform Do not output html form tags
* @param string $param More param on http links
* @param string $title Title to show on top of form
* @param string $buttonlabel Label on submit button
@ -274,7 +275,7 @@ class FormFile
if (0 !== $iconPDF) {
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
}
global $langs, $conf, $user, $hookmanager;
global $form, $bc;
@ -286,7 +287,7 @@ class FormFile
if (! empty($iconPDF)) {
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
}
$printer=0;
if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements
{
@ -502,10 +503,12 @@ class FormFile
$out.= '<tr class="liste_titre">';
$addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th align="center" colspan="'.(3+($addcolumforpicto?'2':'1')).'" class="formdoc liste_titre maxwidthonsmartphone">';
// Model
if (! empty($modellist))
{
$out.= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
$out.= '<span class="hideonsmartphone">'.$langs->trans('Model').' </span>';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{
@ -513,17 +516,14 @@ class FormFile
$modelselected=$arraykeys[0];
}
$out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', '');
$out.= '</th>';
$out.= ajax_combobox('model');
}
else
{
$out.= '<th align="left" class="formdoc liste_titre">';
$out.= $langs->trans("Files");
$out.= '</th>';
$out.= '<div class="float">'.$langs->trans("Files").'</div>';
}
// Language code (if multilang)
$out.= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
@ -537,12 +537,9 @@ class FormFile
{
$out.= '&nbsp;';
}
$out.= '</th>';
// Button
$addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th align="center" colspan="'.($addcolumforpicto?'2':'1').'" class="formdocbutton liste_titre maxwidthonsmartphone">';
$genbutton = '<input class="button" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled';
$genbutton.= '>';
@ -579,8 +576,8 @@ class FormFile
{
$file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC);
// Affiche en-tete tableau si non deja affiche
if (! empty($file_list) && ! $headershown)
// Show title of array if not already shown
if ((! empty($file_list) || $modulepart == 'massfilesarea') && ! $headershown)
{
$headershown=1;
$out.= '<div class="titre">'.$titletoshow.'</div>';

View File

@ -170,7 +170,7 @@ class FormMail extends Form
/**
* Remove a file from the list of attached files (stored in SECTION array)
*
* @param string $keytodelete Key in file array
* @param string $keytodelete Key in file array (0, 1, 2, ...)
* @return void
*/
function remove_attached_files($keytodelete)

View File

@ -384,7 +384,7 @@ class SMTPs
/**
* Attempt mail server authentication for a secure connection
*
* @return mixed $_retVal Boolean indicating success or failure of authentication
* @return boolean|null $_retVal Boolean indicating success or failure of authentication
*/
function _server_authenticate()
{
@ -441,7 +441,7 @@ class SMTPs
*
* @param boolean $_bolTestMsg whether to run this method in 'Test' mode.
* @param boolean $_bolDebug whether to log all communication between this Class and the Mail Server.
* @return mixed void
* @return boolean|null void
* $_strMsg If this is run in 'Test' mode, the actual message structure will be returned
*/
function sendMsg($_bolTestMsg = false, $_bolDebug = false)
@ -541,7 +541,7 @@ class SMTPs
* defined.
*
* @param mixed $_strConfigPath path to config file or VOID
* @return void
* @return boolean
*/
function setConfig($_strConfigPath = null)
{
@ -615,7 +615,7 @@ class SMTPs
* Path to the sendmail execuable
*
* @param string $_path Path to the sendmail execuable
* @return void
* @return boolean
*
*/
function setMailPath($_path)
@ -1020,8 +1020,8 @@ class SMTPs
/**
* Returns an array of addresses for a specific type; TO, CC or BCC
*
* @param mixed $_which Which collection of adresses to return
* @return array Array of emaill address
* @param string $_which Which collection of adresses to return
* @return string|false Array of emaill address
*/
function get_email_list($_which = null)
{
@ -1071,7 +1071,7 @@ class SMTPs
/**
* TO Address[es] inwhich to send mail to
*
* @param mixed $_addrTo TO Address[es] inwhich to send mail to
* @param string $_addrTo TO Address[es] inwhich to send mail to
* @return void
*/
function setTO($_addrTo)
@ -1456,7 +1456,7 @@ class SMTPs
* - [2] Private
* - [3] Company Confidential
*
* @param string $_value Message Sensitivity
* @param integer $_value Message Sensitivity
* @return void
*/
function setSensitivity($_value = 0)
@ -1491,7 +1491,7 @@ class SMTPs
* - [4] 'Low'
* - [5] 'Lowest'
*
* @param string $_value Message Priority
* @param integer $_value Message Priority
* @return void
*/
function setPriority ( $_value = 3 )
@ -1511,7 +1511,7 @@ class SMTPs
* - [4] 'Low'
* - [5] 'Lowest'
*
* @return void
* @return string
*/
function getPriority()
{
@ -1534,7 +1534,7 @@ class SMTPs
/**
* Gets flag which determines whether to calculate message MD5 checksum.
*
* @return string Message Priority
* @return boolean Message Priority
*/
function getMD5flag()
{
@ -1558,7 +1558,7 @@ class SMTPs
/**
* Retrieves the Message X-Header Content
*
* @return string $_msgContent Message X-Header Content
* @return string[] $_msgContent Message X-Header Content
*/
function getXheader()
{
@ -1632,7 +1632,7 @@ class SMTPs
* @param string $_strSend String to send
* @param string $_returnCode Return code
* @param string $CRLF CRLF
* @return boolean True or false
* @return boolean|null True or false
*/
function socket_send_str( $_strSend, $_returnCode = null, $CRLF = "\r\n" )
{

View File

@ -1271,158 +1271,6 @@ class DoliDBSqlite3 extends DoliDB
}
}
/**
* Cette fonction est l'equivalent de la fonction MONTH de MySql.
*
* @param string $date Date
* @return string
*/
public static function dbMONTH($date)
{
return date('n', strtotime($date));
}
/**
* calcule du numéro de semaine
*
* @param string $date Date
* @param int $mode Mode
* @return string
*/
public static function dbWEEK($date, $mode = 0)
{
$arr = date_parse($date);
$calc_year = 0;
return self::calc_week($arr['year'], $arr['month'], $arr['day'], self::week_mode($mode), $calc_year);
}
/**
* db_CURDATE
*
* @return string
*/
public static function dbCURDATE() {
return date('Y-m-d');
}
/**
* db_CURTIME
*
* @return string
*/
public static function dbCURTIME() {
return date('H:i:s');
}
/**
* dbWEEKDAY
*
* @param int $date Date
* @return double
*/
public static function dbWEEKDAY($date) {
$arr = date_parse($date);
return self::calc_weekday(self::calc_daynr($arr['year'], $arr['month'], $arr['day']), 0);
}
/**
* Cette fonction est l'equivelent de la fonction date_format de MySQL.
* @staticvar string $mysql_replacement Les symboles formatage a remplacer
*
* @param string $date la date dans un format ISO
* @param string $format la chaine de formatage
* @return string La date formatee.
*/
public static function dbdateformat($date, $format)
{
static $mysql_replacement;
if (! isset($mysql_replacement)) {
$mysql_replacement = array(
'%' => '%',
'a' => 'D',
'b' => 'M',
'c' => 'n',
'D' => 'jS',
'd' => 'd',
'e' => 'j',
'f' => 'u',
'H' => 'H',
'h' => 'h',
'I' => 'h',
'i' => 'i',
'k' => 'H',
'l' => 'g',
'M' => 'F',
'm' => 'm',
'p' => 'A',
'r' => 'h:i:s A',
'S' => 's',
's' => 's',
'T' => 'H:i:s',
'W' => 'l',
'w' => 'w',
'Y' => 'Y',
'y' => 'y',
);
}
$fmt = '';
$lg = strlen($format);
$state = 0;
$timestamp = strtotime($date);
$yday = date('z', $timestamp);
$month = (integer) date("n", $timestamp);
$year = (integer) date("Y", $timestamp);
$day = (integer) date("d", $timestamp);
for($idx = 0; $idx < $lg; ++$idx) {
$char = $format[$idx];
if ($state == 0) {
if ($char == '%') {
$state = 1;
} else {
$fmt .= $char;
}
}
elseif ($state == 1) {
if (array_key_exists($char, $mysql_replacement)) {
$fmt .= $mysql_replacement[$char];
} else {
$calc_year = 0;
switch ($char) {
case 'j': // day of the year 001
$char = sprintf("%03d", $yday+1);
break;
case 'U': // mode 0: semaine 0 = premiere semaine complète qui commence un dimanche
$char = sprintf("%02d", self::calc_week($year, $month, $day, 4, $calc_year));
break;
case 'u': // mode 1: semaine 0 = première semaine de 4 jours. Début le dimanche
$char = sprintf("%02d", self::calc_week($year, $month, $day, 1, $calc_year));
break;
case 'V': // mode 2: semaine 1 = premiere semaine complète qui commence un dimanche
$char = sprintf("%02d", self::calc_week($year, $month, $day, 6, $calc_year));
break;
case 'v': // mode 3: semaine 1 = premiere semaine de 4 jours. Début le lundi
$char = sprintf("%02d", self::calc_week($year, $month, $day, 3, $calc_year));
break;
case 'X':
self::calc_week($year, $month, $day, 6, $calc_year);
$char = sprintf("%04d", $calc_year);
break;
case 'x':
self::calc_week($year, $month, $day, 3, $calc_year);
$char = sprintf("%04d", $calc_year);
break;
}
$fmt .= $char;
}
$state = 0;
}
}
return date($fmt, strtotime($date));
}
/**
* calc_daynr
*
@ -1467,20 +1315,6 @@ class DoliDBSqlite3 extends DoliDB
return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365);
}
/**
* week_mode
*
* @param string $mode Mode
* @return integer Week format
*/
private static function week_mode($mode) {
$week_format= ($mode & 7);
if (!($week_format & self::WEEK_MONDAY_FIRST)) {
$week_format^= self::WEEK_FIRST_WEEKDAY;
}
return $week_format;
}
/**
* calc_week
*

View File

@ -21,6 +21,14 @@
*
* This is the File Manager Connector for PHP.
*/
/**
* CombinePaths
*
* @param string $sBasePath sBasePath
* @param string $sFolder sFolder
* @return string Combined path
*/
function CombinePaths( $sBasePath, $sFolder )
{
return RemoveFromEnd($sBasePath, '/') . '/' . RemoveFromStart($sFolder, '/');
@ -45,8 +53,8 @@ function GetResourceTypePath($resourceType, $sCommand)
/**
* GetResourceTypeDirectory
*
* @param unknown_type $resourceType Resource type
* @param unknown_type $sCommand Command
* @param string $resourceType Resource type
* @param string $sCommand Command
* @return string
*/
function GetResourceTypeDirectory($resourceType, $sCommand)
@ -99,7 +107,7 @@ function RemoveExtension($fileName)
* @param string $resourceType Resource type
* @param string $folderPath Folder
* @param string $sCommand Command
* @return void
* @return string
*/
function ServerMapFolder($resourceType, $folderPath, $sCommand)
{
@ -380,6 +388,14 @@ EOF;
// DOL_CHANGE
// This is the function that sends the results of the uploading process to CKE.
/**
* SendCKEditorResults
*
* @param string $callback callback
* @param string $sFileUrl sFileUrl
* @param string $customMsg customMsg
* @return void
*/
function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
{
echo '<script type="text/javascript">';

View File

@ -84,13 +84,6 @@ function societe_prepare_head(Societe $object)
$h++;
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Agenda");
$head[$h][2] = 'agenda';
$h++;
}
if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
@ -189,11 +182,21 @@ function societe_prepare_head(Societe $object)
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][1] = $langs->trans("Events");
$head[$h][1].= ' / ';
}
$head[$h][1].= $langs->trans("Info");
$head[$h][2] = 'agenda';
$h++;
// Log
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
/*$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$h++;*/
complete_head_from_modules($conf,$langs,$object,$head,$h,'thirdparty','remove');

View File

@ -1486,7 +1486,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
}
if (image_format_supported($destpath) == 1)
{
// Create small thumbs for image (Ratio is near 16/9)
// Create thumbs
// We can't use $object->addThumbs here because there is no $object known
// Used on logon for example
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)

View File

@ -158,8 +158,8 @@ function ordersupplier_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$object->id;
$head[$h][1] = $langs->trans("OrderFollow");
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');

View File

@ -2416,16 +2416,16 @@ function img_info($titlealt = 'default')
* Show warning logo
*
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $float If we must add style "float: right"
* @param string $options Add more attribute on img tag (For example 'style="float: right"'). If 1
* @return string Return img tag
*/
function img_warning($titlealt = 'default', $float = 0)
function img_warning($titlealt = 'default', $options = '')
{
global $conf, $langs;
if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($float ? ' style="float: right"' : ''));
return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($options ? ($options == '1' ? ' style="float: right"' : ' '.$options): ''));
}
/**
@ -4525,7 +4525,7 @@ function dol_textishtml($msg,$option=0)
}
/**
* Concat 2 descriptions (second one after first one with a new line separator if required)
* Concat 2 descriptions with a new line between them (second operand after first one with appropriate new line separator)
* text1 html + text2 html => text1 + '<br>' + text2
* text1 html + text2 txt => text1 + '<br>' + dol_nl2br(text2)
* text1 txt + text2 html => dol_nl2br(text1) + '<br>' + text2

View File

@ -203,9 +203,10 @@ function dol_print_file($langs,$filename,$searchalt=0)
* TODO Move this into html.formother
*
* @param object $object Objet to show
* @param int $usetable Output into a table
* @return void
*/
function dol_print_object_info($object)
function dol_print_object_info($object, $usetable=0)
{
global $langs,$db;
$langs->load("other");
@ -219,14 +220,27 @@ function dol_print_object_info($object)
$deltadateforuser=round($deltadateforclient-$deltadateforserver);
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
if ($usetable) print '<table class="border centpercent">';
// Import key
if (! empty($object->import_key))
print $langs->trans("ImportedWithSet").': '.$object->import_key.'<br>';
// User creation
if (! empty($object->user_creation))
{
print $langs->trans("CreatedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ImportedWithSet");
if ($usetable) print '</td><td>';
else print ': ';
print $object->import_key;
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User creation (old method using already loaded object and not id is kept for backward compatibility)
if (! empty($object->user_creation) || ! empty($object->user_creation_id))
{
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("CreatedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_creation))
{
if ($object->user_creation->id) print $object->user_creation->getNomUrl(1);
@ -235,25 +249,34 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_creation);
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date creation
if (! empty($object->date_creation))
{
print $langs->trans("DateCreation").': '.dol_print_date($object->date_creation, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateCreation");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_creation, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_creation+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User change
if (! empty($object->user_modification))
// User change (old method using already loaded object and not id is kept for backward compatibility)
if (! empty($object->user_modification) || ! empty($object->user_modification_id))
{
print $langs->trans("ModifiedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ModifiedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_modification))
{
if ($object->user_modification->id) print $object->user_modification->getNomUrl(1);
@ -262,25 +285,34 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_modification);
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date change
if (! empty($object->date_modification))
{
print $langs->trans("DateLastModification").': '.dol_print_date($object->date_modification, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateLastModification");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_modification, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_modification+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User validation
if (! empty($object->user_validation))
// User validation (old method using already loaded object and not id is kept for backward compatibility)
if (! empty($object->user_validation) || ! empty($object->user_validation_id))
{
print $langs->trans("ValidatedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ValidatedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_validation))
{
if ($object->user_validation->id) print $object->user_validation->getNomUrl(1);
@ -289,25 +321,34 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_validation);
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date validation
if (! empty($object->date_validation))
{
print $langs->trans("DateValidation").': '.dol_print_date($object->date_validation, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateValidation");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_validation, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User approve
if (! empty($object->user_approve))
// User approve (old method using already loaded object and not id is kept for backward compatibility)
if (! empty($object->user_approve) || ! empty($object->user_approve_id))
{
print $langs->trans("ApprovedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ApprovedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_approve))
{
if ($object->user_approve->id) print $object->user_approve->getNomUrl(1);
@ -316,25 +357,62 @@ function dol_print_object_info($object)
else
{
$userstatic=new User($db);
$userstatic->fetch($object->user_approve);
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date approve
if (! empty($object->date_approve))
{
print $langs->trans("DateApprove").': '.dol_print_date($object->date_approve, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateApprove");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User approve
if (! empty($object->user_approve_id2))
{
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ApprovedBy");
if ($usetable) print '</td><td>';
else print ': ';
$userstatic=new User($db);
$userstatic->fetch($object->user_approve_id2);
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date approve
if (! empty($object->date_approve2))
{
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateApprove2");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve2, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User close
if (! empty($object->user_cloture))
{
print $langs->trans("ClosedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ClosedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_cloture))
{
if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1);
@ -347,21 +425,30 @@ function dol_print_object_info($object)
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date close
if (! empty($object->date_cloture))
{
print $langs->trans("DateClosing").': '.dol_print_date($object->date_cloture, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateClosing");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_cloture, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_cloture+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// User conciliate
if (! empty($object->user_rappro))
{
print $langs->trans("ConciliatedBy").': ';
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("ConciliatedBy");
if ($usetable) print '</td><td>';
else print ': ';
if (is_object($object->user_rappro))
{
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1);
@ -374,24 +461,37 @@ function dol_print_object_info($object)
if ($userstatic->id) print $userstatic->getNomUrl(1);
else print $langs->trans("Unknown");
}
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date conciliate
if (! empty($object->date_rappro))
{
print $langs->trans("DateConciliating").': '.dol_print_date($object->date_rappro, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateConciliating");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_rappro, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
// Date send
if (! empty($object->date_envoi))
{
print $langs->trans("DateLastSend").': '.dol_print_date($object->date_envoi, 'dayhour');
if ($usetable) print '<tr><td class="titlefield">';
print $langs->trans("DateLastSend");
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_envoi, 'dayhour');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi+($deltadateforuser*3600),"dayhour").' &nbsp;'.$langs->trans("ClientHour");
print '<br>';
if ($usetable) print '</td></tr>';
else print '<br>';
}
if ($usetable) print '</table>';
}
@ -481,7 +581,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
* Clean an url string
*
* @param string $url Url
* @param string $http 1 = keep both http:// and https://, 0: remove http:// but not https://
* @param integer $http 1 = keep both http:// and https://, 0: remove http:// but not https://
* @return string Cleaned url
*/
function clean_url($url,$http=1)
@ -540,7 +640,8 @@ function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4,
$mail_domaine = $tab2[0];
$mail_tld = '';
for($i=1; $i < count($tab2) && $displaytld ;$i++)
$nbofelem = count($tab2);
for($i=1; $i < $nbofelem && $displaytld; $i++)
{
$mail_tld .= '.'.$tab2[$i];
}

View File

@ -37,7 +37,9 @@ function dolNumberToWord($numero, $langs, $numorcurrency='number')
return -1;
// Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format ($numero,10);
for ($i=0; $i<strlen($strnumber); $i++){
$len=strlen($strnumber);
for ($i=0; $i<$len; $i++)
{
if ($strnumber[$i]=='.') {
$parte_decimal = $strnumber[$i+1].$strnumber[$i+2];
break;
@ -109,7 +111,15 @@ function dolNumberToWord($numero, $langs, $numorcurrency='number')
}
}
function hundreds2text ($hundreds, $tens, $units){
/**
* hundreds2text
*
* @param integer $hundreds Hundreds
* @param integer $tens Tens
* @param integer $units Units
*/
function hundreds2text($hundreds, $tens, $units)
{
if ($hundreds==1 && $tens==0 && $units==0){
return "CIEN";
}

View File

@ -27,8 +27,8 @@
* @param string $url URL to call.
* @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'DELETE'
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED
* @param string $followlocation 1=Follow location, 0=Do not follow
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
* @param integer $followlocation 1=Follow location, 0=Do not follow
* @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
*/
function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array())

View File

@ -291,6 +291,46 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
}
/**
* dolRotateImage if image is a jpg file.
* Currently use an autodetection to know if we can rotate.
* TODO Introduce a new parameter to force rotate.
*
* @param string $file_path Full path to image to rotate
* @return boolean Success or not
*/
function dolRotateImage($file_path)
{
$exif = @exif_read_data($file_path);
if ($exif === false) {
return false;
}
$orientation = intval(@$exif['Orientation']);
if (!in_array($orientation, array(3, 6, 8))) {
return false;
}
$image = @imagecreatefromjpeg($file_path);
switch ($orientation) {
case 3:
$image = @imagerotate($image, 180, 0);
break;
case 6:
$image = @imagerotate($image, 270, 0);
break;
case 8:
$image = @imagerotate($image, 90, 0);
break;
default:
return false;
}
$success = imagejpeg($image, $file_path);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($image);
return $success;
}
/**
* Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp).
* If file is myfile.jpg, new file may be myfile_small.jpg

View File

@ -110,7 +110,7 @@ function member_prepare_head(Adherent $object)
/**
* Return array head with list of tabs to view object informations
*
* @param Adherent $object Member
* @param AdherentType $object Member
* @return array head
*/
function member_type_prepare_head(AdherentType $object)

View File

@ -1628,7 +1628,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
* @return string
*/
function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false)
{

View File

@ -50,7 +50,8 @@
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param double $multicurrency_tx Currency rate (1 by default)
* @return result[ 0=total_ht,
* @return array [
* 0=total_ht,
* 1=total_vat, (main vat only)
* 2=total_ttc, (total_ht + main vat + local taxes)
* 3=pu_ht,

View File

@ -17,7 +17,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/hrm.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
-- Home - Dashboard
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'Dashboard', 0, '', '', '', 2, 0, __ENTITY__);
@ -199,8 +199,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'accountancy', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&amp;mainmenu=accountancy', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&amp;action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/calc.php?leftmenu=tax_loan', 'Calculator', 2, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__);
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/calc.php?leftmenu=tax_loan', 'Calculator', 2, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&amp;action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);

View File

@ -223,9 +223,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$idsel='hrm';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/hrm/hrm.php?mainmenu=hrm&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
$menu->add('/hrm/hrm.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
}
@ -876,8 +876,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("loan");
$newmenu->add("/loan/index.php?leftmenu=tax_loan&amp;mainmenu=accountancy",$langs->trans("Loans"),1,$user->rights->loan->read, '', $mainmenu, 'tax_loan');
if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create",$langs->trans("NewLoan"),2,$user->rights->loan->write);
if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/index.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
//if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
if ((empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) && ! empty($conf->global->LOAN_SHOW_CALCULATOR)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
}
// Social contributions

View File

@ -469,6 +469,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
global $langs;
$langs->load("admin");
if (empty($this->descriptionlong)) return '';
// If module description translation does not exist using its unique id, we can use its name to find translation
if (is_array($this->langfiles))
{
@ -501,13 +503,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
}
/**
* Gives module version
* Gives module version (translated if param $translated is on)
* For 'experimental' modules, gives 'experimental' translation
* For 'dolibarr' modules, gives Dolibarr version
*
* @return string Module version
* @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated
* @return string Module version
*/
function getVersion()
function getVersion($translated=1)
{
global $langs;
$langs->load("admin");
@ -515,13 +518,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
$ret='';
$newversion=preg_replace('/_deprecated/','',$this->version);
if ($newversion == 'experimental') $ret=$langs->trans("VersionExperimental");
elseif ($newversion == 'development') $ret=$langs->trans("VersionDevelopment");
if ($newversion == 'experimental') $ret=($translated?$langs->trans("VersionExperimental"):$newversion);
elseif ($newversion == 'development') $ret=($translated?$langs->trans("VersionDevelopment"):$newversion);
elseif ($newversion == 'dolibarr') $ret=DOL_VERSION;
elseif ($newversion) $ret=$newversion;
else $ret=$langs->trans("VersionUnknown");
else $ret=($translated?$langs->trans("VersionUnknown"):'unknown');
if (preg_match('/_deprecated/',$this->version)) $ret.=' ('.$langs->trans("Deprecated").')';
if (preg_match('/_deprecated/',$this->version)) $ret.=($translated?' ('.$langs->trans("Deprecated").')':$this->version);
return $ret;
}

View File

@ -146,7 +146,7 @@ abstract class ModelNumRefExpedition
* Create a document onto disk according to template module.
*
* @param DoliDB $db Objet base de donnee
* @param Object $object Object expedition
* @param Expedition $object Object expedition
* @param string $modele Force le modele a utiliser ('' to not force)
* @param Translate $outputlangs Objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,7 +69,6 @@ class pdf_standard extends ModeleExpenseReport
$langs->load("main");
$langs->load("trips");
$langs->load("project");
$langs->load("trips");
$this->db = $db;
$this->name = "";
@ -91,8 +91,8 @@ class pdf_standard extends ModeleExpenseReport
$this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 1; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // Support credit notes
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
@ -104,26 +104,27 @@ class pdf_standard extends ModeleExpenseReport
// Define position of columns
$this->posxpiece=$this->marge_gauche+1;
$this->posxdesc=20;
$this->posxdate=85;
$this->posxtype=105;
$this->posxprojet=125;
$this->posxtva=145;
$this->posxup = 162;
$this->posxqty = 176;
$this->postotalttc = 186;
$this->posxcomment=$this->marge_gauche+10;
$this->posxdate=80;
$this->posxtype=97;
$this->posxprojet=116;
$this->posxtva=136;
$this->posxup=148;
$this->posxqty=166;
$this->postotalttc=178;
if (empty($conf->projet->enabled)) {
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->postotalttc-=20;
}
if ($this->page_largeur < 210) { // To work with US executive format
$this->posxdate-=20;
$this->posxtype-=20;
$this->posxprojet-=20;
$this->posxtva-=20;
$this->posxup-=20;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxdate-=20;
$this->posxtype-=20;
$this->posxprojet-=20;
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->postotalttc-=20;
}
@ -132,7 +133,6 @@ class pdf_standard extends ModeleExpenseReport
$this->localtax1=array();
$this->localtax2=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
}
@ -204,7 +204,7 @@ class pdf_standard extends ModeleExpenseReport
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
@ -235,15 +235,6 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
{
if ($object->lines[$i]->remise_percent)
{
$this->atleastonediscount++;
}
}
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
@ -254,9 +245,9 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(0,0,0);
$tab_top = 95;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?95:10);
$tab_height = 110;
$tab_height_newpage = 110;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?65:10);
$tab_height = 130;
$tab_height_newpage = 150;
// Show notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
@ -302,7 +293,7 @@ class pdf_standard extends ModeleExpenseReport
$piece_comptable = $i +1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
@ -310,18 +301,17 @@ class pdf_standard extends ModeleExpenseReport
$pageposbefore=$pdf->getPage();
// Description of product line
$curX = $this->posxdesc-1;
$curX = $this->posxcomment-1;
$showpricebeforepagebreak=1;
// Accountancy piece
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
$pdf->SetXY($this->posxpiece, $curY);
$pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C');
// Comments
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxcomment, $curY);
$pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lines[$i]->comments, 0, 1);
$pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1);
//nexY
$nexY = $pdf->GetY();
@ -331,67 +321,55 @@ class pdf_standard extends ModeleExpenseReport
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// Date
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxtype-$this->posxdate-1, 3,dol_print_date($object->lines[$i]->date,"day",false,$outpulangs), 0, 'C');
$pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4,dol_print_date($object->lines[$i]->date,"day",false,$outputlangs), 0, 'C');
// Type
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtype, $curY);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
$pdf->MultiCell($this->posxprojet-$this->posxtype-0.8, 4,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
if (! empty($conf->projet->enabled)) {
// Project
// Project
if (! empty($conf->projet->enabled))
{
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxprojet, $curY);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
$pdf->MultiCell($this->posxtva-$this->posxprojet-0.8, 4, $object->lines[$i]->projet_ref, 0, 'C');
}
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C');
}
// Unit price
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lines[$i]->value_unit), 0, 'R');
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R');
// Quantity
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lines[$i]->qty, 0, 'C');
$pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'C');
// Total with all taxes
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->postotalttc-1, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R');
$nexY+=5;
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
$follow_comment = $object->lines[$i+1]->comments;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
// Et si on affiche dates de validite, on ajoute encore une ligne
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{
$nblineFollowDesc += 4;
}
$nblineFollowComment = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output)*4;
}
else // If it's last line
{
$nblineFollowDesc = 0;
$nblineFollowComment = 0;
}
$nexY+=2; // Passe espace entre les lignes
$nexY+=4; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@ -583,13 +561,13 @@ class pdf_standard extends ModeleExpenseReport
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'L');
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outputlangs):''), '', 'L');
// Date end period
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L');
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outputlangs):''), '', 'L');
// Status Expense Report
$posy+=6;
@ -597,146 +575,155 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','B',18);
$pdf->SetTextColor(111,81,124);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
if ($showaddress)
{
// Sender properties
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
$carac_emetteur .= "\n";
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
// EMail
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
// Web
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
// Sender properties
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
$carac_emetteur .= "\n";
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
// EMail
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
// Web
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
// Show sender
$posy=50;
$posx=$this->marge_gauche;
$hautcadre=40;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
// Show sender
$posy=50;
$posx=$this->marge_gauche;
$hautcadre=40;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
// Show sender information
$pdf->SetXY($posx+2,$posy+8);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Show sender information
$pdf->SetXY($posx+2,$posy+8);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Show recipient
$posy=50;
$posx=100;
// Show recipient
$posy=50;
$posx=100;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','B',8);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','B',8);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
// Informations for trip (dates and users workflow)
if ($object->fk_user_author > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_author); $posy+=3;
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','',10);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outputlangs),0,'L');
}
// Informations for trip (dates and users workflow)
if ($object->fk_user_author > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_author); $posy+=3;
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','',10);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
}
if ($object->fk_statut==99)
{
if ($object->fk_user_refuse > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_refuse); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outputlangs),0,'L');
}
}
else if($object->fk_statut==4)
{
if ($object->fk_user_cancel > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_cancel); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outputlangs),0,'L');
}
}
else
{
if ($object->fk_user_approve > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_approve); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outputlangs),0,'L');
}
}
if ($object->fk_statut==99)
{
if ($object->fk_user_refuse > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_refuse); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
}
}
else if($object->fk_statut==4)
{
if ($object->fk_user_cancel > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_cancel); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
}
}
else
{
if ($object->fk_user_approve > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_approve); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outpulangs),0,'L');
}
}
if($object->fk_statut==6)
{
if ($object->fk_user_paid > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_paid); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
}
}
if($object->fk_statut==6)
{
if ($object->fk_user_paid > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_paid); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outputlangs),0,'L');
}
}
}
}
/**
* Affiche la grille des lignes de factures
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param int $tab_top Tab top
* @param int $tab_height Tab height
* @param int $nexY next y
* @param Translate $outputlangs Output langs
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -752,57 +739,89 @@ class pdf_standard extends ModeleExpenseReport
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
}
$pdf->SetFont('','',8);
// Accountancy piece
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R');
if (empty($hidetop))
{
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxcomment-$this->posxpiece-1,1,'','','R');
}
// Comments
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L');
$pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxcomment-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxcomment-1,1,$outputlangs->transnoentities("Description"),'','L');
}
// Date
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
}
// Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtype - 1, $tab_top + 1);
$pdf->MultiCell($this->posxprojet - $this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxtype-1, $tab_top+1);
$pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
}
if (!empty($conf->projet->enabled)) {
if (!empty($conf->projet->enabled))
{
// Project
$pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
$pdf->SetXY($this->posxprojet - 1, $tab_top + 1);
$pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxprojet - 1, $tab_top + 1);
$pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C');
}
}
// VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva - 1, $tab_top + 1);
$pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
}
// VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
}
}
// Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
}
// Quantity
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
}
// Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
if (empty($hidetop))
{
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
}
$pdf->SetTextColor(0,0,0);
}

View File

@ -63,7 +63,7 @@ class mailing_fraise extends MailingTargets
* array of SQL request that returns two field:
* One called "label", One called "nb".
*
* @return array Array with SQL requests
* @return string[] Array with SQL requests
*/
function getSqlArrayForStats()
{

View File

@ -53,7 +53,7 @@ class modAgenda extends DolibarrModules
$this->module_position = 15;
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion de l'agenda et des actions";
$this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
@ -76,24 +76,23 @@ class modAgenda extends DolibarrModules
// Constants
//-----------
$this->const = array();
$this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_SENTBYMAIL","chaine","1");
$this->const[0] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_CREATE","chaine","1");
$this->const[1] = array("MAIN_AGENDA_ACTIONAUTO_CONTRACT_VALIDATE","chaine","1");
$this->const[2] = array("MAIN_AGENDA_ACTIONAUTO_PROPAL_VALIDATE","chaine","1");
$this->const[3] = array("MAIN_AGENDA_ACTIONAUTO_PROPAL_SENTBYMAIL","chaine","1");
$this->const[4] = array("MAIN_AGENDA_ACTIONAUTO_ORDER_VALIDATE","chaine","1");
$this->const[5] = array("MAIN_AGENDA_ACTIONAUTO_ORDER_SENTBYMAIL","chaine","1");
$this->const[6] = array("MAIN_AGENDA_ACTIONAUTO_BILL_VALIDATE","chaine","1");
$this->const[7] = array("MAIN_AGENDA_ACTIONAUTO_BILL_PAYED","chaine","1");
$this->const[8] = array("MAIN_AGENDA_ACTIONAUTO_BILL_CANCEL","chaine","1");
$this->const[9] = array("MAIN_AGENDA_ACTIONAUTO_BILL_SENTBYMAIL","chaine","1");
$this->const[10] = array("MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_VALIDATE","chaine","1");
$this->const[11] = array("MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_VALIDATE","chaine","1");
$this->const[12] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE","chaine","1");
$this->const[13] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL","chaine","1");
$this->const[14] = array("MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE","chaine","1");
$this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_UNVALIDATE","chaine","1");
$sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang";
$resql = $this->db->query($sqlreadactions);
if ($resql)
{
while ($obj = $this->db->fetch_object($sqlreadactions))
{
if (preg_match('/_CREATE$/',$obj->code)) continue; // We don't track such events (*_CREATE) by default.
if (preg_match('/^PROJECT_/',$obj->code)) continue; // We don't track such events by default.
if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default.
$this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1");
}
}
else
{
dol_print_error($this->db->lasterror());
}
// New pages on tabs
// -----------------
$this->tabs = array();
@ -400,4 +399,5 @@ class modAgenda extends DolibarrModules
$this->export_sql_end[$r] .=' ORDER BY ac.datep';
}
}

View File

@ -178,10 +178,10 @@ class modCommande extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("commande","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -194,6 +194,7 @@ class modCommande extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande as c';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_extrafields as extra ON c.rowid = extra.fk_object';

View File

@ -192,10 +192,10 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export","other"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -207,6 +207,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
@ -222,10 +223,10 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaiementMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaiementMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -233,6 +234,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';

View File

@ -154,15 +154,18 @@ class modFicheinter extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("ficheinter","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc");
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote", 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc");
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean", 'pj.ref'=>'Text', 'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line');
$this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention',1).')';
$r++;

View File

@ -51,7 +51,7 @@ class modLoan extends DolibarrModules
$this->description = "Loans management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'experimental';
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;

View File

@ -171,10 +171,10 @@ class modPropale extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("propale","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -186,6 +186,7 @@ class modPropale extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s ';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object';

View File

@ -25,7 +25,6 @@
include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
use OAuth\Common\Storage\Session;
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;
use OAuth\OAuth2\Service\Google;

View File

@ -549,7 +549,7 @@ class pdf_beluga extends ModelePDFProjects
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Object $object Object to show
* @param Project $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -611,10 +611,10 @@ class pdf_beluga extends ModelePDFProjects
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Project $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
* @return integer
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{

View File

@ -70,7 +70,7 @@ class mod_syslog_sentry extends LogHandler implements LogHandlerInterface
/**
* Is the module active ?
*
* @return int
* @return boolean
*/
public function isActive()
{

View File

@ -124,7 +124,7 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
if ($result == $fullpath)
{
$object->add_thumb($fullpath);
$object->addThumbs($fullpath);
if ($backtourl)
{
@ -153,7 +153,7 @@ if ($action == 'confirm_crop')
if ($result == $fullpath)
{
$object->add_thumb($fullpath);
$object->addThumbs($fullpath);
if ($backtourl)
{

View File

@ -527,10 +527,13 @@ jQuery(document).ready(function() {
jQuery('#trlinefordates').show();
});
/* When changing predefined product, we reload list of supplier prices */
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
{
setforpredef();
console.log("#idprod, #idprodfournprice change triggered");
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
jQuery('#trlinefordates').show();
<?php
@ -539,103 +542,107 @@ jQuery(document).ready(function() {
$langs->load('stocks');
?>
/* Code for margin */
$("#fournprice_predef").find("option").remove();
$("#fournprice_predef").hide();
$("#buying_price").val("").show();
/* Call post to load content of combo list fournprice_predef */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0)
{
var options = '';
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var bestpriceid = 0; var bestpricevalue = 0;
var pmppriceid = 0; var pmppricevalue = 0;
var costpriceid = 0; var costpricevalue = 0;
/* Code for margin */
$("#fournprice_predef").find("option").remove();
$("#fournprice_predef").hide();
$("#buying_price").val("").show();
/* Call post to load content of combo list fournprice_predef */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0)
{
var options = '';
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var bestpriceid = 0; var bestpricevalue = 0;
var pmppriceid = 0; var pmppricevalue = 0;
var costpriceid = 0; var costpricevalue = 0;
/* setup of margin calculation */
var defaultbuyprice = '<?php
if (isset($conf->global->MARGIN_TYPE))
{
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
} ?>';
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
var i = 0;
$(data).each(function() {
if (this.id != 'pmpprice' && this.id != 'costprice')
{
i++;
this.price = parseFloat(this.price); // to fix when this.price >0
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
if (this.id == 'pmpprice')
{
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price);
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
{
if (this.price > 0) {
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
//console.log("pmppricevalue="+pmppricevalue);
}
}
}
if (this.id == 'costprice')
{
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
if ('costprice' == defaultbuyprice)
{
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
else if (pmppricevalue > 0) { defaultkey = pmppriceid; defaultprice = pmppricevalue; }
}
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
$("#fournprice_predef").html(options).show();
if (defaultkey != '')
{
$("#fournprice_predef").val(defaultkey);
}
/* At loading, no product are yet selected, so we hide field of buying_price */
$("#buying_price").hide();
/* Define default price at loading */
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
$("#buying_price").val(defaultprice);
$("#fournprice_predef").change(function() {
console.log("change on fournprice_predef");
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
var linevalue=$(this).find('option:selected').val();
var pricevalue = $(this).find('option:selected').attr("price");
if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
$("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
}
if (linevalue == 'inputprice') {
$('#buying_price').show();
}
if (linevalue == 'pmpprice') {
$("#buying_price").val(pricevalue);
$('#buying_price').hide();
}
});
}
},
'json');
/* setup of margin calculation */
var defaultbuyprice = '<?php
if (isset($conf->global->MARGIN_TYPE))
{
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
} ?>';
console.log("defaultbuyprice="+defaultbuyprice);
var i = 0;
$(data).each(function() {
if (this.id != 'pmpprice' && this.id != 'costprice')
{
i++;
this.price = parseFloat(this.price); // to fix when this.price >0
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
if (this.id == 'pmpprice')
{
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
console.log("id="+this.id+"-price="+this.price);
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
{
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
console.log("pmppricevalue="+pmppricevalue); }
}
}
if (this.id == 'costprice')
{
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
if ('costprice' == defaultbuyprice)
{
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
else if (pmppricevalue > 0) { defaultkey = pmppriceid; defaultprice = pmppricevalue; }
}
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
$("#fournprice_predef").html(options).show();
if (defaultkey != '')
{
$("#fournprice_predef").val(defaultkey);
}
/* At loading, no product are yet selected, so we hide field of buying_price */
$("#buying_price").hide();
/* Define default price at loading */
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
$("#buying_price").val(defaultprice);
$("#fournprice_predef").change(function() {
console.log("change on fournprice_predef");
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
var linevalue=$(this).find('option:selected').val();
var pricevalue = $(this).find('option:selected').attr("price");
if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
$("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
}
if (linevalue == 'inputprice') {
$('#buying_price').show();
}
if (linevalue == 'pmpprice') {
$("#buying_price").val(pricevalue);
$('#buying_price').hide();
}
});
}
},
'json');
<?php } ?>
<?php
}
?>
/* To set focus */
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
@ -659,6 +666,7 @@ jQuery(document).ready(function() {
/* Function to set fields from choice */
function setforfree() {
console.log("Call setforfree. We show most fields");
jQuery("#search_idprod").val('');
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
@ -680,6 +688,7 @@ function setforfree() {
jQuery("#units, #title_units").show();
}
function setforpredef() {
console.log("Call setforpredef. We hide some fields");
jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false);
jQuery("#prod_entry_mode_predef").prop('checked',true);

View File

@ -101,7 +101,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
{
foreach($object->linkedObjects['propal'] as $element)
{
$ret=$element->classifyBilled();
$ret=$element->classifyBilled($user);
}
}
return $ret;
@ -120,7 +120,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
{
foreach($object->linkedObjects['commande'] as $element)
{
$ret=$element->classifyBilled();
$ret=$element->classifyBilled($user);
}
}
return $ret;
@ -139,7 +139,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
{
foreach($object->linkedObjects['commande'] as $element)
{
$ret=$element->classifyBilled();
$ret=$element->classifyBilled($user);
}
}
return $ret;

View File

@ -430,6 +430,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_CREATE')
{
$langs->load("other");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
@ -467,7 +479,31 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
elseif ($action == 'ORDER_SUPPLIER_SUBMIT')
{
$langs->load("other");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_RECEIVE')
{
$langs->load("other");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
$langs->load("other");
$langs->load("bills");
@ -483,6 +519,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
}
elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED')
{
$langs->load("other");
$langs->load("bills");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref);
if (empty($object->actionmsg))
{
$object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}
$object->sendtoid=0;
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
@ -624,7 +676,33 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0;
}
elseif($action == 'PROJECT_CREATE') {
$langs->load("other");
$langs->load("projects");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif($action == 'PROJECT_MODIFY') {
$langs->load("other");
$langs->load("projects");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("ProjectModifieddInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
// Project tasks
elseif($action == 'TASK_CREATE') {
$langs->load("other");
@ -683,7 +761,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$attachs=$_SESSION['listofnames'];
if ($attachs && strpos($action,'SENTBYMAIL'))
{
$object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs;
$object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
}
}

View File

@ -1886,10 +1886,7 @@ else if ($id || $ref)
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='shi'.$object->id;
}
$formmail->trackid='shi'.$object->id;
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';

View File

@ -25,6 +25,9 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("sendings");
$langs->load("deliveries");
@ -36,9 +39,16 @@ $expeditionid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expedition',$expeditionid,'');
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
$search_ref_exp = GETPOST("search_ref_exp");
$search_ref_liv = GETPOST('search_ref_liv');
$search_company = GETPOST("search_company");
$search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$sall = GETPOST('sall');
$optioncss = GETPOST('optioncss','alpha');
@ -53,27 +63,46 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='shipmentlist';
$viewstatut=GETPOST('viewstatut');
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref_exp='';
$search_ref_liv='';
$search_company='';
$viewstatut='';
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('shipmentlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('expedition');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'e.ref'=>"Ref",
's.nom'=>"ThirdParty"
's.nom'=>"ThirdParty",
'e.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'e.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'e.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1),
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled),
'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled)
);
$arrayfields=array(
);
// Extra fields
/*
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
@ -81,9 +110,57 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
*/
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array('socid'=>$socid);
$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');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref_exp='';
$search_ref_liv='';
$search_company='';
$search_town='';
$search_zip="";
$search_state="";
$search_type='';
$search_country='';
$search_type_thirdparty='';
$viewstatut='';
$search_array_options=array();
}
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
}
/*
* View
*/
@ -91,21 +168,34 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$form=new Form($db);
$companystatic=new Societe($db);
$shipment=new Expedition($db);
$formcompany=new FormCompany($db);
$helpurl='EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Expediciones';
llxHeader('',$langs->trans('ListOfSendings'),$helpurl);
$sql = "SELECT e.rowid, e.ref, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut";
$sql.= ", s.nom as socname, s.rowid as socid";
$sql.= " FROM (".MAIN_DB_PREFIX."expedition as e";
$sql = "SELECT e.rowid, e.ref, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut,";
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' e.date_creation as date_creation, e.tms as date_update';
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target";
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
{
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql.= ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target";
$sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")";
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
{
@ -119,11 +209,34 @@ if ($socid)
if ($viewstatut <> '' && $viewstatut >= 0) {
$sql.= " AND e.fk_statut = ".$viewstatut;
}
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
@ -148,12 +261,22 @@ if ($resql)
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv;
if ($search_company) $param.= "&amp;search_company=".$search_company;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
$i = 0;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -178,106 +301,314 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
if($conf->livraison_bon->enabled)
{
print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder);
if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['l.fk_statut']['checked'])) print_liste_field_titre($arrayfields['l.fk_statut']['label'], $_SERVER["PHP_SELF"],"l.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Lignes des champs de filtre
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
// Date delivery planned
print '<td class="liste_titre">&nbsp;</td>';
if ($conf->livraison_bon->enabled)
// Ref
if (! empty($arrayfields['e.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">';
print '</td>';
}
// Thirdparty
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (! empty($arrayfields['state.nom']['checked']))
{
// Delivery order
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Company type
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
}
// Date delivery planned
if (! empty($arrayfields['e.date_delivery']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['l.ref']['checked']))
{
// Delivery ref
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"';
print '</td>';
// Date received
}
if (! empty($arrayfields['l.date_delivery']['checked']))
{
// Date received
print '<td class="liste_titre">&nbsp;</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['e.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['e.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status
print '<td align="right">';
print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1);
print '</td>';
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
if (! empty($arrayfields['e.fk_statut']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1);
print '</td>';
}
// Action column
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
$var=True;
$i=0;
$var=true;
$totalarray=array();
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
$shipment->id=$obj->rowid;
$shipment->ref=$obj->ref;
// Ref
print "<td>";
$shipment->id=$objp->rowid;
$shipment->ref=$objp->ref;
print $shipment->getNomUrl(1);
print "</td>\n";
// Third party
print '<td>';
$companystatic->id=$objp->socid;
$companystatic->ref=$objp->socname;
$companystatic->name=$objp->socname;
print $companystatic->getNomUrl(1);
print '</td>';
// Date delivery planed
print "<td align=\"center\">";
print dol_print_date($db->jdate($objp->date_livraison),"day");
/*$now = time();
if ( ($now - $db->jdate($objp->date_expedition)) > $conf->warnings->lim && $objp->statutid == 1 )
if (! empty($arrayfields['e.ref']['checked']))
{
}*/
print "</td>\n";
if ($conf->livraison_bon->enabled)
print "<td>";
print $shipment->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
$companystatic->id=$obj->socid;
$companystatic->ref=$obj->name;
$companystatic->name=$obj->name;
// Third party
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td>';
print $companystatic->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Town
if (! empty($arrayfields['s.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['s.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type ent
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date delivery planed
if (! empty($arrayfields['e.date_delivery']['checked']))
{
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_livraison),"day");
/*$now = time();
if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 )
{
}*/
print "</td>\n";
}
if (! empty($arrayfields['l.ref']['checked']) || ! empty($arrayfields['l.date_delivery']['checked']))
{
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
$receiving='';
if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
// Ref
print '<td>';
print !empty($receiving) ? $receiving->getNomUrl($db) : '';
print '</td>';
// Date received
print '<td align="center">';
print dol_print_date($db->jdate($objp->date_reception),"day");
print '</td>'."\n";
if (! empty($arrayfields['l.ref']['checked']))
{
// Ref
print '<td>';
print !empty($receiving) ? $receiving->getNomUrl($db) : '';
print '</td>';
}
if (! empty($arrayfields['l.date_delivery']['checked']))
{
// Date received
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_reception),"day");
print '</td>'."\n";
}
}
print '<td align="right">'.$expedition->LibStatut($objp->fk_statut,5).'</td>';
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td class="tdofextrafield"';
$align=$extrafields->getAlignFlag($key);
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['e.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['e.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['e.fk_statut']['checked']))
{
print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td></td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;

View File

@ -198,7 +198,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';

View File

@ -1860,10 +1860,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='int'.$object->id;
}
$formmail->trackid='int'.$object->id;
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';

View File

@ -365,35 +365,6 @@ class CommandeFournisseur extends CommonOrder
}
}
/**
* Add a line in log table
*
* @param User $user User making action
* @param int $statut Status of order
* @param date $datelog Date of change
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
*/
function log($user, $statut, $datelog, $comment='')
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_log (datelog, fk_commande, fk_statut, fk_user, comment)";
$sql.= " VALUES ('".$this->db->idate($datelog)."',".$this->id.", ".$statut.", ";
$sql.= $user->id.", ";
$sql.= ($comment?"'".$this->db->escape($comment)."'":'null');
$sql.= ")";
dol_syslog("FournisseurCommande::log", LOG_DEBUG);
if ( $this->db->query($sql) )
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Validate an order
*
@ -492,7 +463,6 @@ class CommandeFournisseur extends CommonOrder
if (! $error)
{
$result = 1;
$this->log($user, 1, time()); // Statut 1
$this->statut = 1;
$this->ref = $num;
}
@ -701,20 +671,43 @@ class CommandeFournisseur extends CommonOrder
/**
* Class invoiced the supplier order
*
* @return int <0 si ko, >0 si ok
* @param User $user Object user making the change
* @return int <0 if KO, >0 if KO
*/
function classifyBilled()
function classifyBilled(User $user)
{
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ';
if ($this->db->query($sql) )
if ($this->db->query($sql))
{
$this->billed=1;
return 1;
if (! $error)
{
// Call trigger
$result=$this->call_trigger('ORDER_SUPPLIER_CLASSIFY_BILLED',$user);
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{
$this->billed=1;
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return -1;
}
}
else
{
dol_print_error($this->db);
$this->db->rollback();
return -1;
}
}
@ -791,8 +784,6 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->query($sql))
{
$this->log($user, 2, time(), $comment); // Statut 2
if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT))
{
$result=$this->add_contact($user->id, 'SALESREPFOLL', 'internal', 1);
@ -897,7 +888,6 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->query($sql))
{
$result = 0;
$this->log($user, 9, time());
if ($error == 0)
{
@ -956,7 +946,6 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->query($sql))
{
$result = 0;
$this->log($user, $statut, time());
// Call trigger
$result=$this->call_trigger('ORDER_SUPPLIER_CANCEL',$user);
@ -991,21 +980,23 @@ class CommandeFournisseur extends CommonOrder
/**
* Send a supplier order to supplier
* Submit a supplier order to supplier
*
* @param User $user User making change
* @param date $date Date
* @param int $methode Method
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/
function commande($user, $date, $methode, $comment='')
{
global $langs;
dol_syslog(get_class($this)."::commande");
$result = 0;
$error = 0;
if ($user->rights->fournisseur->commande->commander)
{
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 3, fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."'";
$sql .= " WHERE rowid = ".$this->id;
@ -1015,24 +1006,37 @@ class CommandeFournisseur extends CommonOrder
$this->statut = 3;
$this->methode_commande_id = $methode;
$this->date_commande = $this->db->idate($date);
$result = 1;
$this->log($user, 3, $date, $comment);
// Call trigger
$result=$this->call_trigger('ORDER_SUPPLIER_SUBMIT',$user);
if ($result < 0) $error++;
// End call triggers
}
else
{
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$result = -1;
}
if (! $error)
{
$this->db->commit();
}
else
{
$this->db->rollback();
}
}
else
{
$result = -1;
$error++;
$this->error = $langs->trans('NotAuthorized');
$this->errors[] = $langs->trans('NotAuthorized');
dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR);
}
return $result ;
return ($error ? -1 : 1);
}
/**
@ -1933,9 +1937,22 @@ class CommandeFournisseur extends CommonOrder
{
$result = 0;
$this->statut = $statut;
$result=$this->log($user, $statut, $date, $comment);
$this->db->commit();
// Call trigger
$result=$this->call_trigger('ORDER_SUPPLIER_RECEIVE',$user);
if ($result < 0) $error++;
// End call triggers
if (! $error)
{
$this->db->commit();
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
$result = -1;
}
}
else
{
@ -2362,6 +2379,46 @@ class CommandeFournisseur extends CommonOrder
}
}
/**
* Charge les informations d'ordre info dans l'objet facture
*
* @param int $id Id de la facture a charger
* @return void
*/
function info($id)
{
$sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,';
$sql.= ' fk_user_author, fk_user_modif, fk_user_valid, fk_user_approve, fk_user_approve2';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseur as c';
$sql.= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) $this->user_creation_id = $obj->fk_user_author;
if ($obj->fk_user_valid) $this->user_validation_id = $obj->fk_user_valid;
if ($obj->fk_user_modif) $this->user_modification_id =$obj->fk_user_modif;
if ($obj->fk_user_approve) $this->user_approve_id = $obj->fk_user_approve;
if ($obj->fk_user_approve2) $this->user_approve_id2 = $obj->fk_user_approve2;
$this->date_creation = $this->db->idate($obj->datec);
$this->date_modification = $this->db->idate($obj->datem);
$this->date_approve = $this->db->idate($obj->datea);
$this->date_approve2 = $this->db->idate($obj->datea2);
$this->date_validation = $this->db->idate($obj->date_validation);
}
$this->db->free($result);
}
else
{
dol_print_error($this->db);
}
}
/**
* Charge indicateurs this->nb de tableau de bord
*

View File

@ -9,6 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@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
@ -1311,7 +1312,7 @@ class FactureFournisseur extends CommonInvoice
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc, $this->thirdparty);
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
$vatrate = preg_replace('/\s*\(.*\)/','',$vatrate); // Remove code into vatrate.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
$total_ht = $tabprice[0];
@ -1427,7 +1428,7 @@ class FactureFournisseur extends CommonInvoice
function info($id)
{
$sql = 'SELECT c.rowid, datec, tms as datem, ';
$sql.= ' fk_user_author, fk_user_valid';
$sql.= ' fk_user_author, fk_user_modif, fk_user_valid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c';
$sql.= ' WHERE c.rowid = '.$id;
@ -1450,8 +1451,14 @@ class FactureFournisseur extends CommonInvoice
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
$this->date_creation = $obj->datec;
$this->date_modification = $obj->datem;
if ($obj->fk_user_modif)
{
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->idate($obj->datec);
$this->date_modification = $this->db->idate($obj->datem);
//$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)
}
$this->db->free($result);

View File

@ -64,7 +64,12 @@ class ProductFournisseur extends Product
var $product_fourn_id; // supplier id
var $fk_availability; // availability delay - visible/used if option FOURN_PRODUCT_AVAILABILITY is on (duplicate information compared to delivery delay)
var $fourn_unitprice;
var $fourn_tva_tx;
var $fourn_tva_npr;
/**
* @deprecated
*/
var $fourn_unitcharges; // old version used a buggy system to calculate margin of a charge field on supplier price. Now margin is on pmp, best supplier price or cost price.
var $fk_supplier_price_expression;
@ -178,9 +183,10 @@ class ProductFournisseur extends Product
* @param float $remise Discount regarding qty (amount)
* @param int $newnpr Set NPR or not
* @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined.
* @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER)
* @return int <0 if KO, >=0 if OK
*/
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0)
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='')
{
global $conf, $langs;
//global $mysoc;
@ -191,6 +197,7 @@ class ProductFournisseur extends Product
if (empty($charges)) $charges=0;
if (empty($availability)) $availability=0;
if (empty($remise_percent)) $remise_percent=0;
if (empty($supplier_reputation) || $supplier_reputation == -1) $supplier_reputation='';
if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = '';
if ($price_base_type == 'TTC')
{
@ -225,7 +232,8 @@ class ProductFournisseur extends Product
$sql.= " entity = ".$conf->entity.",";
$sql.= " info_bits = ".$newnpr.",";
$sql.= " charges = ".$charges.",";
$sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null');
$sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null').",";
$sql.= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'");
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
// TODO Add price_base_type and price_ttc
@ -268,7 +276,7 @@ class ProductFournisseur extends Product
{
// Add price for this quantity to supplier
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days)";
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)";
$sql.= " values('".$this->db->idate($now)."',";
$sql.= " ".$this->id.",";
$sql.= " ".$fourn->id.",";
@ -285,8 +293,9 @@ class ProductFournisseur extends Product
$sql.= " ".$availability.",";
$sql.= " ".$newnpr.",";
$sql.= $conf->entity.",";
$sql.= $delivery_time_days;
$sql.=")";
$sql.= $delivery_time_days.",";
$sql.= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'");
$sql.=")";
dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG);
if (! $this->db->query($sql))
@ -359,7 +368,8 @@ class ProductFournisseur extends Product
{
global $conf;
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
$sql.=" pfp.supplier_reputation";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$rowid;
@ -371,7 +381,10 @@ class ProductFournisseur extends Product
if ($obj)
{
$this->product_fourn_price_id = $rowid;
$this->fourn_id = $obj->fk_soc;
$this->id = $obj->fk_product;
$this->fk_product = $obj->fk_product;
$this->product_id = $obj->fk_product; // deprecated
$this->fourn_id = $obj->fk_soc;
$this->fourn_ref = $obj->ref_fourn; // deprecated
$this->ref_supplier = $obj->ref_fourn;
$this->fourn_price = $obj->price;
@ -381,14 +394,12 @@ class ProductFournisseur extends Product
$this->fourn_remise = $obj->remise;
$this->fourn_unitprice = $obj->unitprice;
$this->fourn_unitcharges = $obj->unitcharges; // deprecated
$this->fourn_tva_tx = $obj->tva_tx;
$this->product_id = $obj->fk_product; // deprecated
$this->fk_product = $obj->fk_product;
$this->id = $obj->fk_product;
$this->fourn_tva_tx = $obj->tva_tx;
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?
$this->fk_availability = $obj->fk_availability;
$this->delivery_time_days = $obj->delivery_time_days;
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
$this->supplier_reputation = $obj->supplier_reputation;
if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression))
{
@ -437,7 +448,7 @@ class ProductFournisseur extends Product
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
$sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits, pfp.delivery_time_days";
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")";
@ -476,6 +487,7 @@ class ProductFournisseur extends Product
$prodfourn->id = $prodid;
$prodfourn->fourn_tva_npr = $record["info_bits"];
$prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$prodfourn->supplier_reputation = $record["supplier_reputation"];
if (!empty($conf->dynamicprices->enabled) && !empty($prodfourn->fk_supplier_price_expression)) {
$priceparser = new PriceParser($this->db);

View File

@ -314,7 +314,7 @@ class PaiementFourn extends Paiement
// Si c'est le cas, on refuse le delete
if ($bank_line_id)
{
$accline = new AccountLine($this->db,$bank_line_id);
$accline = new AccountLine($this->db);
$accline->fetch($bank_line_id);
if ($accline->rappro)
{

View File

@ -205,22 +205,33 @@ if (empty($reshook))
if ($action == 'reopen') // no test on permission here, permission to use will depends on status
{
if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
if (in_array($object->statut, array(1, 2, 3, 4, 5, 6, 7, 9)))
{
if ($object->statut == 1) $newstatus=0; // Validated->Draft
else if ($object->statut == 2) $newstatus=0; // Approved->Draft
else if ($object->statut == 3) $newstatus=2; // Ordered->Approved
else if ($object->statut == 5) $newstatus=4; // Received->Received partially
else if ($object->statut == 4) $newstatus=3;
else if ($object->statut == 5)
{
//$newstatus=2; // Ordered
// TODO Can we set it to submited ?
//$newstatus=3; // Submited
// TODO If there is at least one reception, we can set to Received->Received partially
$newstatus=4; // Received partially
}
else if ($object->statut == 6) $newstatus=2; // Canceled->Approved
else if ($object->statut == 7) $newstatus=3; // Canceled->Process running
else if ($object->statut == 9) $newstatus=1; // Refused->Validated
else $newstatus = 2;
//print "old status = ".$object->statut.' new status = '.$newstatus;
$db->begin();
$result = $object->setStatus($user, $newstatus);
if ($result > 0)
{
// Currently the "Re-open" also remove the billed flag because there is no button "Set unpaid" yet.
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
$sql.= ' SET billed = 0';
$sql.= ' WHERE rowid = '.$object->id;
@ -255,7 +266,7 @@ if (empty($reshook))
*/
if ($action == 'classifybilled' && $user->rights->fournisseur->commande->creer)
{
$ret=$object->classifyBilled();
$ret=$object->classifyBilled($user);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -2475,10 +2486,7 @@ elseif (! empty($object->id))
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='sor'.$object->id;
}
$formmail->trackid='sor'.$object->id;
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';
@ -2490,7 +2498,7 @@ elseif (! empty($object->id))
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
$formmail->withtocc=$liste;
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
$formmail->withtopic=$outputlangs->trans('SendOrderRef','__ORDERREF__');
$formmail->withtopic=$outputlangs->trans('SendOrderRef','__REF__');
$formmail->withfile=2;
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
@ -2499,6 +2507,7 @@ elseif (! empty($object->id))
$object->fetch_projet();
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit['__ORDERREF__']=$object->ref; // For backward compatibility
$formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier; // For backward compatibility
$formmail->substit['__SUPPLIERORDERREF__']=$object->ref_supplier;
@ -2883,7 +2892,7 @@ elseif (! empty($object->id))
}
}
}
if (in_array($object->statut, array(3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
if (in_array($object->statut, array(3, 4, 5, 6, 7, 9)))
{
if ($user->rights->fournisseur->commande->commander)
{
@ -3046,7 +3055,7 @@ elseif (! empty($object->id))
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
// List of actions on element

View File

@ -1,192 +0,0 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fourn/commande/history.php
* \ingroup commande
* \brief Fiche commande
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$langs->load("orders");
$langs->load("suppliers");
$langs->load("companies");
$langs->load('stocks');
$id=GETPOST('id','int');
$ref=GETPOST('ref','alpha');
// Security check
$socid='';
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
/*
* View
*/
$form = new Form($db);
$now=dol_now();
if ($id > 0 || ! empty($ref))
{
$soc = new Societe($db);
$commande = new CommandeFournisseur($db);
$result=$commande->fetch($id,$ref);
if ($result >= 0)
{
$soc->fetch($commande->socid);
$author = new User($db);
$author->fetch($commande->user_author_id);
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
$head = ordersupplier_prepare_head($commande);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'info', $title, 0, 'order');
/*
* Commande
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($commande, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->getInputMethod().'</td></tr>';
}
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print "</table>\n";
print "<br>";
/*
* Suivi historique
* Date - Statut - Auteur
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
print '<td class="liste_titre">'.$langs->trans("Status").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
print '<td class="liste_titre" align="left">'.$langs->trans("Comment").'</td>';
print '</tr>';
$sql = "SELECT l.fk_statut, l.datelog as dl, l.comment, u.rowid, u.login, u.firstname, u.lastname";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l";
$sql.= " , ".MAIN_DB_PREFIX."user as u ";
$sql.= " WHERE l.fk_commande = ".$commande->id;
$sql.= " AND u.rowid = l.fk_user";
$sql.= " ORDER BY l.rowid DESC";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object($resql);
print "<tr ".$bc[$var].">";
print '<td width="20%">'.dol_print_date($db->jdate($obj->dl),"dayhour")."</td>\n";
// Statut
print '<td class="nowrap">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
// User
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
// Comment
print '<td class="nowrap" title="'.dol_escape_htmltag($obj->comment).'">'.dol_trunc($obj->comment,48)."</td>\n";
print '</tr>';
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
print "</table>";
print '</div>';
}
else
{
/* Commande non trouvee */
print "Commande inexistante ou acces refuse";
}
}
llxFooter();
$db->close();

View File

@ -0,0 +1,134 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fourn/commande/info.php
* \ingroup commande
* \brief Fiche commande
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$langs->load("orders");
$langs->load("suppliers");
$langs->load("companies");
$langs->load('stocks');
$id=GETPOST('id','int');
$ref=GETPOST('ref','alpha');
// Security check
$socid='';
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
/*
* View
*/
$form = new Form($db);
$now=dol_now();
if ($id > 0 || ! empty($ref))
{
$soc = new Societe($db);
$object = new CommandeFournisseur($db);
$result=$object->fetch($id,$ref);
if ($result >= 0)
{
$object->info($object->id);
$soc->fetch($object->socid);
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
$head = ordersupplier_prepare_head($object);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'info', $title, 0, 'order');
/*
* Commande
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $object->getLibStatut(4);
print "</td></tr>";
// Date
if ($object->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($object->date_commande)
{
print dol_print_date($object->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($object->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
}
}
print "</table>\n";
print "<br>";
print '<table width="100%"><tr><td>';
dol_print_object_info($object, 1);
print '</td></tr></table>';
print '</div>';
}
else
{
/* Order not found */
print "OrderNotFound";
}
}
llxFooter();
$db->close();

View File

@ -239,10 +239,10 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
foreach($orders_id as $fk_supplier_order) {
$supplier_order = new CommandeFournisseur($db);
if($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5) {
if($supplier_order->classifyBilled()<0) {
if ($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5)
{
if ($supplier_order->classifyBilled($user) < 0)
{
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];

View File

@ -1873,7 +1873,8 @@ else
$nbrows=9; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
if (! empty($conf->incoterm->enabled)) $nbrows++;
// Local taxes
if ($societe->localtax1_assuj=="1") $nbrows++;
if ($societe->localtax2_assuj=="1") $nbrows++;
@ -2390,7 +2391,7 @@ else
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
$somethingshown=$formactions->showactions($object,'invoice_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
print '</div></div></div>';
//print '</td></tr></table>';
@ -2453,10 +2454,7 @@ else
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='sin'.$object->id;
}
$formmail->trackid='sin'.$object->id;
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';

View File

@ -677,7 +677,7 @@ $cp = new Holiday($db);
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
llxHeader(array(),$langs->trans('CPTitreMenu'));
llxHeader('', $langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
{

View File

@ -1584,7 +1584,7 @@ class Holiday extends CommonObject
/**
* Select event
*
* @return string|boolean Select Html to select type of holiday
* @return string|false Select Html to select type of holiday
*/
function selectEventCP()
{
@ -1641,7 +1641,7 @@ class Holiday extends CommonObject
* getValueEventCp
*
* @param int $rowid Row id
* @return string|boolean
* @return string|false
*/
function getValueEventCp($rowid) {

View File

@ -155,7 +155,7 @@ elseif($action == 'add_event')
$form = new Form($db);
$userstatic=new User($db);
llxHeader(array(),$langs->trans('CPTitreMenu'));
llxHeader('', $langs->trans('CPTitreMenu'));
print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');

View File

@ -114,7 +114,7 @@ $max_year = 5;
$min_year = 10;
$filter='';
llxHeader(array(),$langs->trans('CPTitreMenu'));
llxHeader('', $langs->trans('CPTitreMenu'));
$order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset);

View File

@ -50,7 +50,7 @@ $langs->load('users');
$cp = new Holiday($db);
llxHeader(array(),$langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')');
llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')');
// Recent changes are more important than old changes
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year,1,1))."' AND '".$db->idate(dol_get_last_day($year,12,1))."'"); // Load $cp->logs

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
*/
/**
* \file htdocs/compta/hrm.php
* \file htdocs/hrm/hrm.php
* \ingroup hrm
* \brief Home page for HRM area.
*/
@ -65,7 +65,7 @@ $holidaystatic=new Holiday($db);
$childids = $user->getAllChildIds();
$childids[]=$user->id;
llxHeader(array(),$langs->trans('HRMArea'));
llxHeader('', $langs->trans('HRMArea'));
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');

Some files were not shown because too many files have changed in this diff Show More