Skip to content

Commit

Permalink
Merge branch 'develop' into 7.0_new_shipment_update
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 2, 2017
2 parents 28604b4 + f5e1ca3 commit feb04b4
Show file tree
Hide file tree
Showing 810 changed files with 4,098 additions and 2,419 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Expand Up @@ -5,6 +5,7 @@ English Dolibarr ChangeLog


***** ChangeLog for 7.0.0 compared to 6.0.* *****
For users:

For developers:
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
Expand Down Expand Up @@ -42,8 +43,7 @@ FIX: API to get object does not return data of linked objects
FIX: Bad localtax apply
FIX: Bad ressource list in popup in gantt view
FIX: bankentries search conciliated if val 0
FIX: hook formObjectOptions() must use $expe and not $object which i…
FIX: hook formObjectOptions() must use $expe and not $object which is an order here
FIX: hook formObjectOptions() must use $expe and not $object
FIX: make of link to other object during creation
FIX: Missing function getLinesArray
FIX: old batch not shown in multi shipping
Expand Down
4 changes: 4 additions & 0 deletions build/makepack-dolibarr.pl
Expand Up @@ -571,6 +571,7 @@
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
Expand All @@ -579,6 +580,7 @@
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
Expand All @@ -590,6 +592,8 @@
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;


print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
Expand Down
418 changes: 305 additions & 113 deletions htdocs/accountancy/bookkeeping/list.php

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions htdocs/accountancy/class/bookkeeping.class.php
Expand Up @@ -564,7 +564,8 @@ public function fetch($id, $ref = null, $mode='') {
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num";
$sql .= " t.piece_num,";
$sql .= " t.date_creation";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
Expand Down Expand Up @@ -603,6 +604,7 @@ public function fetch($id, $ref = null, $mode='') {
$this->code_journal = $obj->code_journal;
$this->journal_label = $obj->journal_label;
$this->piece_num = $obj->piece_num;
$this->date_creation = $this->db->jdate($obj->date_creation);
}
$this->db->free($resql);

Expand Down Expand Up @@ -658,7 +660,8 @@ public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0,
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num";
$sql .= " t.piece_num,";
$sql .= " t.date_creation";
// Manage filter
$sqlwhere = array ();
if (count($filter) > 0) {
Expand All @@ -675,6 +678,8 @@ public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0,
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.label_operation') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
Expand Down Expand Up @@ -725,6 +730,7 @@ public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0,
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;

$this->lines[] = $line;
}
Expand Down Expand Up @@ -777,7 +783,8 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num";
$sql .= " t.piece_num,";
$sql .= " t.date_creation";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter
$sqlwhere = array ();
Expand All @@ -793,6 +800,10 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
Expand Down Expand Up @@ -841,6 +852,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;

$this->lines[] = $line;
}
Expand Down Expand Up @@ -1336,6 +1348,7 @@ public function initAsSpecimen() {
$this->code_journal = 'VT';
$this->journal_label = 'Journal de vente';
$this->piece_num = '';
$this->date_creation = $now;
}

/**
Expand All @@ -1348,7 +1361,7 @@ public function initAsSpecimen() {
public function fetchPerMvt($piecenum, $mode='') {
global $conf;

$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type";
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
$sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
Expand All @@ -1364,6 +1377,7 @@ public function fetchPerMvt($piecenum, $mode='') {
$this->doc_date = $this->db->jdate($obj->doc_date);
$this->doc_ref = $obj->doc_ref;
$this->doc_type = $obj->doc_type;
$this->date_creation = $obj->date_creation;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
Expand Down Expand Up @@ -1414,7 +1428,7 @@ function fetchAllPerMvt($piecenum, $mode='') {
$sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
$sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
Expand Down Expand Up @@ -1447,6 +1461,7 @@ function fetchAllPerMvt($piecenum, $mode='') {
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;

$this->linesmvt[] = $line;
}
Expand Down Expand Up @@ -1785,4 +1800,5 @@ class BookKeepingLine
public $code_journal;
public $journal_label;
public $piece_num;
public $date_creation;
}
53 changes: 39 additions & 14 deletions htdocs/admin/agenda.php
Expand Up @@ -38,6 +38,7 @@
$action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');

$search_event = GETPOST('search_event', 'alpha');

// Get list of triggers available
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
Expand Down Expand Up @@ -70,6 +71,12 @@
* Actions
*/

// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_event = '';
}

