Merge remote-tracking branch 'upstream/develop' into new_branch_24_10_2019

This commit is contained in:
Philippe GRAND 2019-10-24 16:24:17 +02:00
commit 5e44d63ec0
9 changed files with 207 additions and 59 deletions

View File

@ -227,10 +227,8 @@ $sql = "SELECT c.subscription, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != '')
{
$sql .= " AND c.dateadh LIKE '".$date_select."%'";
}
$result = $db->query($sql);
if ($result)
{
@ -251,21 +249,33 @@ if ($result)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Subscriptions").'</th>';
print '<th class="right">'.$langs->trans("Number").'</th>';
print '<th>'.$langs->trans("Year").'</th>';
print '<th class="right">'.$langs->trans("Subscriptions").'</th>';
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
print "</tr>\n";
krsort($Total);
$i = 0;
foreach ($Total as $key=>$value)
{
print '<tr class="oddeven">';
if ($i >= 8)
{
print '<tr class="oddeven">';
print "<td>...</td>";
print "<td class=\"right\"></td>";
print "<td class=\"right\"></td>";
print "<td class=\"right\"></td>";
print "</tr>\n";
break;
}
print '<tr class="oddeven">';
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td class=\"right\">".$Number[$key]."</td>";
print "<td class=\"right\">".price($value)."</td>";
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
print "</tr>\n";
$i++;
}
// Total

View File

@ -164,7 +164,12 @@ class modFicheinter extends DolibarrModules
'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',
'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote");
$keyforselect='fichinter'; $keyforelement='intervention'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_fields_array[$r]+=array(
'pj.ref'=>'ProjectRef','pj.title'=>'ProjectLabel',
'fd.rowid'=>'InterLineId',
'fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"
);
//$this->export_TypeFields_array[$r]=array(
@ -175,24 +180,30 @@ class modFicheinter extends DolibarrModules
// '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", 'pj.ref'=>'Text',
'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric"
's.rowid'=>"Numeric",'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.rowid'=>'Numeric','f.ref'=>"Text",'f.datec'=>"Date",
'f.duree'=>"Duree",'f.fk_statut'=>'Numeric','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",
'pj.ref'=>'Text','pj.title'=>'Text',
'fd.rowid'=>"Numeric",'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",
'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'pj.title'=>'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
$keyforselect='fichinterdet'; $keyforelement='inter_line'; $keyforaliasextra='extradet';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter_extrafields as extra ON f.rowid = extra.fk_object';
$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] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet_extrafields as extradet ON fd.rowid = extradet.fk_object,';
$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').')';

View File

@ -1198,7 +1198,7 @@ if ($step == 5 && $datatoexport)
}
}
}
print '<td>'.(! empty($list)?$list:$langs->trans("None")).'</td>';
print '<td>'.(! empty($list)?$list:'<span class="opacitymedium">'.$langs->trans("None").'</span>').'</td>';
print '</tr>';
}

View File

@ -1271,12 +1271,12 @@ elseif ($id > 0 || ! empty($ref))
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Contract');
print '</td>';
if ($action != 'contrat')
{
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=contrat&amp;id='.$object->id.'">';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=contrat&amp;id='.$object->id.'">';
print img_edit($langs->trans('SetContract'), 1);
print '</a></td>';
}

View File

