Merge remote-tracking branch 'upstream/develop' into 10.0_closure2
This commit is contained in:
commit
be1eb7829e
@ -28,6 +28,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming
|
||||
convention of extension .inc.php for files to be included.
|
||||
* All methods set_draft() were renamed into setDraft().
|
||||
* Signatures of methods createFromClone() has been standardized. All methods requires the object User as first parameter.
|
||||
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
|
||||
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
|
||||
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@ -53,26 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (! empty($lettering)) {
|
||||
$action = $lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_year = '';
|
||||
$search_doc_type = '';
|
||||
/*
|
||||
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_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
}
|
||||
*/
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", 'int');
|
||||
@ -102,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@ -111,9 +118,9 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -136,19 +143,17 @@ dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'n
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||
/*
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
||||
}
|
||||
*/
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -190,83 +195,110 @@ if ($resql) {
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
//$letteringbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=lettering" value="lettering" name="lettering" id="lettering"><span class="valignmiddle">' . $langs->trans("Lettering") . '</span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="center">' . $obj->code_journal . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@ -53,27 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (!empty($lettering)) {
|
||||
$action=$lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha'))
|
||||
/*
|
||||
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_year='';
|
||||
$search_doc_type='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type='';
|
||||
$search_doc_ref='';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Security check
|
||||
@ -103,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@ -112,7 +118,7 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -142,10 +148,8 @@ $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
||||
}
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
@ -190,32 +194,52 @@ if ($resql) {
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -225,48 +249,53 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="center">' . $obj->code_journal . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="' . $langs->trans('AccountancyLettering') . '" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -1409,16 +1409,14 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
$object = new BookKeeping($this->db);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -66,13 +66,13 @@ class Lettering extends BookKeeping
|
||||
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE ( ";
|
||||
$sql .= " WHERE ( ";
|
||||
if (! empty($object->code_compta))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
if (! empty($object->code_compta_fournisseur))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||
@ -128,15 +128,15 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND facf.entity = ".$conf->entity;
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
$sql .= ") ";
|
||||
|
||||
$resql2 = $this->db->query($sql);
|
||||
if ($resql2) {
|
||||
@ -253,7 +253,7 @@ class Lettering extends BookKeeping
|
||||
$error++;
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -82,7 +82,7 @@ if (! empty($canvas))
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas);
|
||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
@ -163,10 +163,10 @@ if (empty($reshook))
|
||||
$error=0;
|
||||
if (! $error)
|
||||
{
|
||||
if ($socid != $object->fk_soc) // If link differs from currently in database
|
||||
if ($socid != $object->socid) // If link differs from currently in database
|
||||
{
|
||||
$sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.=" WHERE fk_soc = '".$socid."'";
|
||||
$sql.=" WHERE socid = '".$socid."'";
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -492,7 +492,7 @@ if (empty($reshook))
|
||||
//$object->note = $comment;
|
||||
$object->morphy = $morphy;
|
||||
$object->user_id = $userid;
|
||||
$object->fk_soc = $socid;
|
||||
$object->socid = $socid;
|
||||
$object->public = $public;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -1333,10 +1333,10 @@ else
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
|
||||
if ($object->fk_soc)
|
||||
if ($object->socid)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
$result=$company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@ -1421,7 +1421,7 @@ else
|
||||
$text=$langs->trans("ConfirmCreateLogin").'<br>';
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser");
|
||||
if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser");
|
||||
else $text.=$langs->trans("UserWillBeInternalUser");
|
||||
}
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
||||
@ -1688,17 +1688,17 @@ else
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $form->select_company($object->fk_soc, 'socid', '', 1);
|
||||
print $form->select_company($object->socid, 'socid', '', 1);
|
||||
print '</td>';
|
||||
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->fk_soc)
|
||||
if ($object->socid)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($object->fk_soc);
|
||||
$result=$company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@ -1848,7 +1848,7 @@ else
|
||||
}
|
||||
|
||||
// Create third party
|
||||
if (! empty($conf->societe->enabled) && ! $object->fk_soc)
|
||||
if (! empty($conf->societe->enabled) && ! $object->socid)
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.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
|
||||
@ -557,7 +558,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||
$sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null");
|
||||
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
@ -1223,7 +1224,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
@ -1267,7 +1268,11 @@ class Adherent extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->civility_id = $obj->civility_id;
|
||||
|
||||
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
|
||||
$this->civility_code = $obj->civility_code;
|
||||
$this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):'';
|
||||
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->gender = $obj->gender;
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2019 Thibault Foucart <support@ptibogxiv.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
|
||||
@ -64,6 +65,11 @@ class AdherentType extends CommonObject
|
||||
* @var string Adherent type label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* @var string Adherent type nature
|
||||
*/
|
||||
public $morphy;
|
||||
|
||||
/**
|
||||
* @var int Subsription required (0 or 1)
|
||||
@ -184,6 +190,7 @@ class AdherentType extends CommonObject
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
||||
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
|
||||
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
@ -274,7 +281,7 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@ -290,6 +297,7 @@ class AdherentType extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->label = $obj->label;
|
||||
$this->morphy = $obj->morphy;
|
||||
$this->statut = $obj->statut;
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
@ -402,6 +410,21 @@ class AdherentType extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return translated label by the nature of a adherent (physical or moral)
|
||||
*
|
||||
* @param string $morphy Nature of the adherent (physical or moral)
|
||||
* @return string Label
|
||||
*/
|
||||
public function getmorphylib($morphy = '')
|
||||
{
|
||||
global $langs;
|
||||
if ($morphy == 'phy') { return $langs->trans("Physical"); }
|
||||
elseif ($morphy == 'mor') { return $langs->trans("Moral"); }
|
||||
else return $langs->trans("Physical & Morale");
|
||||
//return $morphy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.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
|
||||
@ -668,7 +669,7 @@ if ($rowid > 0)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
|
||||
$sql.= " c.rowid as crowid, c.subscription,";
|
||||
$sql.= " c.datec,";
|
||||
$sql.= " c.datec, c.fk_type as cfk_type,";
|
||||
$sql.= " c.dateadh as dateh,";
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.fk_bank,";
|
||||
@ -693,6 +694,7 @@ if ($rowid > 0)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td class="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td class="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
||||
@ -703,6 +705,7 @@ if ($rowid > 0)
|
||||
print "</tr>\n";
|
||||
|
||||
$accountstatic=new Account($db);
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -711,9 +714,20 @@ if ($rowid > 0)
|
||||
$subscriptionstatic->ref=$objp->crowid;
|
||||
$subscriptionstatic->id=$objp->crowid;
|
||||
|
||||
if ($objp->cfk_type > 0)
|
||||
{
|
||||
$adht->fetch($objp->cfk_type);
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datec), 'dayhour')."</td>\n";
|
||||
print '<td class="center">';
|
||||
if ($objp->cfk_type > 0)
|
||||
{
|
||||
print $adht->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
|
||||
print '<td class="right">'.price($objp->subscription).'</td>';
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.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
|
||||
@ -57,6 +58,7 @@ if (! $sortorder) { $sortorder="DESC"; }
|
||||
if (! $sortfield) { $sortfield="d.lastname"; }
|
||||
|
||||
$label=GETPOST("label", "alpha");
|
||||
$morphy=GETPOST("morphy", "alpha");
|
||||
$statut=GETPOST("statut", "int");
|
||||
$subscription=GETPOST("subscription", "int");
|
||||
$vote=GETPOST("vote", "int");
|
||||
@ -103,6 +105,7 @@ if ($cancel) {
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->note = trim($comment);
|
||||
@ -157,6 +160,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->note = trim($comment);
|
||||
@ -215,7 +219,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
//dol_fiche_head('');
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut, d.morphy";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql.= " WHERE d.entity IN (".getEntity('member_type').")";
|
||||
|
||||
@ -256,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Ref").'</th>';
|
||||
print '<th>'.$langs->trans("Label").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Nature").'</th>';
|
||||
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
|
||||
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Status").'</th>';
|
||||
@ -277,6 +282,11 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td class="center">';
|
||||
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
|
||||
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
|
||||
else print $langs->trans("Physical & Morale");
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">';
|
||||
@ -330,6 +340,14 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("Physical & Morale");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
print '<tr><td><span>'.$langs->trans("Nature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription", 1, 1);
|
||||
@ -411,6 +429,10 @@ if ($rowid > 0)
|
||||
print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased");
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print yn($object->subscription);
|
||||
@ -751,6 +773,14 @@ if ($rowid > 0)
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut);
|
||||
print '</td></tr>';
|
||||
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("Physical & Morale");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
print '<tr><td><span>'.$langs->trans("Nature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription", $object->subscription, 1);
|
||||
|
||||
@ -251,6 +251,7 @@ print '<tr class="liste_titre">';
|
||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
|
||||
$texthelp.='<br><br>'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
|
||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||
print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
|
||||
// Field
|
||||
|
||||
@ -652,6 +652,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
if ($fieldnamekey == 'revenuestamp_type') $fieldnamekey = 'TypeOfRevenueStamp';
|
||||
if ($fieldnamekey == 'use_default') $fieldnamekey = 'UseByDefault';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -1053,11 +1054,12 @@ if ($id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
// Define field friedly name from its technical name
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class='';
|
||||
|
||||
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='width100'; }
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
@ -1125,6 +1127,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field]=='use_default') { $valuetoshow=$langs->trans('Default'); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1197,8 +1200,10 @@ if ($id)
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
|
||||
@ -1221,7 +1226,7 @@ if ($id)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Title line with search boxes
|
||||
// Title line with search input fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
$filterfound=0;
|
||||
foreach ($fieldlist as $field => $value)
|
||||
@ -1276,17 +1281,12 @@ if ($id)
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$align="left";
|
||||
$cssprefix='';
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
|
||||
// Special cases
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
@ -1304,10 +1304,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='position') { $align='right'; }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='libelle_facture') {
|
||||
//$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
|
||||
$valuetoshow=$langs->trans("LabelOnDocuments");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
@ -1316,7 +1313,6 @@ if ($id)
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
@ -1347,11 +1343,14 @@ if ($id)
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field]=='use_default') { $valuetoshow=$langs->trans('Default'); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
|
||||
// Show field title
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
@ -1806,7 +1805,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if (in_array('region_id', $fieldlist))
|
||||
{
|
||||
print '<td>';
|
||||
//print join(',',$fieldlist);
|
||||
print '</td>';
|
||||
continue;
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
@ -1912,7 +1910,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td class="maxxxx"><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
@ -1972,12 +1970,8 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
$classtd=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $classtd='width100';
|
||||
if ($fieldlist[$field]=='affect') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='delay') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $class='maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent';
|
||||
print '<td class="'.$classtd.'">';
|
||||
$transfound=0;
|
||||
if (in_array($fieldlist[$field], array('label','libelle')))
|
||||
|
||||
@ -17,7 +17,10 @@
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
if (! class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors.
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -48,6 +48,8 @@ $cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$operationid = GETPOST('operationid', 'int');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new EmailCollector($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -64,6 +66,7 @@ foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
|
||||
if (GETPOST('saveoperation2')) $action = 'updateoperation';
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
||||
|
||||
// Load object
|
||||
@ -165,6 +168,24 @@ if (GETPOST('addoperation', 'alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'updateoperation')
|
||||
{
|
||||
$emailcollectoroperation = new EmailCollectorAction($db);
|
||||
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
|
||||
|
||||
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'none');
|
||||
|
||||
$result = $emailcollectoroperation->update($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->fetchActions();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
}
|
||||
}
|
||||
if ($action == 'deleteoperation')
|
||||
{
|
||||
$emailcollectoroperation = new EmailCollectorAction($db);
|
||||
@ -452,19 +473,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$arrayoftypes=array(
|
||||
'from'=>array('label'=>'MailFrom', 'data-placeholder'=>'SearchString'),
|
||||
'to'=>array('label'=>'MailTo', 'data-placeholder'=>'SearchString'),
|
||||
'cc'=>array('label'=>'Cc', 'data-placeholder'=>'SearchString'),
|
||||
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>'SearchString'),
|
||||
'subject'=>array('label'=>'Subject', 'data-placeholder'=>'SearchString'),
|
||||
'body'=>array('label'=>'Body', 'data-placeholder'=>'SearchString'),
|
||||
'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
|
||||
'X1'=>'---',
|
||||
'from'=>array('label'=>'MailFrom', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')),
|
||||
// disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2
|
||||
//'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
|
||||
//'X1'=>'---',
|
||||
//'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'),
|
||||
//'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'),
|
||||
'X2'=>'---',
|
||||
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
|
||||
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
|
||||
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>'NumberOfBytes'),
|
||||
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>'NumberOfBytes'),
|
||||
'X2'=>'---',
|
||||
'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1),
|
||||
'answered'=>array('label'=>'Answered', 'data-noparam'=>1),
|
||||
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
|
||||
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
|
||||
'X3'=>'---',
|
||||
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
|
||||
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1)
|
||||
);
|
||||
@ -530,7 +557,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
'recordevent'=>'RecordEvent');
|
||||
if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
|
||||
if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty';
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="operationparam">';
|
||||
$htmltext=$langs->transnoentitiesnoconv("OperationParamDesc");
|
||||
@ -558,7 +585,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$ruleaction['actionparam'].'</td>';
|
||||
print '<td>';
|
||||
if ($action == 'editoperation' && $ruleaction['id'] == $operationid)
|
||||
{
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
|
||||
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>';
|
||||
print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $ruleaction['actionparam'];
|
||||
}
|
||||
print '</td>';
|
||||
// Move up/down
|
||||
print '<td class="center linecolmove tdlineupdown">';
|
||||
if ($i > 0)
|
||||
@ -571,6 +609,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
// Delete
|
||||
print '<td class="right">';
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editoperation&operationid='.$ruleaction['id'].'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -604,11 +644,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Edit") . '</a>' . "\n";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Edit") . '</a></div>';
|
||||
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=collect">' . $langs->trans("CollectNow") . '</a>' . "\n";
|
||||
// Clone
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
|
||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a>' . "\n";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=collect">' . $langs->trans("CollectNow") . '</a></div>';
|
||||
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
print '</div>' . "\n";
|
||||
}
|
||||
|
||||
@ -76,9 +76,7 @@ elseif ($action == 'update_currency')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$submit = GETPOST('submit', 'alpha');
|
||||
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
if (GETPOST('updatecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
@ -97,7 +95,7 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($submit == $langs->trans('Delete'))
|
||||
elseif (GETPOST('deletecurrency', 'alpha'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$currency = new MultiCurrency($db);
|
||||
@ -109,9 +107,18 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'synchronize')
|
||||
elseif ($action == 'setapilayer')
|
||||
{
|
||||
MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
|
||||
if (GETPOSTISSET('modify_apilayer'))
|
||||
{
|
||||
dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'));
|
||||
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
|
||||
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -177,17 +184,20 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Online payment with currency on document
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useCurrency").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
|
||||
// Online payment with currency on document. This option should be on by default.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
/* TODO uncomment when the functionality will integrated
|
||||
|
||||
@ -224,59 +234,48 @@ print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" id="form_sync">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setapilayer">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).'</td>'."\n";
|
||||
print '<td class="right">';
|
||||
print '<form id="form_sync" action="" method="POST">';
|
||||
print '<input type="hidden" name="action" value="synchronize" />';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print $langs->trans("Value").' <input type="button" id="bt_sync" class="button" onclick="javascript:getRates();" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
$urlforapilayer='https://currencylayer.com'; //https://apilayer.net
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).'</td>'."\n";
|
||||
print '<td class="right">';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print '<input type="submit" name="modify_apilayer" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" id="bt_sync" name="bt_sync_apilayer" class="button" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td class="fieldrequired"><a target="_blank" href="'.$urlforapilayer.'">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_ID">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_SOURCE" value="'.$conf->global->MULTICURRENCY_APP_SOURCE.'" size="10" placeholder="USD" /> '; // Default: USD
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_ALTERNATE_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_ALTERNATE_SOURCE" value="'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE.'" size="10" placeholder="EUR" /> '; // Example: EUR
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -287,15 +286,17 @@ print '<td align="center">'.$langs->trans("Rate").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code').'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_currency">';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('Rate').'" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -316,8 +317,8 @@ foreach ($TCurrency as &$currency)
|
||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||
print '1 '.$conf->currency.' = ';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> '.$currency->code.' ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -330,15 +331,7 @@ print '
|
||||
function getRates()
|
||||
{
|
||||
$("#bt_sync").attr("disabled", true);
|
||||
var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'";
|
||||
|
||||
$.ajax({
|
||||
url: url_sync,
|
||||
dataType: "jsonp"
|
||||
}).done(function(response) {
|
||||
$("#response").val(JSON.stringify(response));
|
||||
$("#form_sync").submit();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
@ -50,7 +50,7 @@ if (! $user->admin)
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
|
||||
@ -133,7 +133,8 @@ if ($what == 'mysql')
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
foreach($arrayofallowedcommand as $allowedcommand)
|
||||
{
|
||||
if (preg_match('/'.preg_quote($allowedcommand, '/').'/', $cmddump))
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$ok=1;
|
||||
break;
|
||||
|
||||
@ -216,7 +216,7 @@ class DolibarrApi
|
||||
*
|
||||
* @param string $resource element to check
|
||||
* @param int $resource_id Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||
* @param type $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
|
||||
@ -234,12 +234,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
|
||||
$classname = ucwords($module);
|
||||
|
||||
dol_syslog('Search /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
|
||||
dol_syslog('Search api file /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
|
||||
|
||||
$res = false;
|
||||
if ($dir_part_file)
|
||||
$res = include_once $dir_part_file;
|
||||
if (! $res) {
|
||||
dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
|
||||
print 'API not found (failed to include API file)';
|
||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
||||
exit(0);
|
||||
|
||||
@ -28,21 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||
*/
|
||||
|
||||
/**
|
||||
* API class for bom bom
|
||||
* API class for bom
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class BOMs extends DolibarrApi
|
||||
class Boms extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'label'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @var BOM $bom {@type BOM}
|
||||
*/
|
||||
@ -71,16 +63,16 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->read) {
|
||||
if (! DolibarrApiAccess::$user->rights->bom->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->bom->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -107,33 +99,33 @@ class BOMs extends DolibarrApi
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
$tmpobject = new BOM($db);
|
||||
|
||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
||||
|
||||
$restictonsocid = 0; // Set to 1 if there is a field socid in table of object
|
||||
$restrictonsocid = 0; // Set to 1 if there is a field socid in table of object
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if ($restrictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_mytable as t";
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
|
||||
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= " WHERE 1 = 1";
|
||||
|
||||
// Example of use $mode
|
||||
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
||||
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
||||
|
||||
$tmpobject = new BOM($db);
|
||||
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
|
||||
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
|
||||
if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($restrictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
|
||||
if ($restrictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($restictonsocid && $search_sale > 0)
|
||||
if ($restrictonsocid && $search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
@ -190,7 +182,7 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->create) {
|
||||
if(! DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
@ -215,7 +207,7 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->bom->create) {
|
||||
if(! DolibarrApiAccess::$user->rights->bom->write) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -224,7 +216,7 @@ class BOMs extends DolibarrApi
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -239,7 +231,7 @@ class BOMs extends DolibarrApi
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $this->commande->error);
|
||||
throw new RestException(500, $this->bom->error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +251,7 @@ class BOMs extends DolibarrApi
|
||||
throw new RestException(404, 'BOM not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -309,12 +301,13 @@ class BOMs extends DolibarrApi
|
||||
*/
|
||||
private function _validate($data)
|
||||
{
|
||||
$bom = array();
|
||||
foreach (BOMs::$FIELDS as $field) {
|
||||
$myobject = array();
|
||||
foreach ($this->myobject->fields as $field => $propfield) {
|
||||
if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$bom[$field] = $data[$field];
|
||||
$myobject[$field] = $data[$field];
|
||||
}
|
||||
return $bom;
|
||||
return $myobject;
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,8 +391,11 @@ class Categories extends DolibarrApi
|
||||
} elseif ($type == 'contact') {
|
||||
$objects_api = new Contacts();
|
||||
}
|
||||
foreach ($objects as $obj) {
|
||||
$cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
|
||||
if (is_object($objects_api))
|
||||
{
|
||||
foreach ($objects as $obj) {
|
||||
$cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
|
||||
}
|
||||
}
|
||||
|
||||
return $cleaned_objects;
|
||||
|
||||
@ -164,7 +164,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
reset($object->socpeopleassigned);
|
||||
$object->contactid = key($object->socpeopleassigned);
|
||||
}
|
||||
$result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid'));
|
||||
$result = $object->createFromClone($user, GETPOST('fk_userowner'), GETPOST('socid'));
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
@ -903,7 +903,7 @@ if ($action == 'create')
|
||||
|
||||
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
$urloption='?action=create';
|
||||
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
|
||||
|
||||
@ -1301,7 +1301,7 @@ if ($id > 0)
|
||||
$numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0);
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -87,14 +87,14 @@ class ActionComm extends CommonObject
|
||||
* @var string Agenda event label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
|
||||
/**
|
||||
* Date creation record (datec)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $datec;
|
||||
|
||||
|
||||
/**
|
||||
* Date modification record (tms)
|
||||
*
|
||||
@ -129,14 +129,14 @@ class ActionComm extends CommonObject
|
||||
* @var int
|
||||
*/
|
||||
public $usermodid;
|
||||
|
||||
|
||||
/**
|
||||
* Date action start (datep)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $datep;
|
||||
|
||||
|
||||
/**
|
||||
* Date action end (datep2)
|
||||
*
|
||||
@ -281,6 +281,7 @@ class ActionComm extends CommonObject
|
||||
if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep;
|
||||
//if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
|
||||
if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0;
|
||||
// For backward compatibility
|
||||
if ($this->elementtype=='facture') $this->elementtype='invoice';
|
||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||
@ -504,13 +505,13 @@ class ActionComm extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param user $fuser Object user making action
|
||||
* @param User $fuser Object user making action
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fuser, $socid)
|
||||
public function createFromClone(User $fuser, $socid)
|
||||
{
|
||||
global $db, $user, $langs, $conf, $hookmanager;
|
||||
global $db, $conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
@ -529,20 +530,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->id=0;
|
||||
|
||||
if (!is_object($fuser))
|
||||
{
|
||||
if ($fuser > 0)
|
||||
{
|
||||
$u = new User($db);
|
||||
$u->fetch($fuser);
|
||||
$fuser = $u;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fuser = $user;
|
||||
}
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone']='createfromclone';
|
||||
$result=$this->create($fuser);
|
||||
|
||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->createFromClone($object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
|
||||
$result=$object->createFromClone($user, $object->id, $_REQUEST["clone_content"], $_REQUEST["clone_receivers"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
|
||||
@ -266,14 +266,15 @@ class Mailing extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param int $option1 1=Copy content, 0=Forget content
|
||||
* @param int $option2 Not used
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid, $option1, $option2)
|
||||
public function createFromClone(User $user, $fromid, $option1, $option2)
|
||||
{
|
||||
global $user,$langs;
|
||||
global $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->createFromClone($socid);
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
|
||||
@ -473,7 +473,7 @@ class Propal extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
@ -690,7 +690,7 @@ class Propal extends CommonObject
|
||||
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||
if (empty($type)) $type=0;
|
||||
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
@ -1226,12 +1226,13 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($socid = 0)
|
||||
public function createFromClone(User $user, $socid = 0)
|
||||
{
|
||||
global $user,$conf,$hookmanager;
|
||||
global $conf,$hookmanager;
|
||||
|
||||
dol_include_once('/projet/class/project.class.php');
|
||||
|
||||
|
||||
@ -968,6 +968,7 @@ if ($resql)
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -127,6 +128,8 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
|
||||
$db->begin();
|
||||
$discount->fk_facture_source=0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source
|
||||
// This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source
|
||||
$discount->fk_invoice_supplier_source=0;
|
||||
$res=$discount->delete($user);
|
||||
$newid1=$newdiscount1->create($user);
|
||||
$newid2=$newdiscount2->create($user);
|
||||
|
||||
@ -142,7 +142,7 @@ if (empty($reshook))
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||
$orig = clone $object;
|
||||
|
||||
$result=$object->createFromClone($socid);
|
||||
$result=$object->createFromClone($user, $socid);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
|
||||
@ -1070,10 +1070,11 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($socid = 0)
|
||||
public function createFromClone(User $user, $socid = 0)
|
||||
{
|
||||
global $conf, $user,$hookmanager;
|
||||
|
||||
|
||||
@ -269,13 +269,12 @@ class BankCateg // extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$object = new BankCateg($this->db);
|
||||
|
||||
@ -200,7 +200,7 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
||||
}
|
||||
|
||||
$result=$object->delete($user);
|
||||
var_dump($result);
|
||||
//var_dump($result);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
|
||||
@ -2894,7 +2894,7 @@ if ($action == 'create')
|
||||
{
|
||||
// First situation invoice
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input id="radio_situation invoice" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp='<input id="radio_situation" type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
|
||||
$tmp = $tmp.'<label for="radio_situation invoice" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>';
|
||||
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
@ -2949,7 +2949,23 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement") . '</label> ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
@ -4457,7 +4473,9 @@ elseif ($id > 0 || ! empty($ref))
|
||||
// Show global modifiers
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
if ($object->situation_cycle_ref && $object->statut == 0) {
|
||||
if ($object->situation_cycle_ref && $object->statut == 0)
|
||||
{
|
||||
print '<!-- Area to change globally the situation percent -->'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
|
||||
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '#updatealllines" method="POST">';
|
||||
@ -4473,38 +4491,19 @@ elseif ($id > 0 || ! empty($ref))
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td align="center" width="5"> </td>';
|
||||
}
|
||||
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
|
||||
print '<td class="right" width="50"> </td>';
|
||||
print '<td class="right" width="80"> </td>';
|
||||
if ($inputalsopricewithtax) print '<td class="right" width="80"> </td>';
|
||||
print '<td class="right" width="50"> </td>';
|
||||
print '<td class="right" width="50"> </td>';
|
||||
print '<td class="right" width="50">' . $langs->trans('Progress') . '</td>';
|
||||
if (! empty($conf->margin->enabled) && empty($user->societe_id))
|
||||
{
|
||||
print '<td class="margininfos right" width="80"> </td>';
|
||||
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $usercanreadallmargin) {
|
||||
print '<td class="margininfos right" width="50"> </td>';
|
||||
}
|
||||
}
|
||||
print '<td class="right" width="50"> </td>';
|
||||
print '<td class="minwidth500imp">' . $langs->trans('ModifyAllLines') . '</td>';
|
||||
print '<td class="right">' . $langs->trans('Progress') . '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td width="10"> </td>';
|
||||
print '<td width="10"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="nodrag nodrop">';
|
||||
// Adds a line numbering column
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td align="center" width="5"> </td>';
|
||||
print '<td align="center" width="5"> </td>';
|
||||
}
|
||||
print '<tr width="100%" class="nodrag nodrop">';
|
||||
print '<td> </td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '<td width="80"> </td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '<td width="50"> </td>';
|
||||
print '<td class="nowrap right"><input type="text" size="1" value="" name="all_progress">%</td>';
|
||||
print '<td colspan="4" class="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
|
||||
print '<td class="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -393,13 +393,12 @@ class PaymentTerm // extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new PaymentTerm($this->db);
|
||||
|
||||
@ -67,6 +67,11 @@ $confirm=GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoicelist';
|
||||
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
$_GET['optioncss'] = 'print';
|
||||
}
|
||||
|
||||
$lineid=GETPOST('lineid', 'int');
|
||||
$userid=GETPOST('userid', 'int');
|
||||
$search_product_category=GETPOST('search_product_category', 'int');
|
||||
@ -950,7 +955,12 @@ if ($resql)
|
||||
$totalpay = $facturestatic->total_ttc - $remaintopay;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven"';
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();});"';
|
||||
}
|
||||
print '>';
|
||||
if (! empty($arrayfields['f.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
@ -958,7 +968,14 @@ if ($resql)
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||
if ($contextpage == 'poslist')
|
||||
{
|
||||
print $obj->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||
}
|
||||
print empty($obj->increment)?'':' ('.$obj->increment.')';
|
||||
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
|
||||
@ -346,15 +346,14 @@ class Cchargesociales
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Cchargesociales($this->db);
|
||||
|
||||
|
||||
@ -448,13 +448,12 @@ class PaymentSocialContribution extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new PaymentSocialContribution($this->db);
|
||||
|
||||
@ -400,7 +400,7 @@ $num = $db->num_rows($result);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != ''))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
|
||||
@ -1072,7 +1072,7 @@ if (empty($reshook))
|
||||
else
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$result = $object->createFromClone($socid);
|
||||
$result = $object->createFromClone($user, $socid);
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
|
||||
@ -2120,7 +2120,7 @@ class Contrat extends CommonObject
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
if ($mode == 'inactives')
|
||||
if ($mode == 'inactive')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
|
||||
$sql.= $this->from;
|
||||
@ -2135,25 +2135,43 @@ class Contrat extends CommonObject
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(time())."'";
|
||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
elseif ($mode == 'active')
|
||||
{
|
||||
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
|
||||
$sql.= $this->from;
|
||||
$sql.= " WHERE c.statut = 1";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
//$datetouse = dol_now();
|
||||
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
|
||||
}
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
$now=dol_now();
|
||||
|
||||
if ($mode == 'inactives') {
|
||||
if ($mode == 'inactive') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
}
|
||||
elseif ($mode == 'expired') {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
$label = $langs->trans("BoardExpiredServices");
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
|
||||
//if ($warning_delay >= 0) $url.='&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
@ -2388,13 +2406,14 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $socid Id of thirdparty
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($socid = 0, $notrigger = 0)
|
||||
public function createFromClone(User $user, $socid = 0, $notrigger = 0)
|
||||
{
|
||||
global $db, $user, $langs, $conf, $hookmanager, $extrafields;
|
||||
global $db, $langs, $conf, $hookmanager, $extrafields;
|
||||
|
||||
dol_include_once('/projet/class/project.class.php');
|
||||
|
||||
|
||||
@ -195,23 +195,6 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete))
|
||||
}
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$objectutil = dol_clone($object); // To avoid to denaturate loaded object when setting some properties for clone
|
||||
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
|
||||
|
||||
$result = $objectutil->createFromClone($id);
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
|
||||
@ -216,7 +216,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT)
|
||||
if ($objectclass == 'Commande' && $objectojb->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
@ -345,6 +345,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||
if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||
if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||
if ($objectclass == 'Project') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO));
|
||||
|
||||
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
|
||||
// $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty)
|
||||
|
||||
@ -3963,8 +3963,10 @@ abstract class CommonObject
|
||||
// Reduction short
|
||||
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
|
||||
|
||||
// Fields for situation invoice
|
||||
if ($this->situation_cycle_ref) {
|
||||
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
|
||||
print '<td class="linecolcycleref2 right">' . $langs->trans('TotalHT100Short') . '</td>';
|
||||
}
|
||||
|
||||
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
|
||||
@ -6523,7 +6525,7 @@ abstract class CommonObject
|
||||
$out .= $extrafields->showOutputField($key, $value);
|
||||
break;
|
||||
case "edit":
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -404,15 +404,14 @@ class Ctyperesource
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Ctyperesource($this->db);
|
||||
|
||||
|
||||
@ -1567,6 +1567,9 @@ class ExtraFields
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||
*/
|
||||
if (! empty($help)) {
|
||||
$out .= $form->textwithpicto("", $help);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -1837,7 +1840,7 @@ class ExtraFields
|
||||
$out='';
|
||||
|
||||
// Only if something to display (perf)
|
||||
if ($value) // If we have -1 here, pb is into sert, not into ouptu
|
||||
if ($value) // If we have -1 here, pb is into insert, not into ouptut (fix insert instead of changing code here to compensate)
|
||||
{
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
|
||||
|
||||
@ -4781,9 +4781,10 @@ class Form
|
||||
*
|
||||
* @param string $selected preselected currency code
|
||||
* @param string $htmlname name of HTML select list
|
||||
* @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code
|
||||
* @return string
|
||||
*/
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id')
|
||||
public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
@ -4805,7 +4806,14 @@ class Form
|
||||
$out.= '<option value="'.$code_iso.'">';
|
||||
}
|
||||
$out.= $currency['label'];
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
if ($mode == 1)
|
||||
{
|
||||
$out.= ' ('.$code_iso.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= ' ('.$langs->getCurrencySymbol($code_iso).')';
|
||||
}
|
||||
$out.= '</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
|
||||
@ -710,7 +710,7 @@ class FormMail extends Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((! is_array($this->withtocc) && ! is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
@ -1022,7 +1022,7 @@ class FormMail extends Form
|
||||
if (! empty($this->withtocccreadonly)) {
|
||||
$out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
||||
} else {
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc)) {
|
||||
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
@ -1037,9 +1037,12 @@ class FormMail extends Form
|
||||
|
||||
$showinfobcc='';
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO;
|
||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) && ! empty($this->param['models']) && $this->param['models'] == 'project') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO;
|
||||
if ($showinfobcc) $out.=' + '.$showinfobcc;
|
||||
$out.= "</td></tr>\n";
|
||||
return $out;
|
||||
|
||||
@ -834,7 +834,7 @@ class FormTicket
|
||||
if ($user->rights->ticket->write && !$user->socid)
|
||||
{
|
||||
print '<tr><td width="30%"></td><td colspan="2">';
|
||||
$checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : '');
|
||||
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : '');
|
||||
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
|
||||
print '<label for="send_msg_email">' . $langs->trans('SendMessageByEmail') . '</label>';
|
||||
print '</td></tr>';
|
||||
@ -852,20 +852,10 @@ class FormTicket
|
||||
print '</div></td>';
|
||||
}
|
||||
|
||||
// Substitution array
|
||||
if ($this->withsubstit) {
|
||||
print '<tr class="email_line"><td></td><td colspan="2">';
|
||||
$help="";
|
||||
foreach ($this->substit as $key => $val) {
|
||||
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Private message (not visible by customer/external user)
|
||||
if (! $user->socid) {
|
||||
print '<tr><td width="30%"></td><td>';
|
||||
$checkbox_selected = ( GETPOST('private_message') == "1" ? ' checked' : '');
|
||||
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
|
||||
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
|
||||
print '<label for="private_message">' . $langs->trans('MarkMessageAsPrivate') . '</label>';
|
||||
print '</td><td align="center">';
|
||||
@ -873,8 +863,7 @@ class FormTicket
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="email_line"><td width=20%">' . $langs->trans('Subject') . '</td>';
|
||||
print '<tr class="email_line"><td class="titlefieldcreate">' . $langs->trans('Subject') . '</td>';
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
print '<td colspan="2"><input type="text" class="text" size="80" name="subject" value="[' . $label_title . ' - ticket #' . $this->track_id . '] ' . $langs->trans('TicketNewMessage') . '" />';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -466,7 +466,9 @@ class Translate
|
||||
if (! $found && ! empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Overwrite translation with database read
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
|
||||
$sql ="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
|
||||
$sql.=" AND entity IN (0, ".getEntity('overwrite_trans').")";
|
||||
$sql.=$db->order("lang", "DESC");
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -239,36 +239,37 @@ class Utils
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/", $command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
$command = $cmddump;
|
||||
$command = preg_replace('/(\$|%)/', '', $command); // We removed chars that can be used to inject vars that contains space inside path of command without seeing there is a space to bypass the escapeshellarg.
|
||||
if (preg_match("/\s/", $command)) $command=escapeshellarg($command); // If there is spaces, we add quotes on command to be sure $command is only a program and not a program+parameters
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
|
||||
$param.=" -u ".$dolibarr_main_db_user;
|
||||
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
|
||||
if (! GETPOST("use_transaction")) $param.=" -l --single-transaction";
|
||||
if (GETPOST("disable_fk") || $usedefault) $param.=" -K";
|
||||
if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat", "alpha"));
|
||||
if (GETPOST("drop_database")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure") || $usedefault)
|
||||
if (! GETPOST("use_transaction", "alpha")) $param.=" -l --single-transaction";
|
||||
if (GETPOST("disable_fk", "alpha") || $usedefault) $param.=" -K";
|
||||
if (GETPOST("sql_compat", "alpha") && GETPOST("sql_compat", "alpha") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat", "alpha"));
|
||||
if (GETPOST("drop_database", "alpha")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure", "alpha") || $usedefault)
|
||||
{
|
||||
if (GETPOST("drop") || $usedefault) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
if (GETPOST("drop", "alpha") || $usedefault) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
}
|
||||
else
|
||||
{
|
||||
$param.=" -t";
|
||||
}
|
||||
if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE";
|
||||
if (GETPOST("sql_data") || $usedefault)
|
||||
if (GETPOST("disable-add-locks", "alpha")) $param.=" --add-locks=FALSE";
|
||||
if (GETPOST("sql_data", "alpha") || $usedefault)
|
||||
{
|
||||
$param.=" --tables";
|
||||
if (GETPOST("showcolumns") || $usedefault) $param.=" -c";
|
||||
if (GETPOST("extended_ins") || $usedefault) $param.=" -e";
|
||||
if (GETPOST("showcolumns", "alpha") || $usedefault) $param.=" -c";
|
||||
if (GETPOST("extended_ins", "alpha") || $usedefault) $param.=" -e";
|
||||
else $param.=" --skip-extended-insert";
|
||||
if (GETPOST("delayed")) $param.=" --delayed-insert";
|
||||
if (GETPOST("sql_ignore")) $param.=" --insert-ignore";
|
||||
if (GETPOST("hexforbinary") || $usedefault) $param.=" --hex-blob";
|
||||
if (GETPOST("delayed", "alpha")) $param.=" --delayed-insert";
|
||||
if (GETPOST("sql_ignore", "alpha")) $param.=" --insert-ignore";
|
||||
if (GETPOST("hexforbinary", "alpha") || $usedefault) $param.=" --hex-blob";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -436,8 +437,9 @@ class Utils
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/", $command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
$command = $cmddump;
|
||||
$command = preg_replace('/(\$|%)/', '', $command); // We removed chars that can be used to inject vars that contains space inside path of command without seeing there is a space to bypass the escapeshellarg.
|
||||
if (preg_match("/\s/", $command)) $command=escapeshellarg($command); // If there is spaces, we add quotes on command to be sure $command is only a program and not a program+parameters
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
//$param="-F c";
|
||||
|
||||
@ -307,7 +307,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti
|
||||
}
|
||||
if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
if (! empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
// Now search in setup to overwrite default values
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
@ -1299,6 +1299,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
if ($object->element == 'member') $modulepart='memberphoto';
|
||||
if ($object->element == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
if ($object->element == 'ticket') $modulepart='ticket';
|
||||
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
@ -6107,6 +6108,7 @@ $substitutionarray=array_merge($substitutionarray, array(
|
||||
{
|
||||
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
|
||||
$substitutionarray['__(AnyTranslationKey|langfile)__']=$outputlangs->trans('TranslationOfKey').' (load also language file before)';
|
||||
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstantKey');
|
||||
}
|
||||
|
||||
@ -6135,7 +6137,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null)
|
||||
|
||||
if (empty($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
// Make substitution for language keys
|
||||
// Make substitution for language keys: __(AnyTranslationKey)__ or __(AnyTranslationKey|langfile)__
|
||||
if (is_object($outputlangs))
|
||||
{
|
||||
while (preg_match('/__\(([^\)]+)\)__/', $text, $reg))
|
||||
@ -6151,8 +6153,8 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null)
|
||||
}
|
||||
}
|
||||
|
||||
// Make substitution for constant keys. Must be after the substitution of translation, so if text of translation contains a constant,
|
||||
// it is also converted.
|
||||
// Make substitution for constant keys.
|
||||
// Must be after the substitution of translation, so if the text of translation contains a string __[xxx]__, it is also converted.
|
||||
while (preg_match('/__\[([^\]]+)\]__/', $text, $reg))
|
||||
{
|
||||
$msgishtml = 0;
|
||||
|
||||
@ -2436,6 +2436,9 @@ function getModuleDirForApiClass($module)
|
||||
elseif ($module == 'tickets') {
|
||||
$moduledirforclass = 'ticket';
|
||||
}
|
||||
elseif ($module == 'boms') {
|
||||
$moduledirforclass = 'bom';
|
||||
}
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
* @param string $localorexternal 0=Url for browser, 1=Url for external access
|
||||
* @return string Url string
|
||||
*/
|
||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag', $localorexternal=0)
|
||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 0)
|
||||
{
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
|
||||
|
||||
@ -1954,6 +1954,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
|
||||
if ($object->lines[$i]->situation_percent > 0)
|
||||
{
|
||||
// TODO Remove this. The total should be saved correctly in database instead of being modified here.
|
||||
$prev_progress = 0;
|
||||
$progress = 1;
|
||||
if (method_exists($object->lines[$i], 'get_prev_progress'))
|
||||
@ -1964,7 +1965,9 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
|
||||
}
|
||||
else
|
||||
$result.=price($sign * $total_ht, 0, $outputlangs);
|
||||
{
|
||||
$result.=price($sign * $total_ht, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
* @param int $qty Quantity
|
||||
* @param float $pu Unit price (HT or TTC selon price_base_type)
|
||||
* @param float $remise_percent_ligne Discount for line
|
||||
* @param float $txtva 0=do not apply standard tax, Vat rate=apply
|
||||
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array)
|
||||
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $remise_percent_global 0
|
||||
@ -131,13 +131,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$localtax2_type = $localtaxes_array[2];
|
||||
$localtax2_rate = $localtaxes_array[3];
|
||||
}
|
||||
else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate
|
||||
else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code)
|
||||
{
|
||||
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
|
||||
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
|
||||
|
||||
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
|
||||
$sql.= " WHERE cv.taux = ".$txtva;
|
||||
$sql.= " AND cv.fk_pays = ".$countryid;
|
||||
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -202,7 +203,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
$localtaxes = array(0,0,0);
|
||||
$apply_tax = false;
|
||||
switch($localtax1_type) {
|
||||
switch($localtax1_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
@ -226,16 +227,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '2': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '4': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '6': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise_wt * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise_wt, 'MT');
|
||||
@ -320,16 +321,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
|
||||
$apply_tax = false;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
switch($localtax2_type) {
|
||||
case '1': // localtax on product or service
|
||||
$apply_tax = true;
|
||||
break;
|
||||
case '3': // localtax on product
|
||||
if ($type == 0) $apply_tax = true;
|
||||
break;
|
||||
case '5': // localtax on service
|
||||
if ($type == 1) $apply_tax = true;
|
||||
break;
|
||||
}
|
||||
if ($uselocaltax2_rate && $apply_tax) {
|
||||
$result[15] = price2num(($tot_sans_remise * (1 + ( $localtax2_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax2 for total_ht_without_discount
|
||||
|
||||
@ -474,7 +474,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
|
||||
// Ref of task
|
||||
print '<td>';
|
||||
print '<td class="nowraponall">';
|
||||
if ($showlineingray)
|
||||
{
|
||||
print '<i>'.img_object('', 'projecttask').' '.$lines[$i]->ref.'</i>';
|
||||
|
||||
@ -100,6 +100,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0)
|
||||
* @param string $str String to clean
|
||||
* @param string $replacewith String to use as replacement
|
||||
* @return string Result string without php code
|
||||
* @see dolKeepOnlyPhpCode()
|
||||
*/
|
||||
function dolStripPhpCode($str, $replacewith = '')
|
||||
{
|
||||
@ -132,6 +133,44 @@ function dolStripPhpCode($str, $replacewith = '')
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep only PHP code part from a HTML string page.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @return string Result string with php code only
|
||||
* @see dolStripPhpCode()
|
||||
*/
|
||||
function dolKeepOnlyPhpCode($str)
|
||||
{
|
||||
$newstr = '';
|
||||
|
||||
//split on each opening tag
|
||||
$parts = explode('<?php', $str);
|
||||
if (!empty($parts))
|
||||
{
|
||||
$i=0;
|
||||
foreach($parts as $part)
|
||||
{
|
||||
if ($i == 0) // The first part is never php code
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$newstr.='<?php';
|
||||
//split on closing tag
|
||||
$partlings = explode('?>', $part, 2);
|
||||
if (!empty($partlings))
|
||||
{
|
||||
$newstr .= $partlings[0].'?>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$newstr .= $part.'?>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
|
||||
@ -1311,42 +1311,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
}
|
||||
}
|
||||
|
||||
// Accountancy (simple)
|
||||
if (! empty($conf->comptabilite->enabled))
|
||||
{
|
||||
$langs->load("compta");
|
||||
|
||||
// Bilan, resultats
|
||||
$newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) {
|
||||
$newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
|
||||
/* On verra ca avec module compabilite expert
|
||||
$newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire);
|
||||
*/
|
||||
$newmenu->add("/compta/stats/index.php?leftmenu=report", $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire);
|
||||
|
||||
/*
|
||||
$newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
|
||||
if (! empty($conf->propal->enabled)) {
|
||||
$newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire);
|
||||
}
|
||||
*/
|
||||
$newmenu->add("/compta/stats/casoc.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/cabyuser.php?leftmenu=report", $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/byratecountry.php?leftmenu=report", $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire);
|
||||
|
||||
// Journaux
|
||||
$newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50);
|
||||
$newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51);
|
||||
}
|
||||
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
|
||||
// Configuration
|
||||
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
|
||||
@ -1378,8 +1342,44 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120);
|
||||
$newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Accountancy (simple)
|
||||
if (! empty($conf->comptabilite->enabled))
|
||||
{
|
||||
$langs->load("compta");
|
||||
|
||||
// Bilan, resultats
|
||||
$newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) {
|
||||
$newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
|
||||
/* On verra ca avec module compabilite expert
|
||||
$newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire);
|
||||
*/
|
||||
$newmenu->add("/compta/stats/index.php?leftmenu=report", $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire);
|
||||
|
||||
/*
|
||||
$newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
|
||||
if (! empty($conf->propal->enabled)) {
|
||||
$newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire);
|
||||
}
|
||||
*/
|
||||
$newmenu->add("/compta/stats/casoc.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/cabyuser.php?leftmenu=report", $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire);
|
||||
$newmenu->add("/compta/stats/byratecountry.php?leftmenu=report", $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire);
|
||||
|
||||
// Journaux
|
||||
$newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50);
|
||||
$newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51);
|
||||
}
|
||||
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
|
||||
// Assets
|
||||
if (! empty($conf->asset->enabled))
|
||||
{
|
||||
|
||||
@ -64,7 +64,7 @@ class modEmailCollector extends DolibarrModules
|
||||
$this->descriptionlong = "EmailCollectorDescription";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'experimental';
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
|
||||
@ -201,6 +201,11 @@ class modProduct extends DolibarrModules
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
@ -218,7 +223,7 @@ class modProduct extends DolibarrModules
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
@ -240,7 +245,39 @@ class modProduct extends DolibarrModules
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
@ -287,7 +324,7 @@ class modProduct extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
|
||||
@ -312,7 +349,7 @@ class modProduct extends DolibarrModules
|
||||
'p.note_public' => "PublicNote",//public note
|
||||
'p.note' => "PrivateNote",//private note
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.price' => "SellingPriceHT",//without tax
|
||||
'p.price' => "SellingPriceHT",//without
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC",//with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
@ -481,19 +518,22 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>''));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
|
||||
if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>''));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge(
|
||||
$import_sample,
|
||||
array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
)
|
||||
);
|
||||
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
));
|
||||
}
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
@ -546,12 +586,15 @@ class modProduct extends DolibarrModules
|
||||
);
|
||||
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
'sp.fk_product' => "My Ref. eg: PREF123456",
|
||||
'sp.fk_product' => "PRODUCT_REF or id:123456",
|
||||
'sp.fk_soc' => "My Supplier",
|
||||
'sp.ref_fourn' => "eg: XYZ-F123456",
|
||||
'sp.quantity' => "eg: 5",
|
||||
'sp.quantity' => "5",
|
||||
'sp.tva_tx' => 'one of the defined rates eg. 21',
|
||||
'sp.default_vat_code' => '',
|
||||
'sp.price'=>"50",
|
||||
'sp.unitprice'=>'50',
|
||||
'sp.remise_percent'=>'0',
|
||||
'sp.default_vat_code' => '',
|
||||
'sp.delivery_time_days' => 'eg. 5',
|
||||
'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER'
|
||||
);
|
||||
@ -589,16 +632,19 @@ class modProduct extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
|
||||
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation*');
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
||||
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"PRODUCT_REF or id:123456",
|
||||
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
|
||||
'pr.price'=>"100",'pr.price_ttc'=>"110",
|
||||
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
|
||||
'pr.tva_tx'=>'20',
|
||||
@ -616,13 +662,13 @@ class modProduct extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
|
||||
// multiline translation, one line per translation
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'PRODUCT_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -141,28 +141,32 @@ class modService extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("service","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service");
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'service'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'service'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
@ -185,7 +189,7 @@ class modService extends DolibarrModules
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
@ -207,9 +211,89 @@ class modService extends DolibarrModules
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
|
||||
'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')';
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
@ -259,13 +343,12 @@ class modService extends DolibarrModules
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
|
||||
// Import list of services
|
||||
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="Products"; // Translation key
|
||||
@ -277,8 +360,9 @@ class modService extends DolibarrModules
|
||||
'p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",
|
||||
'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",
|
||||
'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",
|
||||
'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
|
||||
);
|
||||
//if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
@ -296,24 +380,24 @@ class modService extends DolibarrModules
|
||||
$fieldname='extra.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
||||
$import_extrafield_sample[$fieldname]=$fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r]=array(
|
||||
'p.ref' => '[^ ]',
|
||||
'p.price_base_type' => '\AHT\z|\ATTC\z',
|
||||
'p.tosell' => '^[0|1]$',
|
||||
'p.tobuy' => '^[0|1]$',
|
||||
'p.fk_product_type' => '^[0|1]$',
|
||||
'p.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
'p.finished' => '^[0|1]$'
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
|
||||
'p.ref'=>'[^ ]',
|
||||
'p.tosell'=>'^[0|1]$',
|
||||
'p.tobuy'=>'^[0|1]$',
|
||||
'p.fk_product_type'=>'^[0|1]$',
|
||||
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'p.recuperableonly'=>'^[0|1]$'
|
||||
);
|
||||
$import_sample=array('p.ref'=>"SERVICE_REF or id:123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
|
||||
if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled
|
||||
|
||||
|
||||
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
|
||||
{
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
@ -355,18 +439,19 @@ class modService extends DolibarrModules
|
||||
'sp.multicurrency_price'=>'CurrencyPrice',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
|
||||
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
'sp.fk_product'=>"PREF123456",
|
||||
'sp.fk_product'=>"SERVICE_REF or id:123456",
|
||||
'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21',
|
||||
'sp.price'=>"50",
|
||||
'sp.unitprice'=>'50',
|
||||
'sp.remise_percent'=>'0'
|
||||
);
|
||||
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef','sp.fk_soc'=>'Supplier');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
@ -379,21 +464,24 @@ class modService extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
|
||||
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
|
||||
'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
|
||||
$this->import_fields_array[$r]=array('pr.fk_product'=>"ProductOrService*",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation*');
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) $this->import_fields_array[$r]['pr.tva_tx']='VATRate';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
||||
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"SERVICE_REF or id:123456",
|
||||
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)",'pr.price_level'=>"1",
|
||||
'pr.price'=>"100",'pr.price_ttc'=>"110",
|
||||
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
|
||||
'pr.tva_tx'=>'20',
|
||||
'pr.tva_tx'=>'20',
|
||||
'pr.recuperableonly'=>'0',
|
||||
'pr.date_price'=>'2013-04-10');
|
||||
'pr.date_price'=>'2013-04-10');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
@ -406,13 +494,13 @@ class modService extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('l'=>MAIN_DB_PREFIX.'product_lang');
|
||||
// multiline translation, one line per translation
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'Ref', 'l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
$this->import_fields_array[$r]=array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription');
|
||||
//$this->import_fields_array[$r]['l.note']='TranslatedNote';
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'l.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'MyProductRef','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'Ref','l.lang'=>'Language');
|
||||
$this->import_examplevalues_array[$r]=array('l.fk_product'=>'SERVICE_REF or id:123456','l.lang'=>'en_US','l.label'=>'Label in en_US','l.description'=>'Desc in en_US');
|
||||
$this->import_updatekeys_array[$r]=array('l.fk_product'=>'ProductOrService','l.lang'=>'Language');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,15 +120,16 @@ class modTicket extends DolibarrModules
|
||||
}
|
||||
$this->dictionaries = array(
|
||||
'langs' => 'ticket',
|
||||
'tabname' => array(MAIN_DB_PREFIX . "c_ticket_type", MAIN_DB_PREFIX . "c_ticket_category", MAIN_DB_PREFIX . "c_ticket_severity"),
|
||||
'tablib' => array("TicketDictType", "TicketDictCategory", "TicketDictSeverity"),
|
||||
'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_category as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_severity as f'),
|
||||
'tabname' => array(MAIN_DB_PREFIX . "c_ticket_type", MAIN_DB_PREFIX . "c_ticket_severity", MAIN_DB_PREFIX . "c_ticket_category"),
|
||||
'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory"),
|
||||
'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_severity as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM ' . MAIN_DB_PREFIX . 'c_ticket_category as f'),
|
||||
'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC"),
|
||||
'tabfield' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldvalue' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldinsert' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabrowid' => array("rowid", "rowid", "rowid"),
|
||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
|
||||
'tabhelp' => array(array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"))),
|
||||
);
|
||||
|
||||
// Boxes
|
||||
|
||||
@ -92,12 +92,18 @@ class modWebsite extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 10002;
|
||||
$this->rights[$r][1] = 'Create/modify website content';
|
||||
$this->rights[$r][1] = 'Create/modify website content (html and javascript content)';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'write';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 10003;
|
||||
$this->rights[$r][1] = 'Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'writephp';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 10005;
|
||||
$this->rights[$r][1] = 'Delete website content';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'delete';
|
||||
|
||||
@ -260,7 +260,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
//$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':'');
|
||||
$datestart=dol_print_date($object->lines[$i]->date_start, 'day');
|
||||
$dateend=dol_print_date($object->lines[$i]->date_end, 'day');
|
||||
$planned_timespent=convertSecondToTime((int) $object->lines[$i]->planned_timespent, 'allhourmin');
|
||||
$duration=convertSecondToTime((int) $object->lines[$i]->duration, 'allhourmin');
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
@ -348,7 +348,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
|
||||
// timespent
|
||||
$pdf->SetXY($this->posxtimespent, $curY);
|
||||
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $planned_timespent?$planned_timespent:'', 0, 'R');
|
||||
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $duration?$duration:'', 0, 'R');
|
||||
// Progress
|
||||
//$pdf->SetXY($this->posxprogress, $curY);
|
||||
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
|
||||
|
||||
@ -174,7 +174,7 @@ if ($action == 'presend')
|
||||
$listeuser=array();
|
||||
$fuserdest = new User($db);
|
||||
|
||||
$result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''));
|
||||
$result= $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''), 'AND', true);
|
||||
if ($result>0 && is_array($fuserdest->users) && count($fuserdest->users)>0) {
|
||||
foreach($fuserdest->users as $uuserdest) {
|
||||
$listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id, 'email');
|
||||
|
||||
@ -49,7 +49,7 @@ foreach($object->fields as $key => $val)
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefield';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
//if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired on the view output
|
||||
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
|
||||
print '">';
|
||||
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
||||
|
||||
@ -131,10 +131,13 @@ if ($nolinesbefore) {
|
||||
?>
|
||||
<td class="linecoldiscount right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||
<?php
|
||||
// Fields for situation invoice
|
||||
if ($this->situation_cycle_ref) {
|
||||
print '<td class="linecolcycleref right">' . $langs->trans('Progress') . '</td>';
|
||||
print '<td class="linecolcycleref2 right"></td>';
|
||||
}
|
||||
if (! empty($usemargins))
|
||||
if (! empty($usemargins))
|
||||
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
?>
|
||||
@ -147,9 +150,7 @@ if ($nolinesbefore) {
|
||||
echo $langs->trans('BuyingPrice');
|
||||
else
|
||||
echo $langs->trans('CostPrice');
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
echo '</td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
|
||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
|
||||
}
|
||||
@ -161,18 +162,16 @@ if ($nolinesbefore) {
|
||||
?>
|
||||
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
|
||||
<?php
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay=2;
|
||||
?>
|
||||
<td class="nobottom linecolnum center"></td>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$coldisplay=0;
|
||||
}
|
||||
?>
|
||||
$coldisplay=0;
|
||||
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay++;
|
||||
echo '<td class="nobottom linecolnum center"></td>';
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecoldescription minwidth500imp">
|
||||
|
||||
<?php
|
||||
@ -332,7 +331,7 @@ else {
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$toolbarname='dolibarr_details';
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
|
||||
$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, $toolbarname, '', false, true, $enabled, $nbrows, '98%');
|
||||
$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%');
|
||||
$doleditor->Create();
|
||||
|
||||
// Show autofill date for recurring invoices
|
||||
@ -346,59 +345,76 @@ else {
|
||||
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
echo '</td>';
|
||||
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref", 'alpha', 2):''); ?>"></td>
|
||||
<?php } ?>
|
||||
|
||||
<td class="nobottom linecolvat right"><?php
|
||||
$coldisplay++;
|
||||
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true);
|
||||
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx", 'alpha', 2):-1), $seller, $buyer, 0, 0, '', false, 1);
|
||||
?>
|
||||
</td>
|
||||
<td class="nobottom linecoluht right">
|
||||
|
||||
<td class="nobottom linecoluht right"><?php $coldisplay++; ?>
|
||||
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht", 'alpha', 2):''); ?>">
|
||||
</td>
|
||||
|
||||
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
|
||||
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecoluht_currency right">
|
||||
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht", 'alpha', 2):''); ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (! empty($inputalsopricewithtax)) { ?>
|
||||
<?php if (! empty($inputalsopricewithtax)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecoluttc right">
|
||||
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?GETPOST("price_ttc", 'alpha', 2):''); ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>">
|
||||
</td>
|
||||
<?php
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print $form->selectUnits($line->fk_unit, "units");
|
||||
print '</td>';
|
||||
}
|
||||
$remise_percent = $buyer->remise_percent;
|
||||
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
|
||||
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier')
|
||||
{
|
||||
$remise_percent = $seller->remise_supplier_percent;
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom nowrap linecoldiscount right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (isset($_POST["remise_percent"])?GETPOST("remise_percent", 'alpha', 2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
|
||||
<?php
|
||||
|
||||
if ($this->situation_cycle_ref) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>';
|
||||
$coldisplay++;
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
if (! empty($usemargins))
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom margininfos linecolmargin right">
|
||||
<!-- For predef product -->
|
||||
@ -409,7 +425,6 @@ else {
|
||||
<input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
|
||||
</td>
|
||||
<?php
|
||||
$coldisplay++;
|
||||
}
|
||||
|
||||
if ($user->rights->margins->creer)
|
||||
@ -425,12 +440,9 @@ else {
|
||||
$coldisplay++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $coldisplay++;
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $coldisplay++;
|
||||
}
|
||||
}
|
||||
|
||||
$coldisplay+=$colspan;
|
||||
?>
|
||||
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>">
|
||||
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
|
||||
@ -439,62 +451,16 @@ else {
|
||||
|
||||
<?php
|
||||
if (is_object($objectline)) {
|
||||
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
|
||||
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
|
||||
{
|
||||
$colspan = 6;
|
||||
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
$colspan++;
|
||||
}
|
||||
if ($this->situation_cycle_ref) {
|
||||
$colspan++;
|
||||
}
|
||||
// We add 1 if col total ttc
|
||||
if (!empty($inputalsopricewithtax)) {
|
||||
$colspan++;
|
||||
}
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
$colspan++;
|
||||
}
|
||||
if (count($object->lines)) {
|
||||
//There will be an edit and a delete button
|
||||
$colspan += 2;
|
||||
|
||||
// With this, there is a column move button ONLY if lines > 1
|
||||
if (in_array($object->element, array(
|
||||
'propal',
|
||||
'supplier_proposal',
|
||||
'facture',
|
||||
'facturerec',
|
||||
'invoice',
|
||||
'commande',
|
||||
'order',
|
||||
'order_supplier',
|
||||
'invoice_supplier'
|
||||
))) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
|
||||
|
||||
if (! empty($usemargins))
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr id="trlinefordates" <?php echo $bcnd[$var]; ?>>
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?>
|
||||
<td colspan="<?php echo $colspan; ?>">
|
||||
<td colspan="<?php echo $coldisplay - (empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1); ?>">
|
||||
<?php
|
||||
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
|
||||
@ -60,12 +60,15 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf-
|
||||
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
|
||||
|
||||
<?php
|
||||
$coldisplay=-1; // We remove first td
|
||||
$coldisplay=0;
|
||||
?>
|
||||
<tr class="oddeven tredited">
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td>
|
||||
<div id="line_<?php echo $line->id; ?>"></div>
|
||||
|
||||
@ -113,7 +116,8 @@ $coldisplay=-1; // We remove first td
|
||||
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||
$toolbarname='dolibarr_details';
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
|
||||
$doleditor=new DolEditor('product_desc', $line->description, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%');
|
||||
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
|
||||
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
|
||||
$doleditor->Create();
|
||||
} else {
|
||||
print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
|
||||
@ -136,6 +140,7 @@ $coldisplay=-1; // We remove first td
|
||||
<?php
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
|
||||
<?php
|
||||
@ -154,6 +159,7 @@ $coldisplay=-1; // We remove first td
|
||||
print '></td>';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
|
||||
$coldisplay++;
|
||||
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
|
||||
}
|
||||
|
||||
@ -182,6 +188,7 @@ $coldisplay=-1; // We remove first td
|
||||
<?php
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td class="left">';
|
||||
print $form->selectUnits($line->fk_unit, "units");
|
||||
print '</td>';
|
||||
@ -200,16 +207,17 @@ $coldisplay=-1; // We remove first td
|
||||
<?php
|
||||
if ($this->situation_cycle_ref) {
|
||||
$coldisplay++;
|
||||
print '<td class="nowrap right"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
|
||||
print '<td class="nowrap right linecolcycleref"><input class="right" type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
|
||||
$coldisplay++;
|
||||
print '<td></td>';
|
||||
}
|
||||
if (! empty($usemargins))
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
?>
|
||||
<td class="margininfos right">
|
||||
<?php
|
||||
if (!empty($user->rights->margins->creer))
|
||||
{
|
||||
$coldisplay++;
|
||||
?>
|
||||
?>
|
||||
<td class="margininfos right">
|
||||
<!-- For predef product -->
|
||||
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
||||
<select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select>
|
||||
@ -217,8 +225,8 @@ $coldisplay=-1; // We remove first td
|
||||
<!-- For free product -->
|
||||
<input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php
|
||||
<?php }
|
||||
|
||||
if ($user->rights->margins->creer) {
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
{
|
||||
@ -245,7 +253,7 @@ $coldisplay=-1; // We remove first td
|
||||
?>
|
||||
|
||||
<!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
|
||||
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=4; ?>
|
||||
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?>
|
||||
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
||||
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||
</td>
|
||||
@ -262,9 +270,9 @@ if (!empty($extrafieldsline))
|
||||
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
|
||||
<tr id="service_duration_area" class="treditedlinefordate">
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum center"><?php $coldisplay++; ?></td>
|
||||
<td class="linecolnum center"></td>
|
||||
<?php } ?>
|
||||
<td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<td colspan="<?php echo $coldisplay-(empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1) ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<?php
|
||||
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
|
||||
print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0);
|
||||
|
||||
@ -237,14 +237,22 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
<td class="linecoldiscount"><?php $coldisplay++; ?> </td>
|
||||
<?php }
|
||||
|
||||
if ($this->situation_cycle_ref) {
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
// Fields for situation invoices
|
||||
if ($this->situation_cycle_ref)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
$coldisplay++;
|
||||
print '<td class="linecolcycleref nowrap right">' . $line->situation_percent . '%</td>';
|
||||
$coldisplay++;
|
||||
$locataxes_array = getLocalTaxesFromRate($line->tva.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), 0, ($senderissupplier?$mysoc:$object->thirdparty), ($senderissupplier?$object->thirdparty:$mysoc));
|
||||
$tmp = calcul_price_total($line->qty, $line->pu, $line->remise_percent, $line->txtva, -1, -1, 0, 'HT', $line->info_bits, $line->type, ($senderissupplier?$object->thirdparty:$mysoc), $locataxes_array, 100, $object->multicurrency_tx, $line->multicurrency_subprice);
|
||||
print '<td align="right" class="linecolcycleref2 nowrap">' . price($tmp[0]) . '</td>';
|
||||
}
|
||||
|
||||
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
|
||||
{
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
?>
|
||||
|
||||
<?php if (!empty($user->rights->margins->creer)) { ?>
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
// Load website class
|
||||
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
|
||||
// Define $website
|
||||
if (! is_object($website))
|
||||
{
|
||||
@ -40,11 +42,14 @@ if (! is_object($weblangs))
|
||||
if (! $pageid && ! empty($websitepagefile))
|
||||
{
|
||||
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
|
||||
if ($pageid == 'index.php') $pageid = $website->fk_default_home;
|
||||
}
|
||||
if (! is_object($websitepage))
|
||||
{
|
||||
$websitepage=new WebsitePage($db);
|
||||
}
|
||||
if ($pageid > 0)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
$websitepage=new WebsitePage($db);
|
||||
$websitepage->fetch($pageid);
|
||||
}
|
||||
|
||||
|
||||
@ -736,13 +736,12 @@ class Cronjob extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Cronjob($this->db);
|
||||
|
||||
@ -408,13 +408,12 @@ class PaymentDonation extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new PaymentDonation($this->db);
|
||||
|
||||
@ -707,15 +707,14 @@ class EcmFiles extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Ecmfiles($this->db);
|
||||
|
||||
|
||||
@ -92,8 +92,8 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID','visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1'),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1'),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1),
|
||||
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'),
|
||||
@ -103,6 +103,7 @@ class EmailCollector extends CommonObject
|
||||
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
|
||||
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
|
||||
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
|
||||
'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect','visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100),
|
||||
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
|
||||
'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
|
||||
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1,),
|
||||
@ -167,6 +168,7 @@ class EmailCollector extends CommonObject
|
||||
public $password;
|
||||
public $source_directory;
|
||||
public $target_directory;
|
||||
public $maxemailpercollect;
|
||||
public $datelastresult;
|
||||
public $lastresult;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
@ -717,12 +719,6 @@ class EmailCollector extends CommonObject
|
||||
return $nberror;
|
||||
}
|
||||
|
||||
/**
|
||||
* overwitePropertiesOfObject
|
||||
*
|
||||
* @return int 0=OK, Nb of error if error
|
||||
*/
|
||||
|
||||
/**
|
||||
* overwitePropertiesOfObject
|
||||
*
|
||||
@ -755,7 +751,8 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
if ($tmpclass && ($tmpclass != $object->element)) continue; // Property is for another type of object
|
||||
|
||||
if (property_exists($object, $tmpproperty) || preg_match('/^options_/', $tmpproperty))
|
||||
//if (property_exists($object, $tmpproperty) || preg_match('/^options_/', $tmpproperty))
|
||||
if ($tmpproperty)
|
||||
{
|
||||
$sourcestring='';
|
||||
$sourcefield='';
|
||||
@ -782,8 +779,12 @@ class EmailCollector extends CommonObject
|
||||
if ($sourcestring)
|
||||
{
|
||||
$regforval=array();
|
||||
//var_dump($regexstring);var_dump($sourcestring);
|
||||
if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval))
|
||||
$regexoptions='';
|
||||
if (strtolower($sourcefield) == 'body') $regexoptions='ms'; // The m means ^ and $ char is valid at each new line. The s means the char '.' is valid for new lines char too
|
||||
if (strtolower($sourcefield) == 'header') $regexoptions='m'; // The m means ^ and $ char is valid at each new line.
|
||||
|
||||
//var_dump($tmpproperty.' - '.$regexstring.' - '.$regexoptions.' - '.$sourcestring);
|
||||
if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval))
|
||||
{
|
||||
//var_dump($regforval[1]);exit;
|
||||
// Overwrite param $tmpproperty
|
||||
@ -794,7 +795,6 @@ class EmailCollector extends CommonObject
|
||||
// Regex not found
|
||||
$object->$tmpproperty = null;
|
||||
}
|
||||
//var_dump($object->$tmpproperty);exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -804,10 +804,36 @@ class EmailCollector extends CommonObject
|
||||
$this->errors[] = $this->error;
|
||||
}
|
||||
}
|
||||
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
|
||||
elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $regforregex))
|
||||
{
|
||||
if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
|
||||
else $object->$tmpproperty = $reg[1];
|
||||
$valuecurrent='';
|
||||
if (preg_match('/^options_/', $tmpproperty)) $valuecurrent = $object->array_options[preg_replace('/^options_/', '', $tmpproperty)];
|
||||
else $valuecurrent = $object->$tmpproperty;
|
||||
|
||||
if ($regforregex[1] == 'SET' || empty($valuecurrent))
|
||||
{
|
||||
$valuetouse = $regforregex[2];
|
||||
$substitutionarray=array();
|
||||
$matcharray=array();
|
||||
preg_match_all('/__([a-z0-9]+(?:_[a-z0-9]+)?)__/i', $valuetouse, $matcharray);
|
||||
//var_dump($tmpproperty.' - '.$object->$tmpproperty.' - '.$valuetouse); var_dump($matcharray);
|
||||
if (is_array($matcharray[1])) // $matcharray[1] is array with list of substitution key found without the __
|
||||
{
|
||||
foreach($matcharray[1] as $keytoreplace)
|
||||
{
|
||||
if ($keytoreplace && isset($object->$keytoreplace))
|
||||
{
|
||||
$substitutionarray['__'.$keytoreplace.'__']=$object->$keytoreplace;
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($substitutionarray);
|
||||
dol_syslog(var_export($substitutionarray, true));
|
||||
//var_dump($substitutionarray);
|
||||
$valuetouse = make_substitutions($valuetouse, $substitutionarray);
|
||||
if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $valuetouse;
|
||||
else $object->$tmpproperty = $valuetouse;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -887,7 +913,8 @@ class EmailCollector extends CommonObject
|
||||
$host=dol_getprefix('email');
|
||||
|
||||
// Define the IMAP search string
|
||||
// See https://tools.ietf.org/html/rfc3501#section-6.4.4
|
||||
// See https://tools.ietf.org/html/rfc3501#section-6.4.4 for IMAPv4 (PHP not yet compatible)
|
||||
// See https://tools.ietf.org/html/rfc1064 page 13 for IMAPv2
|
||||
//$search='ALL';
|
||||
$search='UNDELETED'; // Seems not supported by some servers
|
||||
$searchhead='';
|
||||
@ -905,8 +932,13 @@ class EmailCollector extends CommonObject
|
||||
if ($rule['type'] == 'body') $search.=($search?' ':'').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'header') $search.=($search?' ':'').'HEADER '.$rule['rulevalue'];
|
||||
|
||||
if ($rule['type'] == 'notinsubject') $search.=($search?' ':'').'SUBJECT NOT "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'notinbody') $search.=($search?' ':'').'BODY NOT "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
|
||||
if ($rule['type'] == 'seen') $search.=($search?' ':'').'SEEN';
|
||||
if ($rule['type'] == 'unseen') $search.=($search?' ':'').'UNSEEN';
|
||||
if ($rule['type'] == 'unanswered') $search.=($search?' ':'').'UNANSWERED';
|
||||
if ($rule['type'] == 'answered') $search.=($search?' ':'').'ANSWERED';
|
||||
if ($rule['type'] == 'smaller') $search.=($search?' ':'').'SMALLER "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
if ($rule['type'] == 'larger') $search.=($search?' ':'').'LARGER "'.str_replace('"', '', $rule['rulevalue']).'"';
|
||||
|
||||
@ -945,9 +977,87 @@ class EmailCollector extends CommonObject
|
||||
// Loop on each email found
|
||||
if (! $error && ! empty($arrayofemail) && count($arrayofemail) > 0)
|
||||
{
|
||||
// Loop to get part html and plain
|
||||
/*
|
||||
0 multipart/mixed
|
||||
1 multipart/alternative
|
||||
1.1 text/plain
|
||||
1.2 text/html
|
||||
2 message/rfc822
|
||||
2 multipart/mixed
|
||||
2.1 multipart/alternative
|
||||
2.1.1 text/plain
|
||||
2.1.2 text/html
|
||||
2.2 message/rfc822
|
||||
2.2 multipart/alternative
|
||||
2.2.1 text/plain
|
||||
2.2.2 text/html
|
||||
*/
|
||||
/**
|
||||
* create_part_array
|
||||
*
|
||||
* @param Object $structure Structure
|
||||
* @param string $prefix prefix
|
||||
* @return array Array with number and object
|
||||
*/
|
||||
/*function createPartArray($structure, $prefix = "")
|
||||
{
|
||||
//print_r($structure);
|
||||
$part_array=array();
|
||||
if (count($structure->parts) > 0) { // There some sub parts
|
||||
foreach ($structure->parts as $count => $part) {
|
||||
addPartToArray($part, $prefix.($count+1), $part_array);
|
||||
}
|
||||
}else{ // Email does not have a seperate mime attachment for text
|
||||
$part_array[] = array('part_number' => $prefix.'1', 'part_object' => $structure);
|
||||
}
|
||||
return $part_array;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Sub function for createPartArray(). Only called by createPartArray() and itself.
|
||||
*
|
||||
* @param Object $obj Structure
|
||||
* @param string $partno Part no
|
||||
* @param array $part_array array
|
||||
* @return void
|
||||
*/
|
||||
/*function addPartToArray($obj, $partno, &$part_array)
|
||||
{
|
||||
$part_array[] = array('part_number' => $partno, 'part_object' => $obj);
|
||||
if ($obj->type == 2) { // Check to see if the part is an attached email message, as in the RFC-822 type
|
||||
//print_r($obj);
|
||||
if (array_key_exists('parts', $obj)) { // Check to see if the email has parts
|
||||
foreach ($obj->parts as $count => $part) {
|
||||
// Iterate here again to compensate for the broken way that imap_fetchbody() handles attachments
|
||||
if (count($part->parts) > 0) {
|
||||
foreach ($part->parts as $count2 => $part2) {
|
||||
addPartToArray($part2, $partno.".".($count2+1), $part_array);
|
||||
}
|
||||
}else{ // Attached email does not have a seperate mime attachment for text
|
||||
$part_array[] = array('part_number' => $partno.'.'.($count+1), 'part_object' => $obj);
|
||||
}
|
||||
}
|
||||
}else{ // Not sure if this is possible
|
||||
$part_array[] = array('part_number' => $partno.'.1', 'part_object' => $obj);
|
||||
}
|
||||
}else{ // If there are more sub-parts, expand them out.
|
||||
if (array_key_exists('parts', $obj)) {
|
||||
foreach ($obj->parts as $count => $p) {
|
||||
addPartToArray($p, $partno.".".($count+1), $part_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
dol_syslog("Start of loop on email", LOG_INFO, 1);
|
||||
|
||||
foreach($arrayofemail as $imapemail)
|
||||
{
|
||||
if ($nbemailprocessed > 100) break; // Do not process more than 100 email per launch
|
||||
if ($nbemailprocessed > 1000)
|
||||
{
|
||||
break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect
|
||||
}
|
||||
|
||||
$header = imap_fetchheader($connection, $imapemail, 0);
|
||||
$matches=array();
|
||||
@ -988,125 +1098,63 @@ class EmailCollector extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
//$message = imap_body($connection, $imapemail, 0);
|
||||
// GET Email meta datas
|
||||
$overview = imap_fetch_overview($connection, $imapemail, 0);
|
||||
|
||||
dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject);
|
||||
|
||||
// Parse IMAP email structure
|
||||
global $htmlmsg, $plainmsg, $charset, $attachments;
|
||||
$this->getmsg($connection, $imapemail);
|
||||
|
||||
//$htmlmsg,$plainmsg,$charset,$attachments
|
||||
$messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0);
|
||||
/*var_dump($plainmsg);
|
||||
var_dump($htmlmsg);
|
||||
var_dump($messagetext);*/
|
||||
/*var_dump($charset);
|
||||
var_dump($attachments);
|
||||
exit;*/
|
||||
|
||||
// Parse IMAP email structure
|
||||
/*
|
||||
$structure = imap_fetchstructure($connection, $imapemail, 0);
|
||||
|
||||
$partplain = $parthtml = -1;
|
||||
// Loop to get part html and plain
|
||||
/*
|
||||
0 multipart/mixed
|
||||
1 multipart/alternative
|
||||
1.1 text/plain
|
||||
1.2 text/html
|
||||
2 message/rfc822
|
||||
2 multipart/mixed
|
||||
2.1 multipart/alternative
|
||||
2.1.1 text/plain
|
||||
2.1.2 text/html
|
||||
2.2 message/rfc822
|
||||
2.2 multipart/alternative
|
||||
2.2.1 text/plain
|
||||
2.2.2 text/html
|
||||
*/
|
||||
/**
|
||||
* create_part_array
|
||||
*
|
||||
* @param Object $structure Structure
|
||||
* @param string $prefix prefix
|
||||
* @return array Array with number and object
|
||||
*/
|
||||
function createPartArray($structure, $prefix = "")
|
||||
{
|
||||
//print_r($structure);
|
||||
$part_array=array();
|
||||
if (count($structure->parts) > 0) { // There some sub parts
|
||||
foreach ($structure->parts as $count => $part) {
|
||||
add_part_to_array($part, $prefix.($count+1), $part_array);
|
||||
}
|
||||
}else{ // Email does not have a seperate mime attachment for text
|
||||
$part_array[] = array('part_number' => $prefix.'1', 'part_object' => $obj);
|
||||
}
|
||||
return $part_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub function for createPartArray(). Only called by createPartArray() and itself.
|
||||
*
|
||||
* @param Object $obj Structure
|
||||
* @param string $partno Part no
|
||||
* @param array $part_array array
|
||||
* @return void
|
||||
*/
|
||||
function addPartToArray($obj, $partno, &$part_array)
|
||||
{
|
||||
$part_array[] = array('part_number' => $partno, 'part_object' => $obj);
|
||||
if ($obj->type == 2) { // Check to see if the part is an attached email message, as in the RFC-822 type
|
||||
//print_r($obj);
|
||||
if (array_key_exists('parts', $obj)) { // Check to see if the email has parts
|
||||
foreach ($obj->parts as $count => $part) {
|
||||
// Iterate here again to compensate for the broken way that imap_fetchbody() handles attachments
|
||||
if (count($part->parts) > 0) {
|
||||
foreach ($part->parts as $count2 => $part2) {
|
||||
addPartToArray($part2, $partno.".".($count2+1), $part_array);
|
||||
}
|
||||
}else{ // Attached email does not have a seperate mime attachment for text
|
||||
$part_array[] = array('part_number' => $partno.'.'.($count+1), 'part_object' => $obj);
|
||||
}
|
||||
}
|
||||
}else{ // Not sure if this is possible
|
||||
$part_array[] = array('part_number' => $partno.'.1', 'part_object' => $obj);
|
||||
}
|
||||
}else{ // If there are more sub-parts, expand them out.
|
||||
if (array_key_exists('parts', $obj)) {
|
||||
foreach ($obj->parts as $count => $p) {
|
||||
addPartToArray($p, $partno.".".($count+1), $part_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$encodingplain = $encodinghtml = '';
|
||||
|
||||
$result = createPartArray($structure, '');
|
||||
//var_dump($result);exit;
|
||||
|
||||
foreach($result as $part)
|
||||
{
|
||||
if ($part['part_object']->subtype == 'HTML') $parthtml=$part['part_number'];
|
||||
if ($part['part_object']->subtype == 'PLAIN') $partplain=$part['part_number'];
|
||||
// $part['part_object']->type seems 0 for content
|
||||
// $part['part_object']->type seems 5 for attachment
|
||||
if (empty($part['part_object'])) continue;
|
||||
if ($part['part_object']->subtype == 'HTML')
|
||||
{
|
||||
$parthtml=$part['part_number'];
|
||||
if ($part['part_object']->encoding == 4)
|
||||
{
|
||||
$encodinghtml = 'aaa';
|
||||
}
|
||||
}
|
||||
if ($part['part_object']->subtype == 'PLAIN')
|
||||
{
|
||||
$partplain=$part['part_number'];
|
||||
if ($part['part_object']->encoding == 4)
|
||||
{
|
||||
$encodingplain = 'rr';
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($result); var_dump($partplain); var_dump($parthtml);
|
||||
|
||||
/* OLD CODE to get parthtml and partplain
|
||||
if (count($structure->parts) > 0) { // There some sub parts
|
||||
foreach($structure->parts as $key => $part)
|
||||
{
|
||||
if ($part->subtype == 'HTML') $parthtml=($key+1); // For example: $parthtml = 1 or 2
|
||||
if ($part->subtype == 'PLAIN') $partplain=($key+1);
|
||||
if ($part->subtype == 'ALTERNATIVE')
|
||||
{
|
||||
if (count($part->parts) > 0)
|
||||
{
|
||||
foreach($part->parts as $key2 => $part2)
|
||||
{
|
||||
if ($part2->subtype == 'HTML') $parthtml=($key+1).'.'.($key2+1); // For example: $parthtml = 1.1 or 1.2
|
||||
if ($part2->subtype == 'PLAIN') $partplain=($key+1).'.'.($key2+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$partplain=($key+1).'.1';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$partplain=1;
|
||||
}*/
|
||||
|
||||
/*var_dump($structure);
|
||||
var_dump($structure);
|
||||
var_dump($parthtml);
|
||||
var_dump($partplain);*/
|
||||
var_dump($partplain);
|
||||
|
||||
$messagetext = imap_fetchbody($connection, $imapemail, ($parthtml != '-1' ? $parthtml : ($partplain != '-1' ? $partplain : 1)), FT_PEEK);
|
||||
*/
|
||||
|
||||
//var_dump($messagetext);
|
||||
//var_dump($structure->parts[0]->parts);
|
||||
@ -1282,12 +1330,12 @@ class EmailCollector extends CommonObject
|
||||
elseif ($operation['type'] == 'ticket') $descriptiontitle = $langs->trans("TicketCreatedByEmailCollector", $msgid);
|
||||
else $descriptiontitle = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
|
||||
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Topic").' : '.$subject);
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("From").' : '.$fromstring);
|
||||
if ($sender) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Sender").' : '.$sender);
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("To").' : '.$to);
|
||||
//if ($cc) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Cc").' : '.$cc);
|
||||
//if ($bcc) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Bcc").' : '.$bcc);
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTopic").' : '.dol_escape_htmltag($subject));
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailFrom").($langs->trans("MailFrom") != 'From' ? ' (From)':'').' : '.dol_escape_htmltag($fromstring));
|
||||
if ($sender) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Sender").($langs->trans("Sender") != 'Sender' ? ' (Sender)':'').' : '.dol_escape_htmltag($sender));
|
||||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTo").($langs->trans("MailTo") != 'To' ? ' (To)':'').' : '.dol_escape_htmltag($to));
|
||||
if ($sendtocc) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailCC").($langs->trans("MailCC") != 'CC' ? ' (CC)':'').' : '.dol_escape_htmltag($sendtocc));
|
||||
//if ($bcc) $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Bcc").' : '.dol_escape_htmltag($bcc));
|
||||
}
|
||||
|
||||
// Search and create thirdparty
|
||||
@ -1350,11 +1398,11 @@ class EmailCollector extends CommonObject
|
||||
$this->errors[] = $this->error;
|
||||
}
|
||||
}
|
||||
elseif (preg_match('/^SET:(.*)$/', $valueforproperty, $reg))
|
||||
elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg))
|
||||
{
|
||||
//if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
|
||||
//else $object->$tmpproperty = $reg[1];
|
||||
$nametouseforthirdparty = $reg[1];
|
||||
$nametouseforthirdparty = $reg[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1421,15 +1469,15 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
if ($projectstatic->id > 0)
|
||||
{
|
||||
if ($projectfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby);
|
||||
if ($projectfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby);
|
||||
}
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
if ($thirdpartyfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
if ($contactfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
}
|
||||
|
||||
$description = $descriptiontitle;
|
||||
@ -1499,12 +1547,12 @@ class EmailCollector extends CommonObject
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
$projecttocreate->socid = $thirdpartystatic->id;
|
||||
if ($thirdpartyfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
$projecttocreate->contact_id = $contactstatic->id;
|
||||
if ($contactfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
}
|
||||
|
||||
$description = $descriptiontitle;
|
||||
@ -1521,45 +1569,65 @@ class EmailCollector extends CommonObject
|
||||
$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
|
||||
|
||||
$projecttocreate->title = $subject;
|
||||
$projecttocreate->date_start = $now;
|
||||
$projecttocreate->date_start = $date;
|
||||
$projecttocreate->date_end = '';
|
||||
$projecttocreate->opp_status = $id_opp_status;
|
||||
$projecttocreate->opp_percent = $percent_opp_status;
|
||||
$projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...');
|
||||
$projecttocreate->note_private = dol_concatdesc($descriptionfull, dol_string_nohtmltag($descriptionfull, 2));
|
||||
$projecttocreate->note_private = $descriptionfull;
|
||||
$projecttocreate->entity = $conf->entity;
|
||||
|
||||
// Get next project Ref
|
||||
$defaultref='';
|
||||
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0; $reldir='';
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
|
||||
$modProject = new $classname;
|
||||
|
||||
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
|
||||
}
|
||||
|
||||
$projecttocreate->ref = $defaultref;
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
// Overwrite values with values extracted from source email.
|
||||
// This may overwrite any $projecttocreate->xxx properties.
|
||||
$savesocid = $projecttocreate->socid;
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header);
|
||||
|
||||
// Set project ref if not yet defined
|
||||
if (empty($projecttocreate->ref))
|
||||
{
|
||||
// Get next project Ref
|
||||
$defaultref='';
|
||||
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0; $reldir='';
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
|
||||
$modProject = new $classname;
|
||||
|
||||
if ($savesocid > 0)
|
||||
{
|
||||
if ($savesocid != $projecttocreate->socid)
|
||||
{
|
||||
$errorforactions++;
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($projecttocreate->socid > 0)
|
||||
{
|
||||
$thirdpartystatic->fetch($projecttocreate->socid);
|
||||
}
|
||||
}
|
||||
|
||||
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
|
||||
}
|
||||
$projecttocreate->ref = $defaultref;
|
||||
}
|
||||
|
||||
if ($errorforthisaction)
|
||||
{
|
||||
$errorforactions++;
|
||||
@ -1569,7 +1637,7 @@ class EmailCollector extends CommonObject
|
||||
if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0))
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref with numbering template '.$modele;
|
||||
$this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1591,12 +1659,12 @@ class EmailCollector extends CommonObject
|
||||
if ($thirdpartystatic->id > 0)
|
||||
{
|
||||
$tickettocreate->socid = $thirdpartystatic->id;
|
||||
if ($thirdpartyfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
|
||||
}
|
||||
if ($contactstatic->id > 0)
|
||||
{
|
||||
$tickettocreate->contact_id = $contactstatic->id;
|
||||
if ($contactfoundby) $descriptionmeta .= dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
|
||||
}
|
||||
|
||||
$description = $descriptiontitle;
|
||||
@ -1616,44 +1684,65 @@ class EmailCollector extends CommonObject
|
||||
$tickettocreate->severity_code = 0;
|
||||
$tickettocreate->origin_email = $from;
|
||||
$tickettocreate->fk_user_create = $user->id;
|
||||
$tickettocreate->entity = $conf->entity;
|
||||
$tickettocreate->datec = $date;
|
||||
$tickettocreate->fk_project = $projectstatic->id;
|
||||
$tickettocreate->fk_soc = $thirdpartystatic->id;
|
||||
$tickettocreate->notify_tiers_at_create = 0;
|
||||
$tickettocreate->note_private = $descriptionfull;
|
||||
$tickettocreate->entity = $conf->entity;
|
||||
//$tickettocreate->fk_contact = $contactstatic->id;
|
||||
|
||||
// Get next project Ref
|
||||
$defaultref='';
|
||||
$modele = empty($conf->global->TICKET_ADDON)?'mod_ticket_simple':$conf->global->TICKET_ADDON;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0; $reldir='';
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
|
||||
$modTicket = new $classname;
|
||||
|
||||
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
|
||||
}
|
||||
|
||||
$tickettocreate->ref = $defaultref;
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
// Overwrite values with values extracted from source email.
|
||||
// This may overwrite any $projecttocreate->xxx properties.
|
||||
$savesocid = $tickettocreate->socid;
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header);
|
||||
|
||||
// Set ticket ref if not yet defined
|
||||
if (empty($tickettocreate->ref))
|
||||
{
|
||||
// Get next project Ref
|
||||
$defaultref='';
|
||||
$modele = empty($conf->global->TICKET_ADDON)?'mod_ticket_simple':$conf->global->TICKET_ADDON;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0; $reldir='';
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
$result=dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
|
||||
$modTicket = new $classname;
|
||||
|
||||
if ($savesocid > 0)
|
||||
{
|
||||
if ($savesocid != $tickettocreate->socid)
|
||||
{
|
||||
$errorforactions++;
|
||||
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($tickettocreate->socid > 0)
|
||||
{
|
||||
$thirdpartystatic->fetch($tickettocreate->socid);
|
||||
}
|
||||
}
|
||||
|
||||
$defaultref = $modTicket->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
|
||||
}
|
||||
$tickettocreate->ref = $defaultref;
|
||||
}
|
||||
|
||||
if ($errorforthisaction)
|
||||
{
|
||||
$errorforactions++;
|
||||
@ -1663,7 +1752,7 @@ class EmailCollector extends CommonObject
|
||||
if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0)
|
||||
{
|
||||
$errorforactions++;
|
||||
$this->error = "Failed to create ticket: Can't get a valid value for ticket Ref. Check the numbering module used to generate the reference in setup of module Ticket.";
|
||||
$this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1709,12 +1798,26 @@ class EmailCollector extends CommonObject
|
||||
$errorforemail++;
|
||||
}
|
||||
|
||||
unset($objectemail);
|
||||
unset($projectstatic);
|
||||
unset($thirdpartystatic);
|
||||
unset($contactstatic);
|
||||
|
||||
$nbemailprocessed++;
|
||||
|
||||
if (! $errorforemail)
|
||||
{
|
||||
$nbactiondone += $nbactiondoneforemail;
|
||||
$nbemailok++;
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
// Stop the loop to process email if we reach maximum collected per collect
|
||||
if ($this->maxemailpercollect > 0 && $nbemailok >= $this->maxemailpercollect)
|
||||
{
|
||||
dol_syslog("EmailCollect::doCollectOneCollector We reach maximum of ".$nbemailok." collected with success, so we stop this collector now.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1722,16 +1825,11 @@ class EmailCollector extends CommonObject
|
||||
|
||||
$this->db->rollback();
|
||||
}
|
||||
|
||||
$nbemailprocessed++;
|
||||
|
||||
unset($objectemail);
|
||||
unset($projectstatic);
|
||||
unset($thirdpartystatic);
|
||||
unset($contactstatic);
|
||||
}
|
||||
|
||||
$output=$langs->trans('XEmailsDoneYActionsDone', $nbemailprocessed, $nbemailok, $nbactiondone);
|
||||
|
||||
dol_syslog("End of loop on emails", LOG_INFO, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1757,4 +1855,136 @@ class EmailCollector extends CommonObject
|
||||
|
||||
return $error?-1:1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Loop to get part html and plain. Code found on PHP imap_fetchstructure documentation
|
||||
|
||||
/**
|
||||
* getmsg
|
||||
*
|
||||
* @param Object $mbox Structure
|
||||
* @param string $mid prefix
|
||||
* @return array Array with number and object
|
||||
*/
|
||||
private function getmsg($mbox, $mid)
|
||||
{
|
||||
// input $mbox = IMAP stream, $mid = message id
|
||||
// output all the following:
|
||||
global $charset,$htmlmsg,$plainmsg,$attachments;
|
||||
$htmlmsg = $plainmsg = $charset = '';
|
||||
$attachments = array();
|
||||
|
||||
// HEADER
|
||||
//$h = imap_header($mbox,$mid);
|
||||
// add code here to get date, from, to, cc, subject...
|
||||
|
||||
// BODY
|
||||
$s = imap_fetchstructure($mbox, $mid);
|
||||
|
||||
if (!$s->parts) // simple
|
||||
$this->getpart($mbox, $mid, $s, 0); // pass 0 as part-number
|
||||
else { // multipart: cycle through each part
|
||||
foreach ($s->parts as $partno0=>$p)
|
||||
{
|
||||
$this->getpart($mbox, $mid, $p, $partno0+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* partno string
|
||||
0 multipart/mixed
|
||||
1 multipart/alternative
|
||||
1.1 text/plain
|
||||
1.2 text/html
|
||||
2 message/rfc822
|
||||
2 multipart/mixed
|
||||
2.1 multipart/alternative
|
||||
2.1.1 text/plain
|
||||
2.1.2 text/html
|
||||
2.2 message/rfc822
|
||||
2.2 multipart/alternative
|
||||
2.2.1 text/plain
|
||||
2.2.2 text/html
|
||||
*/
|
||||
/**
|
||||
* Sub function for getpart(). Only called by createPartArray() and itself.
|
||||
*
|
||||
* @param Object $mbox Structure
|
||||
* @param string $mid Part no
|
||||
* @param Object $p Object p
|
||||
* @param string $partno Partno
|
||||
* @return void
|
||||
*/
|
||||
private function getpart($mbox, $mid, $p, $partno)
|
||||
{
|
||||
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
|
||||
global $htmlmsg,$plainmsg,$charset,$attachments;
|
||||
|
||||
// DECODE DATA
|
||||
$data = ($partno)?
|
||||
imap_fetchbody($mbox, $mid, $partno): // multipart
|
||||
imap_body($mbox, $mid); // simple
|
||||
// Any part may be encoded, even plain text messages, so check everything.
|
||||
if ($p->encoding==4)
|
||||
$data = quoted_printable_decode($data);
|
||||
elseif ($p->encoding==3)
|
||||
$data = base64_decode($data);
|
||||
|
||||
// PARAMETERS
|
||||
// get all parameters, like charset, filenames of attachments, etc.
|
||||
$params = array();
|
||||
if ($p->parameters)
|
||||
{
|
||||
foreach ($p->parameters as $x)
|
||||
{
|
||||
$params[strtolower($x->attribute)] = $x->value;
|
||||
}
|
||||
}
|
||||
if ($p->dparameters)
|
||||
{
|
||||
foreach ($p->dparameters as $x)
|
||||
{
|
||||
$params[strtolower($x->attribute)] = $x->value;
|
||||
}
|
||||
}
|
||||
|
||||
// ATTACHMENT
|
||||
// Any part with a filename is an attachment,
|
||||
// so an attached text file (type 0) is not mistaken as the message.
|
||||
if ($params['filename'] || $params['name']) {
|
||||
// filename may be given as 'Filename' or 'Name' or both
|
||||
$filename = ($params['filename'])? $params['filename'] : $params['name'];
|
||||
// filename may be encoded, so see imap_mime_header_decode()
|
||||
$attachments[$filename] = $data; // this is a problem if two files have same name
|
||||
}
|
||||
|
||||
// TEXT
|
||||
if ($p->type==0 && $data) {
|
||||
// Messages may be split in different parts because of inline attachments,
|
||||
// so append parts together with blank row.
|
||||
if (strtolower($p->subtype)=='plain')
|
||||
$plainmsg .= trim($data) ."\n\n";
|
||||
else
|
||||
$htmlmsg .= $data ."<br><br>";
|
||||
$charset = $params['charset']; // assume all parts are same charset
|
||||
}
|
||||
|
||||
// EMBEDDED MESSAGE
|
||||
// Many bounce notifications embed the original message as type 2,
|
||||
// but AOL uses type 1 (multipart), which is not handled here.
|
||||
// There are no PHP functions to parse embedded messages,
|
||||
// so this just appends the raw source to the main message.
|
||||
elseif ($p->type==2 && $data) {
|
||||
$plainmsg .= $data."\n\n";
|
||||
}
|
||||
|
||||
// SUBPART RECURSION
|
||||
if ($p->parts) {
|
||||
foreach ($p->parts as $partno0=>$p2)
|
||||
{
|
||||
$this->getpart($mbox, $mid, $p2, $partno.'.'.($partno0+1)); // 1.2, 1.2.1, etc.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ class EmailCollectorFilter extends CommonObject
|
||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
|
||||
return -1;
|
||||
}
|
||||
if (! in_array($this->type, array('seen','unseen','withtrackingid','withouttrackingid')) && empty($this->rulevalue))
|
||||
if (! in_array($this->type, array('seen', 'unseen', 'unanswered', 'answered', 'withtrackingid', 'withouttrackingid')) && empty($this->rulevalue))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SearchString"));
|
||||
|
||||
@ -171,7 +171,7 @@ if (empty($reshook))
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later if it fails
|
||||
$orig = clone $object;
|
||||
|
||||
$result=$object->createFromClone(GETPOST('fk_user_author', 'int'));
|
||||
$result=$object->createFromClone($user, GETPOST('fk_user_author', 'int'));
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
|
||||
@ -314,12 +314,13 @@ class ExpenseReport extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fk_user_author Id of new user
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fk_user_author Id of new user
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fk_user_author)
|
||||
public function createFromClone(User $user, $fk_user_author)
|
||||
{
|
||||
global $user,$hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -414,13 +414,12 @@ class PaymentExpenseReport extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new PaymentExpenseReport($this->db);
|
||||
|
||||
@ -134,7 +134,7 @@ if (empty($reshook))
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||
$orig = clone $object;
|
||||
|
||||
$result=$object->createFromClone($socid);
|
||||
$result=$object->createFromClone($user, $socid);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
|
||||
@ -1144,12 +1144,13 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($socid = 0)
|
||||
public function createFromClone(User $user, $socid = 0)
|
||||
{
|
||||
global $user,$hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -1409,11 +1409,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @return int New id of clone
|
||||
* @param User $user User making the clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone()
|
||||
public function createFromClone(User $user)
|
||||
{
|
||||
global $conf,$user,$langs,$hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -472,13 +472,12 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Commandefournisseurdispatch($this->db);
|
||||
|
||||
@ -955,7 +955,7 @@ $result = $object->updateline(
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$result=$object->createFromClone();
|
||||
$result=$object->createFromClone($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
@ -2467,8 +2467,8 @@ elseif (! empty($object->id))
|
||||
}
|
||||
|
||||
// Create bill
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
//if (! empty($conf->facture->enabled))
|
||||
//{
|
||||
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
@ -2476,7 +2476,7 @@ elseif (! empty($object->id))
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
|
||||
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) // statut 2 means approved
|
||||
@ -2843,6 +2843,7 @@ elseif (! empty($object->id))
|
||||
$modelmail='order_supplier_send';
|
||||
$defaulttopic='SendOrderRef';
|
||||
$diroutput = $conf->fournisseur->commande->dir_output;
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO';
|
||||
$trackid = 'sor'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
@ -298,11 +298,23 @@ if ($action == 'create' && !$error) {
|
||||
if ($socid)
|
||||
$res = $soc->fetch($socid);
|
||||
if ($res) {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$cond_reglement_id = $soc->cond_reglement_supplier_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_supplier_id;
|
||||
}
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : '';
|
||||
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
$listoforders = array();
|
||||
foreach ($selected as $sel) {
|
||||
$result = $objectsrc->fetch($sel);
|
||||
if ($result > 0) {
|
||||
$listoforders[] = $objectsrc->ref;
|
||||
}
|
||||
|
||||
if (empty($cond_reglement_id)) $cond_reglement_id = $objectsrc->cond_reglement_id;
|
||||
if (empty($mode_reglement_id)) $mode_reglement_id = $objectsrc->mode_reglement_id;
|
||||
}
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -350,15 +362,6 @@ if ($action == 'create' && !$error) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
$listoforders = array ();
|
||||
foreach ($selected as $sel) {
|
||||
$result = $objectsrc->fetch($sel);
|
||||
if ($result > 0) {
|
||||
$listoforders[] = $objectsrc->ref;
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array (
|
||||
'objectsrc' => $objectsrc,
|
||||
|
||||
@ -2789,7 +2789,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td><td></td><td></td></tr>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3228,6 +3228,7 @@ else
|
||||
$modelmail='invoice_supplier_send';
|
||||
$defaulttopic='SendBillRef';
|
||||
$diroutput = $conf->fournisseur->facture->dir_output;
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
|
||||
$trackid = 'sin'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
@ -584,7 +584,7 @@ IMG;
|
||||
// using windows libreoffice that must be in path
|
||||
// using linux/mac libreoffice that must be in path
|
||||
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
|
||||
$command ='soffice -headless -convert-to pdf -outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
|
||||
$command ='soffice --headless --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
|
||||
}
|
||||
elseif (preg_match('/unoconv/', $conf->global->MAIN_ODT_AS_PDF))
|
||||
{
|
||||
@ -635,6 +635,7 @@ IMG;
|
||||
//$command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name.' '.$dirname;
|
||||
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command,LOG_DEBUG);
|
||||
$retval=0; $output_arr=array();
|
||||
if ($execmethod == 1)
|
||||
{
|
||||
exec($command, $output_arr, $retval);
|
||||
@ -665,6 +666,7 @@ IMG;
|
||||
if ($retval == 0)
|
||||
{
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
|
||||
$filename=''; $linenum=0;
|
||||
if (headers_sent($filename, $linenum)) {
|
||||
throw new OdfException("headers already sent ($filename at $linenum)");
|
||||
}
|
||||
@ -681,16 +683,17 @@ IMG;
|
||||
}
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr,true), LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
|
||||
|
||||
if ($retval==126) {
|
||||
throw new OdfException('Permission execute convert script : ' . $command);
|
||||
}
|
||||
else {
|
||||
$errorstring='';
|
||||
foreach($output_arr as $line) {
|
||||
$errors.= $line."<br>";
|
||||
$errorstring.= $line."<br>";
|
||||
}
|
||||
throw new OdfException('ODT to PDF convert fail : ' . $errors);
|
||||
throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
service_name: travis-ci
|
||||
src_dir: .
|
||||
coverage_clover: clover.xml
|
||||
json_path: coveralls-upload.json
|
||||
@ -1,40 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- hhvm
|
||||
|
||||
env:
|
||||
global:
|
||||
- STRIPE_MOCK_VERSION=0.8.0
|
||||
matrix:
|
||||
- AUTOLOAD=1
|
||||
- AUTOLOAD=0
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
- stripe-mock
|
||||
|
||||
before_install:
|
||||
# Unpack and start stripe-mock so that the test suite can talk to it
|
||||
- |
|
||||
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
|
||||
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
|
||||
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
|
||||
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
|
||||
fi
|
||||
- |
|
||||
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
|
||||
STRIPE_MOCK_PID=$!
|
||||
|
||||
script: ./build.php ${AUTOLOAD}
|
||||
|
||||
after_script: ./vendor/bin/coveralls -v
|
||||
@ -1,5 +1,221 @@
|
||||
# Changelog
|
||||
|
||||
## 6.34.3 - 2019-05-01
|
||||
* [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis
|
||||
* [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed`
|
||||
|
||||
## 6.34.2 - 2019-04-26
|
||||
* [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries
|
||||
|
||||
## 6.34.1 - 2019-04-25
|
||||
* [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs
|
||||
|
||||
## 6.34.0 - 2019-04-24
|
||||
* [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs
|
||||
* [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues
|
||||
|
||||
## 6.33.0 - 2019-04-22
|
||||
* [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs
|
||||
|
||||
## 6.32.1 - 2019-04-19
|
||||
* [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc
|
||||
|
||||
## 6.32.0 - 2019-04-18
|
||||
* [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote`
|
||||
|
||||
## 6.31.5 - 2019-04-12
|
||||
* [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types
|
||||
* [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person`
|
||||
|
||||
## 6.31.4 - 2019-04-05
|
||||
* [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests
|
||||
|
||||
## 6.31.3 - 2019-04-02
|
||||
* [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0
|
||||
|
||||
## 6.31.2 - 2019-03-25
|
||||
* [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources
|
||||
|
||||
## 6.31.1 - 2019-03-22
|
||||
* [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants
|
||||
* [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants
|
||||
|
||||
## 6.31.0 - 2019-03-18
|
||||
* [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs
|
||||
* [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session`
|
||||
* [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader`
|
||||
|
||||
## 6.30.5 - 2019-03-11
|
||||
* [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata`
|
||||
|
||||
## 6.30.4 - 2019-02-27
|
||||
* [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc.
|
||||
|
||||
## 6.30.3 - 2019-02-26
|
||||
* [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported.
|
||||
|
||||
## 6.30.2 - 2019-02-25
|
||||
* [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events.
|
||||
|
||||
## 6.30.1 - 2019-02-16
|
||||
* [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
|
||||
|
||||
## 6.30.0 - 2019-02-12
|
||||
* [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision`
|
||||
|
||||
## 6.29.3 - 2019-01-31
|
||||
* [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes
|
||||
|
||||
## 6.29.2 - 2019-01-31
|
||||
* [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources
|
||||
|
||||
## 6.29.1 - 2019-01-25
|
||||
* [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents
|
||||
* [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option
|
||||
|
||||
## 6.29.0 - 2019-01-23
|
||||
* [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach.
|
||||
|
||||
## 6.28.1 - 2019-01-21
|
||||
* [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects
|
||||
|
||||
## 6.28.0 - 2019-01-03
|
||||
* [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances
|
||||
|
||||
## 6.27.0 - 2018-12-21
|
||||
* [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource
|
||||
|
||||
## 6.26.0 - 2018-12-11
|
||||
* [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections
|
||||
|
||||
## 6.25.0 - 2018-12-10
|
||||
* [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links
|
||||
|
||||
## 6.24.0 - 2018-11-28
|
||||
* [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource
|
||||
* [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring
|
||||
|
||||
## 6.23.0 - 2018-11-27
|
||||
* [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar
|
||||
|
||||
## 6.22.1 - 2018-11-20
|
||||
* [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/#549
|
||||
|
||||
## 6.22.0 - 2018-11-15
|
||||
* [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry
|
||||
|
||||
## 6.21.1 - 2018-11-12
|
||||
* [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error
|
||||
|
||||
## 6.21.0 - 2018-11-08
|
||||
* [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource.
|
||||
|
||||
## 6.20.1 - 2018-11-07
|
||||
* [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release
|
||||
|
||||
## 6.20.0 - 2018-10-30
|
||||
* [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource
|
||||
* [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource
|
||||
|
||||
## 6.19.5 - 2018-10-17
|
||||
* [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API.
|
||||
|
||||
## 6.19.4 - 2018-10-11
|
||||
* [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias
|
||||
|
||||
## 6.19.3 - 2018-10-09
|
||||
* [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source`
|
||||
|
||||
## 6.19.2 - 2018-10-08
|
||||
* [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array
|
||||
|
||||
## 6.19.1 - 2018-09-25
|
||||
* [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters
|
||||
|
||||
## 6.19.0 - 2018-09-24
|
||||
* [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal
|
||||
|
||||
## 6.18.0 - 2018-09-24
|
||||
* [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File`
|
||||
|
||||
## 6.17.2 - 2018-09-18
|
||||
* [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array
|
||||
|
||||
## 6.17.1 - 2018-09-14
|
||||
* [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays
|
||||
|
||||
## 6.17.0 - 2018-09-05
|
||||
* [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources
|
||||
|
||||
## 6.16.0 - 2018-08-23
|
||||
* [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries
|
||||
|
||||
## 6.15.0 - 2018-08-03
|
||||
* [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups
|
||||
|
||||
## 6.14.0 - 2018-08-02
|
||||
* [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links
|
||||
|
||||
## 6.13.0 - 2018-07-31
|
||||
* [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject`
|
||||
|
||||
## 6.12.0 - 2018-07-28
|
||||
* [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma
|
||||
|
||||
## 6.11.0 - 2018-07-26
|
||||
* [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing
|
||||
|
||||
## 6.10.4 - 2018-07-19
|
||||
* [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method
|
||||
|
||||
## 6.10.3 - 2018-07-16
|
||||
* [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests
|
||||
|
||||
## 6.10.2 - 2018-07-11
|
||||
* [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support
|
||||
|
||||
## 6.10.1 - 2018-07-10
|
||||
* [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice`
|
||||
|
||||
## 6.10.0 - 2018-06-28
|
||||
* [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()`
|
||||
|
||||
## 6.9.0 - 2018-06-28
|
||||
* [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents
|
||||
|
||||
## 6.8.2 - 2018-06-24
|
||||
* [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API
|
||||
|
||||
## 6.8.1 - 2018-06-13
|
||||
* [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors
|
||||
|
||||
## 6.8.0 - 2018-06-13
|
||||
* [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes
|
||||
|
||||
## 6.7.4 - 2018-05-29
|
||||
* [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type
|
||||
|
||||
## 6.7.3 - 2018-05-28
|
||||
* [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem`
|
||||
|
||||
## 6.7.2 - 2018-05-28
|
||||
* [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class
|
||||
|
||||
## 6.7.1 - 2018-05-13
|
||||
* [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy
|
||||
|
||||
## 6.7.0 - 2018-05-09
|
||||
* [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records
|
||||
|
||||
## 6.6.0 - 2018-04-11
|
||||
* [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives
|
||||
|
||||
## 6.5.0 - 2018-04-05
|
||||
* [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects
|
||||
|
||||
## 6.4.2 - 2018-03-17
|
||||
* [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event`
|
||||
|
||||
## 6.4.1 - 2018-03-02
|
||||
* [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc
|
||||
* [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2015 Stripe
|
||||
Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -62,7 +62,7 @@ Please see https://stripe.com/docs/api for up-to-date documentation.
|
||||
|
||||
### PHP 5.3
|
||||
|
||||
If you are using PHP 5.3, you can download v5.8.0 ([zip](https://github.com/stripe/stripe-php/archive/v5.8.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.8.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
|
||||
If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
|
||||
|
||||
### PHP 5.2
|
||||
|
||||
@ -181,9 +181,15 @@ retries are safe.
|
||||
|
||||
## Development
|
||||
|
||||
Get [Composer][composer]. For example, on Mac OS:
|
||||
|
||||
```bash
|
||||
brew install composer
|
||||
```
|
||||
|
||||
Install dependencies:
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
@ -191,8 +197,10 @@ The test suite depends on [stripe-mock], so make sure to fetch and run it from a
|
||||
background terminal ([stripe-mock's README][stripe-mock] also contains
|
||||
instructions for installing via Homebrew and other methods):
|
||||
|
||||
go get -u github.com/stripe/stripe-mock
|
||||
stripe-mock
|
||||
```bash
|
||||
go get -u github.com/stripe/stripe-mock
|
||||
stripe-mock
|
||||
```
|
||||
|
||||
Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:
|
||||
|
||||
@ -226,6 +234,7 @@ The method should be called once, before any request is sent to the API. The sec
|
||||
|
||||
See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.
|
||||
|
||||
[composer]: https://getcomposer.org/
|
||||
[connect]: https://stripe.com/connect
|
||||
[curl]: http://curl.haxx.se/docs/caextract.html
|
||||
[psr3]: http://www.php-fig.org/psr/psr-3/
|
||||
|
||||
@ -1 +1 @@
|
||||
6.4.1
|
||||
6.34.3
|
||||
|
||||
@ -13,7 +13,7 @@ if (!$autoload) {
|
||||
file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
passthru('composer install', $returnStatus);
|
||||
passthru('composer update', $returnStatus);
|
||||
if ($returnStatus !== 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -22,8 +22,9 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"satooshi/php-coveralls": "~0.6.1",
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
"php-coveralls/php-coveralls": "1.*",
|
||||
"squizlabs/php_codesniffer": "~2.0",
|
||||
"symfony/process": "~2.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Stripe\\" : "lib/" }
|
||||
|
||||
@ -5,6 +5,7 @@ require(dirname(__FILE__) . '/lib/Stripe.php');
|
||||
|
||||
// Utilities
|
||||
require(dirname(__FILE__) . '/lib/Util/AutoPagingIterator.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/CaseInsensitiveArray.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/LoggerInterface.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/DefaultLogger.php');
|
||||
require(dirname(__FILE__) . '/lib/Util/RandomGenerator.php');
|
||||
@ -48,6 +49,7 @@ require(dirname(__FILE__) . '/lib/ApiOperations/Update.php');
|
||||
|
||||
// Plumbing
|
||||
require(dirname(__FILE__) . '/lib/ApiResponse.php');
|
||||
require(dirname(__FILE__) . '/lib/RequestTelemetry.php');
|
||||
require(dirname(__FILE__) . '/lib/StripeObject.php');
|
||||
require(dirname(__FILE__) . '/lib/ApiRequestor.php');
|
||||
require(dirname(__FILE__) . '/lib/ApiResource.php');
|
||||
@ -55,6 +57,7 @@ require(dirname(__FILE__) . '/lib/SingletonApiResource.php');
|
||||
|
||||
// Stripe API Resources
|
||||
require(dirname(__FILE__) . '/lib/Account.php');
|
||||
require(dirname(__FILE__) . '/lib/AccountLink.php');
|
||||
require(dirname(__FILE__) . '/lib/AlipayAccount.php');
|
||||
require(dirname(__FILE__) . '/lib/ApplePayDomain.php');
|
||||
require(dirname(__FILE__) . '/lib/ApplicationFee.php');
|
||||
@ -66,40 +69,73 @@ require(dirname(__FILE__) . '/lib/BitcoinReceiver.php');
|
||||
require(dirname(__FILE__) . '/lib/BitcoinTransaction.php');
|
||||
require(dirname(__FILE__) . '/lib/Card.php');
|
||||
require(dirname(__FILE__) . '/lib/Charge.php');
|
||||
require(dirname(__FILE__) . '/lib/Checkout/Session.php');
|
||||
require(dirname(__FILE__) . '/lib/Collection.php');
|
||||
require(dirname(__FILE__) . '/lib/CountrySpec.php');
|
||||
require(dirname(__FILE__) . '/lib/Coupon.php');
|
||||
require(dirname(__FILE__) . '/lib/CreditNote.php');
|
||||
require(dirname(__FILE__) . '/lib/Customer.php');
|
||||
require(dirname(__FILE__) . '/lib/Discount.php');
|
||||
require(dirname(__FILE__) . '/lib/Dispute.php');
|
||||
require(dirname(__FILE__) . '/lib/EphemeralKey.php');
|
||||
require(dirname(__FILE__) . '/lib/Event.php');
|
||||
require(dirname(__FILE__) . '/lib/ExchangeRate.php');
|
||||
require(dirname(__FILE__) . '/lib/File.php');
|
||||
require(dirname(__FILE__) . '/lib/FileLink.php');
|
||||
require(dirname(__FILE__) . '/lib/FileUpload.php');
|
||||
require(dirname(__FILE__) . '/lib/Invoice.php');
|
||||
require(dirname(__FILE__) . '/lib/InvoiceItem.php');
|
||||
require(dirname(__FILE__) . '/lib/InvoiceLineItem.php');
|
||||
require(dirname(__FILE__) . '/lib/IssuerFraudRecord.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Authorization.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Card.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/CardDetails.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Cardholder.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Dispute.php');
|
||||
require(dirname(__FILE__) . '/lib/Issuing/Transaction.php');
|
||||
require(dirname(__FILE__) . '/lib/LoginLink.php');
|
||||
require(dirname(__FILE__) . '/lib/Order.php');
|
||||
require(dirname(__FILE__) . '/lib/OrderItem.php');
|
||||
require(dirname(__FILE__) . '/lib/OrderReturn.php');
|
||||
require(dirname(__FILE__) . '/lib/PaymentIntent.php');
|
||||
require(dirname(__FILE__) . '/lib/PaymentMethod.php');
|
||||
require(dirname(__FILE__) . '/lib/Payout.php');
|
||||
require(dirname(__FILE__) . '/lib/Person.php');
|
||||
require(dirname(__FILE__) . '/lib/Plan.php');
|
||||
require(dirname(__FILE__) . '/lib/Product.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueList.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php');
|
||||
require(dirname(__FILE__) . '/lib/Recipient.php');
|
||||
require(dirname(__FILE__) . '/lib/RecipientTransfer.php');
|
||||
require(dirname(__FILE__) . '/lib/Refund.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportType.php');
|
||||
require(dirname(__FILE__) . '/lib/Review.php');
|
||||
require(dirname(__FILE__) . '/lib/SKU.php');
|
||||
require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Source.php');
|
||||
require(dirname(__FILE__) . '/lib/SourceTransaction.php');
|
||||
require(dirname(__FILE__) . '/lib/Subscription.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionItem.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionSchedule.php');
|
||||
require(dirname(__FILE__) . '/lib/SubscriptionScheduleRevision.php');
|
||||
require(dirname(__FILE__) . '/lib/TaxId.php');
|
||||
require(dirname(__FILE__) . '/lib/TaxRate.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/ConnectionToken.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/Location.php');
|
||||
require(dirname(__FILE__) . '/lib/Terminal/Reader.php');
|
||||
require(dirname(__FILE__) . '/lib/ThreeDSecure.php');
|
||||
require(dirname(__FILE__) . '/lib/Token.php');
|
||||
require(dirname(__FILE__) . '/lib/Topup.php');
|
||||
require(dirname(__FILE__) . '/lib/Transfer.php');
|
||||
require(dirname(__FILE__) . '/lib/TransferReversal.php');
|
||||
require(dirname(__FILE__) . '/lib/UsageRecord.php');
|
||||
require(dirname(__FILE__) . '/lib/UsageRecordSummary.php');
|
||||
|
||||
// OAuth
|
||||
require(dirname(__FILE__) . '/lib/OAuth.php');
|
||||
|
||||
// Webhooks
|
||||
require(dirname(__FILE__) . '/lib/Webhook.php');
|
||||
require(dirname(__FILE__) . '/lib/WebhookEndpoint.php');
|
||||
require(dirname(__FILE__) . '/lib/WebhookSignature.php');
|
||||
|
||||
@ -7,37 +7,32 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $business_logo
|
||||
* @property string $business_name
|
||||
* @property string $business_primary_color
|
||||
* @property string $business_url
|
||||
* @property mixed $business_profile
|
||||
* @property string $business_type
|
||||
* @property mixed $capabilities
|
||||
* @property bool $charges_enabled
|
||||
* @property mixed $company
|
||||
* @property string $country
|
||||
* @property int $created
|
||||
* @property bool $debit_negative_balances
|
||||
* @property mixed $decline_charge_on
|
||||
* @property string $default_currency
|
||||
* @property bool $details_submitted
|
||||
* @property string $display_name
|
||||
* @property string $email
|
||||
* @property mixed $external_accounts
|
||||
* @property mixed $legal_entity
|
||||
* @property Collection $external_accounts
|
||||
* @property mixed $individual
|
||||
* @property StripeObject $metadata
|
||||
* @property mixed $payout_schedule
|
||||
* @property string $payout_statement_descriptor
|
||||
* @property bool $payouts_enabled
|
||||
* @property string $product_description
|
||||
* @property string $statement_descriptor
|
||||
* @property string $support_email
|
||||
* @property string $support_phone
|
||||
* @property string $timezone
|
||||
* @property mixed $requirements
|
||||
* @property mixed $settings
|
||||
* @property mixed $tos_acceptance
|
||||
* @property mixed $verification
|
||||
* @property string $type
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class Account extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "account";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Delete;
|
||||
@ -47,6 +42,37 @@ class Account extends ApiResource
|
||||
}
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's business type.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-business_type
|
||||
*/
|
||||
const BUSINESS_TYPE_COMPANY = 'company';
|
||||
const BUSINESS_TYPE_INDIVIDUAL = 'individual';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's capabilities.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
|
||||
*/
|
||||
const CAPABILITY_CARD_PAYMENTS = 'card_payments';
|
||||
const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments';
|
||||
const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's capability status.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-capabilities
|
||||
*/
|
||||
const CAPABILITY_STATUS_ACTIVE = 'active';
|
||||
const CAPABILITY_STATUS_INACTIVE = 'inactive';
|
||||
const CAPABILITY_STATUS_PENDING = 'pending';
|
||||
|
||||
/**
|
||||
* Possible string representations of an account's type.
|
||||
* @link https://stripe.com/docs/api/accounts/object#account_object-type
|
||||
*/
|
||||
const TYPE_CUSTOM = 'custom';
|
||||
const TYPE_EXPRESS = 'express';
|
||||
const TYPE_STANDARD = 'standard';
|
||||
|
||||
public static function getSavedNestedResources()
|
||||
{
|
||||
static $savedNestedResources = null;
|
||||
@ -61,6 +87,7 @@ class Account extends ApiResource
|
||||
|
||||
const PATH_EXTERNAL_ACCOUNTS = '/external_accounts';
|
||||
const PATH_LOGIN_LINKS = '/login_links';
|
||||
const PATH_PERSONS = '/persons';
|
||||
|
||||
public function instanceUrl()
|
||||
{
|
||||
@ -101,6 +128,21 @@ class Account extends ApiResource
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return Collection The list of persons.
|
||||
*/
|
||||
public function persons($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/persons';
|
||||
list($response, $opts) = $this->_request('get', $url, $params, $options);
|
||||
$obj = Util\Util::convertToStripeObject($response, $opts);
|
||||
$obj->setLastResponse($response);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $clientId
|
||||
* @param array|string|null $opts
|
||||
@ -113,11 +155,11 @@ class Account extends ApiResource
|
||||
'client_id' => $clientId,
|
||||
'stripe_user_id' => $this->id,
|
||||
];
|
||||
OAuth::deauthorize($params, $opts);
|
||||
return OAuth::deauthorize($params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to create the external account.
|
||||
* @param string|null $id The ID of the account on which to create the external account.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -129,7 +171,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@ -142,7 +184,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@ -155,7 +197,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account to which the external account belongs.
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
@ -168,11 +210,11 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param string|null $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return BankAccount|Card
|
||||
* @return Collection The list of external accounts (BankAccount or Card).
|
||||
*/
|
||||
public static function allExternalAccounts($id, $params = null, $opts = null)
|
||||
{
|
||||
@ -180,7 +222,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $id The ID of the account on which to create the login link.
|
||||
* @param string|null $id The ID of the account on which to create the login link.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -191,6 +233,69 @@ class Account extends ApiResource
|
||||
return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to create the person.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function createPerson($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function retrievePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function updatePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public static function deletePerson($id, $personId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to retrieve the persons.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Collection The list of persons.
|
||||
*/
|
||||
public static function allPersons($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
|
||||
}
|
||||
|
||||
public function serializeParameters($force = false)
|
||||
{
|
||||
$update = parent::serializeParameters($force);
|
||||
@ -203,6 +308,12 @@ class Account extends ApiResource
|
||||
$update['legal_entity'] = $entityUpdate;
|
||||
}
|
||||
}
|
||||
if (isset($this->_values['individual'])) {
|
||||
$individual = $this['individual'];
|
||||
if (($individual instanceof Person) && !isset($update['individual'])) {
|
||||
$update['individual'] = $individual->serializeParameters($force);
|
||||
}
|
||||
}
|
||||
return $update;
|
||||
}
|
||||
|
||||
@ -224,7 +335,9 @@ class Account extends ApiResource
|
||||
$update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v;
|
||||
|
||||
if ($update !== []) {
|
||||
if (!$originalValue || ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
|
||||
if (!$originalValue ||
|
||||
!array_key_exists($i, $originalValue) ||
|
||||
($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) {
|
||||
$updateArr[$i] = $update;
|
||||
}
|
||||
}
|
||||
|
||||
21
htdocs/includes/stripe/lib/AccountLink.php
Normal file
21
htdocs/includes/stripe/lib/AccountLink.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class AccountLink
|
||||
*
|
||||
* @property string $object
|
||||
* @property int $created
|
||||
* @property int $expires_at
|
||||
* @property string $url
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class AccountLink extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "account_link";
|
||||
|
||||
use ApiOperations\Create;
|
||||
}
|
||||
@ -12,6 +12,9 @@ namespace Stripe;
|
||||
*/
|
||||
class AlipayAccount extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "alipay_account";
|
||||
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Update;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ trait All
|
||||
if (!is_a($obj, 'Stripe\\Collection')) {
|
||||
$class = get_class($obj);
|
||||
$message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
|
||||
throw new Error\Api($message);
|
||||
throw new \Stripe\Error\Api($message);
|
||||
}
|
||||
$obj->setLastResponse($response);
|
||||
$obj->setRequestParams($params);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user