if ($action == "save" && empty($cancel))
{
$i=0;
Expand All @@ -78,10 +85,13 @@

foreach ($triggers as $trigger)
{
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
$keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
//print "param=".$param." - ".$_POST[$param];
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $keyparam))
{
$res = dolibarr_set_const($db,$keyparam,(GETPOST($keyparam,'alpha')?GETPOST($keyparam,'alpha'):''),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}

if (! $error)
Expand Down Expand Up @@ -140,6 +150,8 @@
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">';

$param = '';
$param.= '&search_event='.urlencode($search_event);

$head=agenda_prepare_head();

Expand All @@ -151,8 +163,19 @@

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '</tr>'."\n";
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("ActionsEvents").'</th>';
print '<th class="liste_titre"></th>';
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
print '</tr>'."\n";
// Show each trigger (list is in c_action_trigger)
if (! empty($triggers))
Expand All @@ -173,15 +196,17 @@
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;


print '<tr class="oddeven">';
print '<td>'.$trigger['code'].'</td>';
print '<td>'.$trigger['label'].'</td>';
print '<td align="right" width="40">';
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
$value=$conf->global->$key;
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
print '</td></tr>'."\n";
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $trigger['code']))
{
print '<tr class="oddeven">';
print '<td>'.$trigger['code'].'</td>';
print '<td>'.$trigger['label'].'</td>';
print '<td align="right" width="40">';
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
$value=$conf->global->$key;
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
print '</td></tr>'."\n";
}
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions htdocs/admin/agenda_other.php
Expand Up @@ -352,6 +352,15 @@
}
print '</td></tr>'."\n";

// AGENDA_DEFAULT_VIEW
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";

if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{

Expand Down Expand Up @@ -381,15 +390,6 @@
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
print '</td></tr>'."\n";

// AGENDA_DEFAULT_VIEW
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";

print '</table>';

dol_fiche_end();
Expand Down
34 changes: 19 additions & 15 deletions htdocs/admin/translation.php
Expand Up @@ -403,6 +403,9 @@

$recordtoshow=array();

// Search modules dirs
$modulesdir = dolGetModulesDirs();

$nbempty=0;
/*var_dump($langcode);
var_dump($transkey);
Expand All @@ -416,22 +419,23 @@
}
else
{
// Load all translations keys
foreach($conf->file->dol_document_root as $keydir => $searchdir)
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
foreach($modulesdir as $keydir => $tmpsearchdir)
{
// Directory of translation files
$dir_lang = $searchdir."/langs/".$langcode;
$dir_lang_osencoded=dol_osencode($dir_lang);

$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);

foreach($filearray as $file)
{
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
}
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'

// Directory of translation files
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
$dir_lang_osencoded=dol_osencode($dir_lang);

$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
foreach($filearray as $file)
{
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
}
}

// Now search into translation array
Expand Down
25 changes: 19 additions & 6 deletions htdocs/api/index.php
Expand Up @@ -128,7 +128,7 @@
foreach ($modulesdir as $dir)
{
// Search available module
dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files");
dol_syslog("Scan directory ".$dir." for module descriptor files, then search for API files");

$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
Expand All @@ -140,13 +140,13 @@
$module = strtolower($regmod[1]);
$moduledirforclass = getModuleDirForApiClass($module);
$modulenameforenabled = $module;
if ($module == 'propale') { $moduleforenabled='propal'; }
if ($module == 'propale') { $modulenameforenabled='propal'; }

//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);

// Defined if module is enabled
$enabled=true;
if (empty($conf->$moduleforenabled->enabled)) $enabled=false;
if (empty($conf->$modulenameforenabled->enabled)) $enabled=false;

if ($enabled)
{
Expand Down Expand Up @@ -235,7 +235,13 @@
if ($module == 'order') { $classname='Commande'; }
//var_dump($classfile);var_dump($classname);exit;

require_once $dir_part_file;
$res = include_once $dir_part_file;
if (! $res)
{
print 'API not found (failed to include API file)';
header('HTTP/1.1 501 API not found (failed to include API file)');
exit(0);
}
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
}
else
Expand All @@ -247,7 +253,14 @@
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module);

require_once $dir_part_file;
$res = include_once $dir_part_file;
if (! $res)
{
print 'API not found (failed to include API file)';
header('HTTP/1.1 501 API not found (failed to include API file)');
exit(0);
}

if (class_exists($classname)) $api->r->addAPIClass($classname);
}
}
Expand Down

0 comments on commit feb04b4

Please sign in to comment.