@ -701,51 +701,36 @@ class Fichinter extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the label of a statut
* Returns the label of a status
*
* @param int $statut id statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// Init/load array of translation of status
if (empty($this->statuts) || empty($this->statuts_short))
if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo))
{
global $langs;
$langs->load("fichinter");
$this->statuts[0]=$langs->trans('Draft');
$this->statuts[1]=$langs->trans('Validated');
$this->statuts[2]=$langs->trans('StatusInterInvoiced');
$this->statuts[3]=$langs->trans('Done');
$this->statuts_short[0]=$langs->trans('Draft');
$this->statuts_short[1]=$langs->trans('Validated');
$this->statuts_short[2]=$langs->trans('StatusInterInvoiced');
$this->statuts_short[3]=$langs->trans('Done');
$this->statuts_logo[0]='statut0';
$this->statuts_logo[1]='statut1';
$this->statuts_logo[2]='statut6';
$this->statuts_logo[3]='statut6';
$this->statuts[self::STATUS_DRAFT]=$langs->trans('Draft');
$this->statuts[self::STATUS_VALIDATED]=$langs->trans('Validated');
$this->statuts[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
$this->statuts[self::STATUS_CLOSED]=$langs->trans('Done');
$this->statuts_short[self::STATUS_DRAFT]=$langs->trans('Draft');
$this->statuts_short[self::STATUS_VALIDATED]=$langs->trans('Validated');
$this->statuts_short[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
$this->statuts_short[self::STATUS_CLOSED]=$langs->trans('Done');
$this->statuts_logo[self::STATUS_DRAFT]='status0';
$this->statuts_logo[self::STATUS_VALIDATED]='status1';
$this->statuts_logo[self::STATUS_BILLED]='status6';
$this->statuts_logo[self::STATUS_CLOSED]='status6';
}
if ($mode == 0)
return $this->statuts[$statut];
elseif ($mode == 1)
return $this->statuts_short[$statut];
elseif ($mode == 2)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts_short[$statut];
elseif ($mode == 3)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]);
elseif ($mode == 4)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts[$statut];
elseif ($mode == 5)
return '<span class="hideonsmartphone">'.$this->statuts_short[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
elseif ($mode == 6)
return '<span class="hideonsmartphone">'.$this->statuts[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
return '';
return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode);
}
/**

View File

@ -60,6 +60,7 @@ InterDateCreation=Date creation intervention
InterDuration=Duration intervention
InterStatus=Status intervention
InterNote=Note intervention
InterLine=Line of intervention
InterLineId=Line id intervention
InterLineDate=Line date intervention
InterLineDuration=Line duration intervention

View File

@ -79,6 +79,7 @@ NoTrigger=No trigger
NoWidget=No widget
GoToApiExplorer=Go to API explorer
ListOfMenusEntries=List of menu entries
ListOfDictionariesEntries=List of dictionaries entries
ListOfPermissionsDefined=List of defined permissions
SeeExamples=See examples here
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
@ -88,8 +89,10 @@ SearchAllDesc=Is the field used to make a search from the quick search tool? (Ex
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
MenusDefDesc=Define here the menus provided by your module
DictionariesDefDesc=Define here the dictionaries provided by your module
PermissionsDefDesc=Define here the new permissions provided by your module
MenusDefDescTooltip=The menus provided by your module/application are defined into the array <strong>$this->menus</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array <strong>$this->dictionaries</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s.
PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array <strong>$this->rights</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.

View File

@ -1652,6 +1652,11 @@ elseif (! empty($module))
$head2[$h][2] = 'languages';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread?'@'.$dirread:'');
$head2[$h][1] = $langs->trans("Dictionaries");
$head2[$h][2] = 'dictionaries';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'');
$head2[$h][1] = $langs->trans("Objects");
$head2[$h][2] = 'objects';
@ -1945,6 +1950,139 @@ elseif (! empty($module))
}
}
if ($tab == 'dictionaries')
{
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$dicts = $moduleobj->dictionaries;
if ($action != 'editfile' || empty($file))
{
print '<span class="opacitymedium">';
$htmlhelp=$langs->trans("DictionariesDefDescTooltip", '<a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').'</a>');
print $form->textwithpicto($langs->trans("DictionariesDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'<br>';
print '</span>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> <strong>'.$dicts['langs'].'</strong><br>';
print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addproperty">';
print '<input type="hidden" name="tab" value="objects">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Table", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SQL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SQLSort", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("FieldsView", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("FieldsEdit", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("FieldsInsert", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Rowid", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Condition", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print "</tr>\n";
if (is_array($dicts))
{
$i = 0;
$maxi = count($dicts['tabname']);
while ($i < $maxi)
{
print '<tr class="oddeven">';
print '<td>';
print ($i + 1);
print '</td>';
print '<td>';
print $dicts['tabname'][$i];
print '</td>';
print '<td>';
print $dicts['tablib'][$i];
print '</td>';
print '<td>';
print $dicts['tabsql'][$i];
print '</td>';
print '<td>';
print $dicts['tabsqlsort'][$i];
print '</td>';
print '<td>';
print $dicts['tabfield'][$i];
print '</td>';
print '<td>';
print $dicts['tabfieldvalue'][$i];
print '</td>';
print '<td>';
print $dicts['tabfieldinsert'][$i];
print '</td>';
print '<td class="right">';
print $dicts['tabrowid'][$i];
print '</td>';
print '<td class="right">';
print $dicts['tabcond'][$i];
print '</td>';
print '</tr>';
$i++;
}
}
else
{
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
print '</div>';
print '</form>';
}
else
{
$fullpathoffile=dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile);
// New module
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="savefile">';
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
print '<input type="hidden" name="tab" value="'.$tab.'">';
print '<input type="hidden" name="module" value="'.$module.'">';
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html'));
print '<br>';
print '<center>';
print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</center>';
print '</form>';
}
}
if ($tab == 'objects')
{
$head3 = array();

View File

@ -183,25 +183,25 @@ class modMyModule extends DolibarrModules
$this->dictionaries=array();
/* Example:
$this->dictionaries=array(
'langs'=>'mylangfile@mymodule',
'langs'=>'mymodule@mymodule',
// List of tables we want to see into dictonnary editor
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"),
'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
// Label of tables
'tablib'=>array("Table1","Table2","Table3"),
'tablib'=>array("Table1", "Table2", "Table3"),
// Request to select fields
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
// Sort order
'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
// List of fields (result of select to show dictionary)
'tabfield'=>array("code,label","code,label","code,label"),
'tabfield'=>array("code,label", "code,label", "code,label"),
// List of fields (list of fields to edit a record)
'tabfieldvalue'=>array("code,label","code,label","code,label"),
'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
// List of fields (list of fields for insert)
'tabfieldinsert'=>array("code,label","code,label","code,label"),
'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
// Name of columns with primary key (try to always name it 'rowid')
'tabrowid'=>array("rowid","rowid","rowid"),
'tabrowid'=>array("rowid", "rowid", "rowid"),
// Condition to show each dictionary
'tabcond'=>array($conf->mymodule->enabled,$conf->mymodule->enabled,$conf->mymodule->enabled)
'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled)
);
*/