Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
55bef402c4
commit
e44865d8b5
@ -268,11 +268,11 @@ if ($action != 'export_csv')
|
|||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
|
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
|
||||||
$sql.= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nrows = $resql->num_rows;
|
$nrows = $resql->num_rows;
|
||||||
$opening_balances = Array();
|
$opening_balances = Array();
|
||||||
for($i = 0; $i < $nrows; $i++) {
|
for ($i = 0; $i < $nrows; $i++) {
|
||||||
$arr = $resql->fetch_array();
|
$arr = $resql->fetch_array();
|
||||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||||
}
|
}
|
||||||
@ -294,14 +294,14 @@ if ($action != 'export_csv')
|
|||||||
{
|
{
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap right">' . price($sous_total_debit) . '</td><td class="nowrap right">' . price($sous_total_credit) . '</td><td class="nowrap right">' . price(price2num($sous_total_credit - $sous_total_debit)) . '</td>';
|
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show first line of a break
|
// Show first line of a break
|
||||||
print '<tr class="trforbreak">';
|
print '<tr class="trforbreak">';
|
||||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_description;
|
$displayed_account = $root_account_description;
|
||||||
|
|||||||
@ -983,7 +983,7 @@ class AccountancyExport
|
|||||||
$racine_subledger_account = ''; // for records of type E leave this field blank
|
$racine_subledger_account = ''; // for records of type E leave this field blank
|
||||||
// }
|
// }
|
||||||
|
|
||||||
print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead
|
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
|
||||||
// MONT
|
// MONT
|
||||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||||
// CODC
|
// CODC
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Protection to avoid direct call of template
|
// Protection to avoid direct call of template
|
||||||
if (empty($conf) || ! is_object($conf))
|
if (empty($conf) || !is_object($conf))
|
||||||
{
|
{
|
||||||
print "Error, template page can't be called as URL";
|
print "Error, template page can't be called as URL";
|
||||||
exit;
|
exit;
|
||||||
@ -29,7 +29,7 @@ $format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
|||||||
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
||||||
$siren = $conf->global->MAIN_INFO_SIREN;
|
$siren = $conf->global->MAIN_INFO_SIREN;
|
||||||
|
|
||||||
$date_export = "_" . dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
header('Content-Type: text/csv');
|
||||||
@ -46,10 +46,10 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
|
|||||||
$search_date_end = dol_now();
|
$search_date_end = dol_now();
|
||||||
}
|
}
|
||||||
$datetouseforfilename = $search_date_end;
|
$datetouseforfilename = $search_date_end;
|
||||||
$tmparray=dol_getdate($datetouseforfilename);
|
$tmparray = dol_getdate($datetouseforfilename);
|
||||||
$fiscalmonth=empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START;
|
$fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||||
// Define end of month to use
|
// Define end of month to use
|
||||||
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon']=$fiscalmonth;
|
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon'] = $fiscalmonth;
|
||||||
else {
|
else {
|
||||||
$tmparray['mon'] = $fiscalmonth;
|
$tmparray['mon'] = $fiscalmonth;
|
||||||
$tmparray['year']++;
|
$tmparray['year']++;
|
||||||
@ -57,11 +57,11 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
|
|||||||
|
|
||||||
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
|
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
|
||||||
|
|
||||||
$completefilename = $siren . "FEC" . $endaccountingperiod . ".txt";
|
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format;
|
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||||
|
|||||||
@ -47,7 +47,7 @@ $search_note = GETPOST('search_note', 'alpha');
|
|||||||
$search_account = GETPOST('search_account', 'int');
|
$search_account = GETPOST('search_account', 'int');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$sall='';
|
$sall = '';
|
||||||
|
|
||||||
$date_select = GETPOST("date_select", 'alpha');
|
$date_select = GETPOST("date_select", 'alpha');
|
||||||
|
|
||||||
@ -388,16 +388,16 @@ print "</tr>\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
|
if (!empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
if (!empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||||
if (! empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
if (!empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||||
if (! empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
|
|||||||
@ -28,9 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin","other","blockedlog"));
|
$langs->loadLangs(array("admin", "other", "blockedlog"));
|
||||||
|
|
||||||
if (! $user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
|
if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
@ -77,22 +77,22 @@ if (preg_match('/del_(.*)/', $action, $reg))
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$block_static = new BlockedLog($db);
|
$block_static = new BlockedLog($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("BlockedLogSetup"));
|
llxHeader('', $langs->trans("BlockedLogSetup"));
|
||||||
|
|
||||||
$linkback='';
|
$linkback = '';
|
||||||
if (GETPOST('withtab', 'alpha'))
|
if (GETPOST('withtab', 'alpha'))
|
||||||
{
|
{
|
||||||
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback);
|
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback);
|
||||||
|
|
||||||
if (GETPOST('withtab', 'alpha'))
|
if (GETPOST('withtab', 'alpha'))
|
||||||
{
|
{
|
||||||
$head=blockedlogadmin_prepare_head();
|
$head = blockedlogadmin_prepare_head();
|
||||||
dol_fiche_head($head, 'blockedlog', '', -1);
|
dol_fiche_head($head, 'blockedlog', '', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,16 +135,16 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|||||||
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
|
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
|
||||||
|
|
||||||
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_country";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||||
$sql.= " WHERE active > 0";
|
$sql .= " WHERE active > 0";
|
||||||
|
|
||||||
$countryArray=array();
|
$countryArray = array();
|
||||||
$resql=$db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $db->fetch_object($resql))
|
while ($obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ print '</td>';
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="titlefield">';
|
print '<td class="titlefield">';
|
||||||
print $langs->trans("ListOfTrackedEvents").'</td><td>';
|
print $langs->trans("ListOfTrackedEvents").'</td><td>';
|
||||||
$arrayoftrackedevents=$block_static->trackedevents;
|
$arrayoftrackedevents = $block_static->trackedevents;
|
||||||
foreach($arrayoftrackedevents as $key => $val)
|
foreach ($arrayoftrackedevents as $key => $val)
|
||||||
{
|
{
|
||||||
print $key.' - '.$langs->trans($val).'<br>';
|
print $key.' - '.$langs->trans($val).'<br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,62 +35,62 @@ function printDropdownBookmarksList()
|
|||||||
|
|
||||||
$langs->load("bookmarks");
|
$langs->load("bookmarks");
|
||||||
|
|
||||||
$url= $_SERVER["PHP_SELF"];
|
$url = $_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
if (! empty($_SERVER["QUERY_STRING"]))
|
if (!empty($_SERVER["QUERY_STRING"]))
|
||||||
{
|
{
|
||||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
$url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
global $sortfield,$sortorder;
|
global $sortfield, $sortorder;
|
||||||
$tmpurl='';
|
$tmpurl = '';
|
||||||
// No urlencode, all param $url will be urlencoded later
|
// No urlencode, all param $url will be urlencoded later
|
||||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
if ($sortfield) $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.$sortfield;
|
||||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
if ($sortorder) $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.$sortorder;
|
||||||
if (is_array($_POST))
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach ($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
if (preg_match('/^search_/', $key) && $val != '') $tmpurl .= ($tmpurl ? '&' : '').$key.'='.$val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
$url .= ($tmpurl ? '?'.$tmpurl : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||||
$searchForm.= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
$searchForm .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
||||||
$searchForm.= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||||
$searchForm.= '</form>';
|
$searchForm .= '</form>';
|
||||||
|
|
||||||
// Url to list bookmark
|
// Url to list bookmark
|
||||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||||
$listbtn.= '<span class="fa fa-list"></span> '.$langs->trans('Bookmarks').'</a>';
|
$listbtn .= '<span class="fa fa-list"></span> '.$langs->trans('Bookmarks').'</a>';
|
||||||
|
|
||||||
// Url to go on create new bookmark page
|
// Url to go on create new bookmark page
|
||||||
$newbtn = '';
|
$newbtn = '';
|
||||||
if (! empty($user->rights->bookmark->creer))
|
if (!empty($user->rights->bookmark->creer))
|
||||||
{
|
{
|
||||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||||
$newbtn.= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
|
$newbtn .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
|
||||||
$newbtn.= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
$newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$bookmarkList='<div id="dropdown-bookmarks-list" >';
|
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
|
||||||
// Menu with list of bookmarks
|
// Menu with list of bookmarks
|
||||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
$sql .= " AND entity IN (".getEntity('bookmarks').")";
|
||||||
$sql.= " ORDER BY position";
|
$sql .= " ORDER BY position";
|
||||||
if ($resql = $db->query($sql) )
|
if ($resql = $db->query($sql))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i = 0;
|
||||||
while (($conf->global->BOOKMARKS_SHOW_IN_MENU == 0 || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
while (($conf->global->BOOKMARKS_SHOW_IN_MENU == 0 || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$bookmarkList.='<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' href="'.dol_escape_htmltag($obj->url).'" >';
|
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
|
||||||
$bookmarkList.= dol_escape_htmltag($obj->title);
|
$bookmarkList .= dol_escape_htmltag($obj->title);
|
||||||
$bookmarkList.='</a>';
|
$bookmarkList .= '</a>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,23 +98,23 @@ function printDropdownBookmarksList()
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
$bookmarkList.='</div>';
|
$bookmarkList .= '</div>';
|
||||||
|
|
||||||
$html = '
|
$html = '
|
||||||
<!-- search input -->
|
<!-- search input -->
|
||||||
<div class="dropdown-header bookmark-header">
|
<div class="dropdown-header bookmark-header">
|
||||||
' . $searchForm . '
|
' . $searchForm.'
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
$html.= '
|
$html .= '
|
||||||
<!-- Menu Body -->
|
<!-- Menu Body -->
|
||||||
<div class="bookmark-body dropdown-body">
|
<div class="bookmark-body dropdown-body">
|
||||||
'.$bookmarkList.'
|
'.$bookmarkList.'
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
$html.= '
|
$html .= '
|
||||||
<!-- Menu Footer-->
|
<!-- Menu Footer-->
|
||||||
<div class="bookmark-footer">
|
<div class="bookmark-footer">
|
||||||
'.$newbtn.$listbtn.'
|
'.$newbtn.$listbtn.'
|
||||||
|
|||||||
@ -96,14 +96,14 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
$hookmanager->initHooks(array('ordercard', 'globalcard'));
|
||||||
|
|
||||||
$usercanread = $user->rights->commande->lire;
|
$usercanread = $user->rights->commande->lire;
|
||||||
$usercancreate = $user->rights->commande->creer;
|
$usercancreate = $user->rights->commande->creer;
|
||||||
$usercanclose = $user->rights->commande->cloturer;
|
$usercanclose = $user->rights->commande->cloturer;
|
||||||
$usercandelete = $user->rights->commande->supprimer;
|
$usercandelete = $user->rights->commande->supprimer;
|
||||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)));
|
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate)));
|
||||||
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
|
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler)));
|
||||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
||||||
|
|
||||||
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
|
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
|
||||||
@ -1594,25 +1594,25 @@ if ($action == 'create' && $usercancreate)
|
|||||||
$note_public = $object->getDefaultCreateValueFor('note_public');
|
$note_public = $object->getDefaultCreateValueFor('note_public');
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
print '<form name="crea_commande" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
|
print '<input type="hidden" name="socid" value="'.$soc->id.'">'."\n";
|
||||||
print '<input type="hidden" name="remise_percent" value="' . $soc->remise_percent . '">';
|
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_percent.'">';
|
||||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
print '<input type="hidden" name="originid" value="'.$originid.'">';
|
||||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="'.$currency_tx.'">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Reference
|
// Reference
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td>' . $langs->trans("Draft") . '</td></tr>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
|
||||||
|
|
||||||
// Reference client
|
// Reference client
|
||||||
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td>';
|
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||||
if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid))
|
if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && !empty($origin) && !empty($originid))
|
||||||
print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>';
|
print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>';
|
||||||
else
|
else
|
||||||
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
||||||
@ -2556,7 +2556,7 @@ if ($action == 'create' && $usercancreate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Valid
|
// Valid
|
||||||
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || ! empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate)
|
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
|||||||
|
|
||||||
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
|
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
|
||||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||||
if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
if (empty($entity) && !empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||||
$entity = '0,'.join(',', array_keys($arrayofentities));
|
$entity = '0,'.join(',', array_keys($arrayofentities));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ if ($result && $action == "dl" && !$error)
|
|||||||
{
|
{
|
||||||
foreach ($filesarray as $key => $file)
|
foreach ($filesarray as $key => $file)
|
||||||
{
|
{
|
||||||
foreach($file['files'] as $filecursor) {
|
foreach ($file['files'] as $filecursor) {
|
||||||
if (file_exists($filecursor["fullname"])) {
|
if (file_exists($filecursor["fullname"])) {
|
||||||
$zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]);
|
$zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]);
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
|
|||||||
$mc->getInfo($conf->entity);
|
$mc->getInfo($conf->entity);
|
||||||
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
|
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if (! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||||
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
|
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
|
||||||
} else {
|
} else {
|
||||||
print $mc->label;
|
print $mc->label;
|
||||||
@ -567,9 +567,9 @@ if (!empty($date_start) && !empty($date_stop))
|
|||||||
|
|
||||||
// File link
|
// File link
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($data['files']))
|
if (!empty($data['files']))
|
||||||
{
|
{
|
||||||
foreach($data['files'] as $filecursor) {
|
foreach ($data['files'] as $filecursor) {
|
||||||
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a><br>';
|
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,18 +39,18 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies'));
|
|||||||
// Security check
|
// Security check
|
||||||
if (isset($_GET["account"]) || isset($_GET["ref"]))
|
if (isset($_GET["account"]) || isset($_GET["ref"]))
|
||||||
{
|
{
|
||||||
$id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:'');
|
$id = isset($_GET["account"]) ? $_GET["account"] : (isset($_GET["ref"]) ? $_GET["ref"] : '');
|
||||||
}
|
}
|
||||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
|
||||||
if ($user->socid) $socid=$user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||||
|
|
||||||
|
|
||||||
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
|
$vline = isset($_GET["vline"]) ? $_GET["vline"] : $_POST["vline"];
|
||||||
$page=isset($_GET["page"])?$_GET["page"]:0;
|
$page = isset($_GET["page"]) ? $_GET["page"] : 0;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('banktreso','globalcard'));
|
$hookmanager->initHooks(array('banktreso', 'globalcard'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -61,9 +61,9 @@ $helpurl = "";
|
|||||||
llxHeader('', $title, $helpurl);
|
llxHeader('', $title, $helpurl);
|
||||||
|
|
||||||
$societestatic = new Societe($db);
|
$societestatic = new Societe($db);
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic = new Facture($db);
|
||||||
$facturefournstatic=new FactureFournisseur($db);
|
$facturefournstatic = new FactureFournisseur($db);
|
||||||
$socialcontribstatic=new ChargeSociales($db);
|
$socialcontribstatic = new ChargeSociales($db);
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
@ -81,17 +81,17 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
if ($_GET["account"])
|
if ($_GET["account"])
|
||||||
{
|
{
|
||||||
$result=$object->fetch($_GET["account"]);
|
$result = $object->fetch($_GET["account"]);
|
||||||
}
|
}
|
||||||
if ($_GET["ref"])
|
if ($_GET["ref"])
|
||||||
{
|
{
|
||||||
$result=$object->fetch(0, $_GET["ref"]);
|
$result = $object->fetch(0, $_GET["ref"]);
|
||||||
$_GET["account"]=$object->id;
|
$_GET["account"] = $object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Onglets
|
// Onglets
|
||||||
$head=bank_prepare_head($object);
|
$head = bank_prepare_head($object);
|
||||||
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), 0, 'account');
|
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), 0, 'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
@ -103,7 +103,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$solde = $object->solde(0);
|
$solde = $object->solde(0);
|
||||||
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)$colspan = 6;
|
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)$colspan = 6;
|
||||||
else $colspan = 5;
|
else $colspan = 5;
|
||||||
|
|
||||||
// Show next coming entries
|
// Show next coming entries
|
||||||
@ -114,7 +114,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("DateDue").'</td>';
|
print '<td>'.$langs->trans("DateDue").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED )print '<td>'.$langs->trans("Entity").'</td>';
|
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)print '<td>'.$langs->trans("Entity").'</td>';
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("Debit").'</td>';
|
print '<td class="right">'.$langs->trans("Debit").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("Credit").'</td>';
|
print '<td class="right">'.$langs->trans("Credit").'</td>';
|
||||||
@ -139,54 +139,54 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
|
|
||||||
// Customer invoices
|
// Customer invoices
|
||||||
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
|
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
|
||||||
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
|
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE f.entity IN (".getEntity('invoice').")";
|
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||||
$sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
|
$sql .= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
|
||||||
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
|
$sql .= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
|
||||||
$sql.= " ORDER BY dlr ASC";
|
$sql .= " ORDER BY dlr ASC";
|
||||||
$sqls[] = $sql;
|
$sqls[] = $sql;
|
||||||
|
|
||||||
// Supplier invoices
|
// Supplier invoices
|
||||||
$sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
|
$sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
|
||||||
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
|
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE ff.entity = ".$conf->entity;
|
$sql .= " WHERE ff.entity = ".$conf->entity;
|
||||||
$sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
|
$sql .= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
|
||||||
$sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
|
$sql .= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
|
||||||
$sql.= " ORDER BY dlr ASC";
|
$sql .= " ORDER BY dlr ASC";
|
||||||
$sqls[] = $sql;
|
$sqls[] = $sql;
|
||||||
|
|
||||||
// Social contributions
|
// Social contributions
|
||||||
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
|
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
|
||||||
$sql.= ", cs.fk_account";
|
$sql .= ", cs.fk_account";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
|
||||||
$sql.= " WHERE cs.entity = ".$conf->entity;
|
$sql .= " WHERE cs.entity = ".$conf->entity;
|
||||||
$sql.= " AND cs.paye = 0"; // Not paid
|
$sql .= " AND cs.paye = 0"; // Not paid
|
||||||
$sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
|
$sql .= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
|
||||||
$sql.= " ORDER BY dlr ASC";
|
$sql .= " ORDER BY dlr ASC";
|
||||||
$sqls[] = $sql;
|
$sqls[] = $sql;
|
||||||
|
|
||||||
// others sql
|
// others sql
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if(empty($reshook) and isset($hookmanager->resArray['sql'])){
|
if (empty($reshook) and isset($hookmanager->resArray['sql'])) {
|
||||||
$sqls[] = $hookmanager->resArray['sql'];
|
$sqls[] = $hookmanager->resArray['sql'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
$tab_sqlobjOrder=array();
|
$tab_sqlobjOrder = array();
|
||||||
$tab_sqlobj=array();
|
$tab_sqlobj = array();
|
||||||
|
|
||||||
foreach($sqls as $sql){
|
foreach ($sqls as $sql) {
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
while ($sqlobj = $db->fetch_object($resql)) {
|
while ($sqlobj = $db->fetch_object($resql)) {
|
||||||
$tab_sqlobj[] = $sqlobj;
|
$tab_sqlobj[] = $sqlobj;
|
||||||
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
|
$tab_sqlobjOrder[] = $db->jdate($sqlobj->dlr);
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
@ -195,13 +195,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort array
|
// Sort array
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
array_multisort($tab_sqlobjOrder, $tab_sqlobj);
|
array_multisort($tab_sqlobjOrder, $tab_sqlobj);
|
||||||
|
|
||||||
// Apply distinct filter
|
// Apply distinct filter
|
||||||
foreach ($tab_sqlobj as $key=>$value) {
|
foreach ($tab_sqlobj as $key=>$value) {
|
||||||
$tab_sqlobj[$key] = "'" . serialize($value) . "'";
|
$tab_sqlobj[$key] = "'".serialize($value)."'";
|
||||||
}
|
}
|
||||||
$tab_sqlobj = array_unique($tab_sqlobj);
|
$tab_sqlobj = array_unique($tab_sqlobj);
|
||||||
foreach ($tab_sqlobj as $key=>$value) {
|
foreach ($tab_sqlobj as $key=>$value) {
|
||||||
@ -221,52 +221,52 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
|
|
||||||
if ($obj->family == 'invoice_supplier')
|
if ($obj->family == 'invoice_supplier')
|
||||||
{
|
{
|
||||||
$showline=1;
|
$showline = 1;
|
||||||
// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
|
// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
|
||||||
//$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
|
//$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
|
||||||
if ($showline)
|
if ($showline)
|
||||||
{
|
{
|
||||||
$ref=$obj->ref;
|
$ref = $obj->ref;
|
||||||
$facturefournstatic->ref=$ref;
|
$facturefournstatic->ref = $ref;
|
||||||
$facturefournstatic->id=$obj->objid;
|
$facturefournstatic->id = $obj->objid;
|
||||||
$facturefournstatic->type=$obj->type;
|
$facturefournstatic->type = $obj->type;
|
||||||
$ref = $facturefournstatic->getNomUrl(1, '');
|
$ref = $facturefournstatic->getNomUrl(1, '');
|
||||||
|
|
||||||
$societestatic->id = $obj->socid;
|
$societestatic->id = $obj->socid;
|
||||||
$societestatic->name = $obj->name;
|
$societestatic->name = $obj->name;
|
||||||
$refcomp=$societestatic->getNomUrl(1, '', 24);
|
$refcomp = $societestatic->getNomUrl(1, '', 24);
|
||||||
|
|
||||||
$totalpayment = -1*$facturefournstatic->getSommePaiement(); // Payment already done
|
$totalpayment = -1 * $facturefournstatic->getSommePaiement(); // Payment already done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($obj->family == 'invoice')
|
if ($obj->family == 'invoice')
|
||||||
{
|
{
|
||||||
$facturestatic->ref=$obj->ref;
|
$facturestatic->ref = $obj->ref;
|
||||||
$facturestatic->id=$obj->objid;
|
$facturestatic->id = $obj->objid;
|
||||||
$facturestatic->type=$obj->type;
|
$facturestatic->type = $obj->type;
|
||||||
$ref = $facturestatic->getNomUrl(1, '');
|
$ref = $facturestatic->getNomUrl(1, '');
|
||||||
|
|
||||||
$societestatic->id = $obj->socid;
|
$societestatic->id = $obj->socid;
|
||||||
$societestatic->name = $obj->name;
|
$societestatic->name = $obj->name;
|
||||||
$refcomp=$societestatic->getNomUrl(1, '', 24);
|
$refcomp = $societestatic->getNomUrl(1, '', 24);
|
||||||
|
|
||||||
$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
|
$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
|
||||||
$totalpayment+= $facturestatic->getSumDepositsUsed();
|
$totalpayment += $facturestatic->getSumDepositsUsed();
|
||||||
$totalpayment+= $facturestatic->getSumCreditNotesUsed();
|
$totalpayment += $facturestatic->getSumCreditNotesUsed();
|
||||||
}
|
}
|
||||||
if ($obj->family == 'social_contribution')
|
if ($obj->family == 'social_contribution')
|
||||||
{
|
{
|
||||||
$socialcontribstatic->ref=$obj->ref;
|
$socialcontribstatic->ref = $obj->ref;
|
||||||
$socialcontribstatic->id=$obj->objid;
|
$socialcontribstatic->id = $obj->objid;
|
||||||
$socialcontribstatic->label=$obj->type;
|
$socialcontribstatic->label = $obj->type;
|
||||||
$ref = $socialcontribstatic->getNomUrl(1, 24);
|
$ref = $socialcontribstatic->getNomUrl(1, 24);
|
||||||
|
|
||||||
$totalpayment = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
|
$totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
|
$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
|
||||||
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if(empty($reshook)){
|
if (empty($reshook)) {
|
||||||
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
|
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
|
||||||
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
|
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
|
||||||
$totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
|
$totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
|
||||||
@ -287,7 +287,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>".$ref."</td>";
|
print "<td>".$ref."</td>";
|
||||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||||
if($obj->family == 'invoice'){
|
if ($obj->family == 'invoice') {
|
||||||
$mc->getInfo($obj->entity);
|
$mc->getInfo($obj->entity);
|
||||||
print "<td>".$mc->label."</td>";
|
print "<td>".$mc->label."</td>";
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
// Other lines
|
// Other lines
|
||||||
$parameters = array('solde' => $solde);
|
$parameters = array('solde' => $solde);
|
||||||
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if(empty($reshook)){
|
if (empty($reshook)) {
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
|
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4581,18 +4581,18 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->statut != Facture::STATUS_VALIDATED) return false;
|
if ($this->statut != Facture::STATUS_VALIDATED) return false;
|
||||||
|
|
||||||
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
||||||
if($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit))
|
if ($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit))
|
||||||
{
|
{
|
||||||
$totalpaye = $this->getSommePaiement();
|
$totalpaye = $this->getSommePaiement();
|
||||||
$totalpaye = floatval($totalpaye);
|
$totalpaye = floatval($totalpaye);
|
||||||
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
|
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
|
||||||
if($totalpaye >= 0 && $RetainedWarrantyAmount>= 0)
|
if ($totalpaye >= 0 && $RetainedWarrantyAmount >= 0)
|
||||||
{
|
{
|
||||||
if( ($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay) )
|
if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay))
|
||||||
{
|
{
|
||||||
$hasDelay = 1;
|
$hasDelay = 1;
|
||||||
}
|
}
|
||||||
elseif($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay) )
|
elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay))
|
||||||
{
|
{
|
||||||
$hasDelay = 1;
|
$hasDelay = 1;
|
||||||
}
|
}
|
||||||
@ -4657,8 +4657,8 @@ class Facture extends CommonInvoice
|
|||||||
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
|
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rounding < 0){
|
if ($rounding < 0) {
|
||||||
$rounding=min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
return round($retainedWarrantyAmount, 2);
|
return round($retainedWarrantyAmount, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -594,36 +594,36 @@ class Paiement extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
$bank_line_id=0;
|
$bank_line_id = 0;
|
||||||
|
|
||||||
if (! empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
if ($accountid <= 0)
|
if ($accountid <= 0)
|
||||||
{
|
{
|
||||||
$this->error='Bad value for parameter accountid='.$accountid;
|
$this->error = 'Bad value for parameter accountid='.$accountid;
|
||||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR);
|
dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$this->fk_account=$accountid;
|
$this->fk_account = $accountid;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
dol_syslog("$user->id, $mode, $label, $this->fk_account, $emetteur_nom, $emetteur_banque");
|
dol_syslog("$user->id, $mode, $label, $this->fk_account, $emetteur_nom, $emetteur_banque");
|
||||||
|
|
||||||
$acc = new Account($this->db);
|
$acc = new Account($this->db);
|
||||||
$result=$acc->fetch($this->fk_account);
|
$result = $acc->fetch($this->fk_account);
|
||||||
|
|
||||||
$totalamount=$this->amount;
|
$totalamount = $this->amount;
|
||||||
if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility
|
if (empty($totalamount)) $totalamount = $this->total; // For backward compatibility
|
||||||
|
|
||||||
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
||||||
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) $totalamount=$this->multicurrency_amount;
|
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) $totalamount = $this->multicurrency_amount;
|
||||||
|
|
||||||
if ($mode == 'payment_supplier') $totalamount=-$totalamount;
|
if ($mode == 'payment_supplier') $totalamount = -$totalamount;
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
$bank_line_id = $acc->addline(
|
$bank_line_id = $acc->addline(
|
||||||
|
|||||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('compta', 'banks', 'bills'));
|
$langs->loadLangs(array('compta', 'banks', 'bills'));
|
||||||
@ -97,8 +97,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_day_lim = '';
|
$search_day_lim = '';
|
||||||
$search_year_lim = '';
|
$search_year_lim = '';
|
||||||
$search_month_lim = '';
|
$search_month_lim = '';
|
||||||
$search_project_ref='';
|
$search_project_ref = '';
|
||||||
$search_project='';
|
$search_project = '';
|
||||||
$toselect = '';
|
$toselect = '';
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
}
|
}
|
||||||
@ -112,25 +112,25 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formsocialcontrib = new FormSocialContrib($db);
|
$formsocialcontrib = new FormSocialContrib($db);
|
||||||
$chargesociale_static = new ChargeSociales($db);
|
$chargesociale_static = new ChargeSociales($db);
|
||||||
if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
|
if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SocialContributions"));
|
llxHeader('', $langs->trans("SocialContributions"));
|
||||||
|
|
||||||
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
||||||
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
|
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
|
||||||
if (! empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||||
$sql .= " c.libelle as type_label,";
|
$sql .= " c.libelle as type_label,";
|
||||||
$sql .= " SUM(pc.amount) as alreadypayed";
|
$sql .= " SUM(pc.amount) as alreadypayed";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
if (! empty($conf->projet->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet";
|
if (!empty($conf->projet->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
$sql .= " WHERE cs.fk_type = c.id";
|
$sql .= " WHERE cs.fk_type = c.id";
|
||||||
$sql .= " AND cs.entity = ".$conf->entity;
|
$sql .= " AND cs.entity = ".$conf->entity;
|
||||||
// Search criteria
|
// Search criteria
|
||||||
if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref);
|
if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref);
|
||||||
if ($search_label) $sql .= natural_search("cs.libelle", $search_label);
|
if ($search_label) $sql .= natural_search("cs.libelle", $search_label);
|
||||||
if (! empty($conf->projet->enabled)) if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref);
|
if (!empty($conf->projet->enabled)) if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||||
if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1);
|
if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1);
|
||||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status);
|
if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status);
|
||||||
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
|
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
|
||||||
@ -173,7 +173,7 @@ if ($resql)
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
|
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||||
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
||||||
if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
|
if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
|
||||||
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
|
if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
|
||||||
@ -229,7 +229,7 @@ if ($resql)
|
|||||||
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
|
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Ref Project
|
// Ref Project
|
||||||
if (! empty($conf->projet->enabled)) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
|
if (!empty($conf->projet->enabled)) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
|
||||||
// Date
|
// Date
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
// Period end date
|
// Period end date
|
||||||
@ -258,7 +258,7 @@ if ($resql)
|
|||||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||||
if (! empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
if (!empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
@ -276,10 +276,10 @@ if ($resql)
|
|||||||
$chargesociale_static->ref = $obj->id;
|
$chargesociale_static->ref = $obj->id;
|
||||||
$chargesociale_static->label = $obj->label;
|
$chargesociale_static->label = $obj->label;
|
||||||
$chargesociale_static->type_label = $obj->type_label;
|
$chargesociale_static->type_label = $obj->type_label;
|
||||||
if (! empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
$projectstatic->id=$obj->project_id;
|
$projectstatic->id = $obj->project_id;
|
||||||
$projectstatic->ref=$obj->project_ref;
|
$projectstatic->ref = $obj->project_ref;
|
||||||
$projectstatic->title=$obj->project_label;
|
$projectstatic->title = $obj->project_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -297,7 +297,7 @@ if ($resql)
|
|||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
// Project Ref
|
// Project Ref
|
||||||
if (! empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
if ($obj->project_id > 0)
|
if ($obj->project_id > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,23 +31,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("products","categories","errors",'accountancy'));
|
$langs->loadLangs(array("products", "categories", "errors", 'accountancy'));
|
||||||
|
|
||||||
// Security pack (data & check)
|
// Security pack (data & check)
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
if ($user->socid > 0) $socid = $user->socid;
|
if ($user->socid > 0) $socid = $user->socid;
|
||||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat');
|
if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
|
||||||
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||||
|
|
||||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||||
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta");
|
if (GETPOST("modecompta")) $modecompta = GETPOST("modecompta");
|
||||||
|
|
||||||
$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = isset($_GET["sortorder"]) ? $_GET["sortorder"] : $_POST["sortorder"];
|
||||||
$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = isset($_GET["sortfield"]) ? $_GET["sortfield"] : $_POST["sortfield"];
|
||||||
if (! $sortorder) $sortorder="asc";
|
if (!$sortorder) $sortorder = "asc";
|
||||||
if (! $sortfield) $sortfield="ref";
|
if (!$sortfield) $sortfield = "ref";
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
$selected_cat = (int) GETPOST('search_categ', 'int');
|
$selected_cat = (int) GETPOST('search_categ', 'int');
|
||||||
@ -58,11 +58,11 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
|
|||||||
}
|
}
|
||||||
// product/service
|
// product/service
|
||||||
$selected_type = GETPOST('search_type', 'int');
|
$selected_type = GETPOST('search_type', 'int');
|
||||||
if ($selected_type =='') $selected_type = -1;
|
if ($selected_type == '') $selected_type = -1;
|
||||||
|
|
||||||
// Date range
|
// Date range
|
||||||
$year=GETPOST("year");
|
$year = GETPOST("year");
|
||||||
$month=GETPOST("month");
|
$month = GETPOST("month");
|
||||||
$date_startyear = GETPOST("date_startyear");
|
$date_startyear = GETPOST("date_startyear");
|
||||||
$date_startmonth = GETPOST("date_startmonth");
|
$date_startmonth = GETPOST("date_startmonth");
|
||||||
$date_startday = GETPOST("date_startday");
|
$date_startday = GETPOST("date_startday");
|
||||||
@ -79,51 +79,51 @@ if (empty($year))
|
|||||||
$month_current = strftime("%m", dol_now());
|
$month_current = strftime("%m", dol_now());
|
||||||
$year_start = $year;
|
$year_start = $year;
|
||||||
}
|
}
|
||||||
$date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
|
$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
|
||||||
$date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
|
$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
|
||||||
// Quarter
|
// Quarter
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
{
|
{
|
||||||
$q=GETPOST("q", "int");
|
$q = GETPOST("q", "int");
|
||||||
if (empty($q))
|
if (empty($q))
|
||||||
{
|
{
|
||||||
// We define date_start and date_end
|
// We define date_start and date_end
|
||||||
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
$month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||||
$year_end=$year_start;
|
$year_end = $year_start;
|
||||||
$month_end=$month_start;
|
$month_end = $month_start;
|
||||||
if (! GETPOST("month")) // If month not forced
|
if (!GETPOST("month")) // If month not forced
|
||||||
{
|
{
|
||||||
if (! GETPOST('year') && $month_start > $month_current)
|
if (!GETPOST('year') && $month_start > $month_current)
|
||||||
{
|
{
|
||||||
$year_start--;
|
$year_start--;
|
||||||
$year_end--;
|
$year_end--;
|
||||||
}
|
}
|
||||||
$month_end=$month_start-1;
|
$month_end = $month_start - 1;
|
||||||
if ($month_end < 1) $month_end=12;
|
if ($month_end < 1) $month_end = 12;
|
||||||
else $year_end++;
|
else $year_end++;
|
||||||
}
|
}
|
||||||
$date_start=dol_get_first_day($year_start, $month_start, false); $date_end=dol_get_last_day($year_end, $month_end, false);
|
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($q==1) { $date_start=dol_get_first_day($year_start, 1, false); $date_end=dol_get_last_day($year_start, 3, false); }
|
if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
|
||||||
if ($q==2) { $date_start=dol_get_first_day($year_start, 4, false); $date_end=dol_get_last_day($year_start, 6, false); }
|
if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
|
||||||
if ($q==3) { $date_start=dol_get_first_day($year_start, 7, false); $date_end=dol_get_last_day($year_start, 9, false); }
|
if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
|
||||||
if ($q==4) { $date_start=dol_get_first_day($year_start, 10, false); $date_end=dol_get_last_day($year_start, 12, false); }
|
if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO We define q
|
// TODO We define q
|
||||||
}
|
}
|
||||||
|
|
||||||
// $date_start and $date_end are defined. We force $year_start and $nbofyear
|
// $date_start and $date_end are defined. We force $year_start and $nbofyear
|
||||||
$tmps=dol_getdate($date_start);
|
$tmps = dol_getdate($date_start);
|
||||||
$year_start = $tmps['year'];
|
$year_start = $tmps['year'];
|
||||||
$tmpe=dol_getdate($date_end);
|
$tmpe = dol_getdate($date_end);
|
||||||
$year_end = $tmpe['year'];
|
$year_end = $tmpe['year'];
|
||||||
$nbofyear = ($year_end - $year_start) + 1;
|
$nbofyear = ($year_end - $year_start) + 1;
|
||||||
|
|
||||||
$commonparams=array();
|
$commonparams = array();
|
||||||
if (!empty($modecompta)) $commonparams['modecompta']=$modecompta;
|
if (!empty($modecompta)) $commonparams['modecompta'] = $modecompta;
|
||||||
if (!empty($sortorder)) $commonparams['sortorder'] = $sortorder;
|
if (!empty($sortorder)) $commonparams['sortorder'] = $sortorder;
|
||||||
if (!empty($sortfield)) $commonparams['sortfield'] = $sortfield;
|
if (!empty($sortfield)) $commonparams['sortfield'] = $sortfield;
|
||||||
|
|
||||||
@ -142,15 +142,15 @@ $tableparams = array();
|
|||||||
if (!empty($selected_cat)) $tableparams['search_categ'] = $selected_cat;
|
if (!empty($selected_cat)) $tableparams['search_categ'] = $selected_cat;
|
||||||
if (!empty($selected_soc)) $tableparams['search_soc'] = $selected_soc;
|
if (!empty($selected_soc)) $tableparams['search_soc'] = $selected_soc;
|
||||||
if (!empty($selected_type)) $tableparams['search_type'] = $selected_type;
|
if (!empty($selected_type)) $tableparams['search_type'] = $selected_type;
|
||||||
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
$tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
|
||||||
|
|
||||||
// Adding common parameters
|
// Adding common parameters
|
||||||
$allparams = array_merge($commonparams, $headerparams, $tableparams);
|
$allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||||
$headerparams = array_merge($commonparams, $headerparams);
|
$headerparams = array_merge($commonparams, $headerparams);
|
||||||
$tableparams = array_merge($commonparams, $tableparams);
|
$tableparams = array_merge($commonparams, $tableparams);
|
||||||
|
|
||||||
foreach($allparams as $key => $value) {
|
foreach ($allparams as $key => $value) {
|
||||||
$paramslink .= '&' . $key . '=' . $value;
|
$paramslink .= '&'.$key.'='.$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,127 +160,127 @@ foreach($allparams as $key => $value) {
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||||
if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES";
|
if ($modecompta == "BOOKKEEPING") $modecompta = "CREANCES-DETTES";
|
||||||
if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES";
|
if ($modecompta == "BOOKKEEPINGCOLLECTED") $modecompta = "RECETTES-DEPENSES";
|
||||||
|
|
||||||
// Show report header
|
// Show report header
|
||||||
if ($modecompta=="CREANCES-DETTES") {
|
if ($modecompta == "CREANCES-DETTES") {
|
||||||
$name=$langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices");
|
$name = $langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode = $langs->trans("CalcModeDebt");
|
||||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
|
||||||
$description=$langs->trans("RulesCADue");
|
$description = $langs->trans("RulesCADue");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$description.= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
} else {
|
} else {
|
||||||
$description.= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
}
|
}
|
||||||
|
|
||||||
$builddate=dol_now();
|
$builddate = dol_now();
|
||||||
}
|
}
|
||||||
elseif ($modecompta=="RECETTES-DEPENSES")
|
elseif ($modecompta == "RECETTES-DEPENSES")
|
||||||
{
|
{
|
||||||
$name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");
|
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode = $langs->trans("CalcModeEngagement");
|
||||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
|
|
||||||
$description=$langs->trans("RulesCAIn");
|
$description = $langs->trans("RulesCAIn");
|
||||||
$description.= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
|
|
||||||
$builddate=dol_now();
|
$builddate = dol_now();
|
||||||
}
|
}
|
||||||
elseif ($modecompta=="BOOKKEEPING")
|
elseif ($modecompta == "BOOKKEEPING")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
elseif ($modecompta=="BOOKKEEPINGCOLLECTED")
|
elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
|
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
|
||||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||||
else $periodlink = '';
|
else $periodlink = '';
|
||||||
|
|
||||||
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
|
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$name=array();
|
$name = array();
|
||||||
|
|
||||||
// SQL request
|
// SQL request
|
||||||
$catotal=0;
|
$catotal = 0;
|
||||||
$catotal_ht=0;
|
$catotal_ht = 0;
|
||||||
$qtytotal=0;
|
$qtytotal = 0;
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
|
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
|
||||||
$sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
|
$sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
|
||||||
$sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
|
$sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
if($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
|
if ($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
|
||||||
$sql.= ",".MAIN_DB_PREFIX."facturedet as l";
|
$sql .= ",".MAIN_DB_PREFIX."facturedet as l";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
||||||
if ($selected_cat === -2) // Without any category
|
if ($selected_cat === -2) // Without any category
|
||||||
{
|
{
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||||
}
|
}
|
||||||
elseif ($selected_cat) // Into a specific category
|
elseif ($selected_cat) // Into a specific category
|
||||||
{
|
{
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
|
$sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||||
}
|
}
|
||||||
$sql.= " WHERE l.fk_facture = f.rowid";
|
$sql .= " WHERE l.fk_facture = f.rowid";
|
||||||
$sql.= " AND f.fk_statut in (1,2)";
|
$sql .= " AND f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql.= " AND f.type IN (0,1,2,5)";
|
$sql .= " AND f.type IN (0,1,2,5)";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " AND f.type IN (0,1,2,3,5)";
|
$sql .= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
}
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
if ($selected_type >=0)
|
if ($selected_type >= 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND l.product_type = ".$selected_type;
|
$sql .= " AND l.product_type = ".$selected_type;
|
||||||
}
|
}
|
||||||
if ($selected_cat === -2) // Without any category
|
if ($selected_cat === -2) // Without any category
|
||||||
{
|
{
|
||||||
$sql.=" AND cp.fk_product is null";
|
$sql .= " AND cp.fk_product is null";
|
||||||
}
|
}
|
||||||
elseif ($selected_cat) { // Into a specific category
|
elseif ($selected_cat) { // Into a specific category
|
||||||
$sql.= " AND (c.rowid = ".$selected_cat;
|
$sql .= " AND (c.rowid = ".$selected_cat;
|
||||||
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
|
if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
|
||||||
$sql.= ")";
|
$sql .= ")";
|
||||||
$sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
|
$sql .= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
|
||||||
}
|
}
|
||||||
if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
|
if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
|
||||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
|
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
dol_syslog("cabyprodserv", LOG_DEBUG);
|
dol_syslog("cabyprodserv", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i=0;
|
$i = 0;
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$amount_ht[$obj->rowid] = $obj->amount;
|
$amount_ht[$obj->rowid] = $obj->amount;
|
||||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||||
$qty[$obj->rowid] = $obj->qty;
|
$qty[$obj->rowid] = $obj->qty;
|
||||||
$name[$obj->rowid] = $obj->ref . ' - ' . $obj->label;
|
$name[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
||||||
$type[$obj->rowid] = $obj->product_type;
|
$type[$obj->rowid] = $obj->product_type;
|
||||||
$catotal_ht+=$obj->amount;
|
$catotal_ht += $obj->amount;
|
||||||
$catotal+=$obj->amount_ttc;
|
$catotal += $obj->amount_ttc;
|
||||||
$qtytotal+=$obj->qty;
|
$qtytotal += $obj->qty;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -288,25 +288,25 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show Array
|
// Show Array
|
||||||
$i=0;
|
$i = 0;
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
// Extra parameters management
|
// Extra parameters management
|
||||||
foreach($headerparams as $key => $value)
|
foreach ($headerparams as $key => $value)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$moreforfilter='';
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
|
|
||||||
// Category filter
|
// Category filter
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true);
|
print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true);
|
||||||
print ' ';
|
print ' ';
|
||||||
print $langs->trans("SubCats") . '? ';
|
print $langs->trans("SubCats").'? ';
|
||||||
print '<input type="checkbox" name="subcat" value="yes"';
|
print '<input type="checkbox" name="subcat" value="yes"';
|
||||||
if ($subcat) {
|
if ($subcat) {
|
||||||
print ' checked';
|
print ' checked';
|
||||||
@ -314,12 +314,12 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
print '>';
|
print '>';
|
||||||
// type filter (produit/service)
|
// type filter (produit/service)
|
||||||
print ' ';
|
print ' ';
|
||||||
print $langs->trans("Type"). ': ';
|
print $langs->trans("Type").': ';
|
||||||
$form->select_type_of_lines(isset($selected_type)?$selected_type:-1, 'search_type', 1, 1, 1);
|
$form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1);
|
||||||
|
|
||||||
//select thirdparty
|
//select thirdparty
|
||||||
print '</br>';
|
print '</br>';
|
||||||
print $langs->trans("ThirdParty") . ': ' . $form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
|
print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td colspan="5" class="right">';
|
print '<td colspan="5" class="right">';
|
||||||
@ -391,16 +391,16 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (count($name)) {
|
if (count($name)) {
|
||||||
foreach($name as $key=>$value) {
|
foreach ($name as $key=>$value) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Product
|
// Product
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$fullname=$name[$key];
|
$fullname = $name[$key];
|
||||||
if ($key > 0) {
|
if ($key > 0) {
|
||||||
$linkname='<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"), $type[$key]==0?'product':'service').' '.$fullname.'</a>';
|
$linkname = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"), $type[$key] == 0 ? 'product' : 'service').' '.$fullname.'</a>';
|
||||||
} else {
|
} else {
|
||||||
$linkname=$langs->trans("PaymentsNotLinkedToProduct");
|
$linkname = $langs->trans("PaymentsNotLinkedToProduct");
|
||||||
}
|
}
|
||||||
print $linkname;
|
print $linkname;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -465,7 +465,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
|
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
|
||||||
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
|
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
|
||||||
// Because there is no way to know this, this report is not relevant.
|
// Because there is no way to know this, this report is not relevant.
|
||||||
print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '<br>';
|
print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant").'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -32,9 +32,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
|||||||
*/
|
*/
|
||||||
class box_clients extends ModeleBoxes
|
class box_clients extends ModeleBoxes
|
||||||
{
|
{
|
||||||
public $boxcode="lastcustomers";
|
public $boxcode = "lastcustomers";
|
||||||
public $boximg="object_company";
|
public $boximg = "object_company";
|
||||||
public $boxlabel="BoxLastCustomers";
|
public $boxlabel = "BoxLastCustomers";
|
||||||
public $depends = array("societe");
|
public $depends = array("societe");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,9 +61,9 @@ class box_clients extends ModeleBoxes
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
// disable box for such cases
|
// disable box for such cases
|
||||||
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
|
if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled = 0; // disabled by this option
|
||||||
|
|
||||||
$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
|
$this->hidden = !($user->rights->societe->lire && empty($user->socid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,33 +77,33 @@ class box_clients extends ModeleBoxes
|
|||||||
global $user, $langs, $conf;
|
global $user, $langs, $conf;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max = $max;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
$thirdpartystatic=new Societe($this->db);
|
$thirdpartystatic = new Societe($this->db);
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));
|
||||||
|
|
||||||
if ($user->rights->societe->lire)
|
if ($user->rights->societe->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid";
|
$sql = "SELECT s.nom as name, s.rowid as socid";
|
||||||
$sql.= ", s.code_client";
|
$sql .= ", s.code_client";
|
||||||
$sql.= ", s.client";
|
$sql .= ", s.client";
|
||||||
$sql.= ", s.code_fournisseur";
|
$sql .= ", s.code_fournisseur";
|
||||||
$sql.= ", s.fournisseur";
|
$sql .= ", s.fournisseur";
|
||||||
$sql.= ", s.code_compta";
|
$sql .= ", s.code_compta";
|
||||||
$sql.= ", s.code_compta_fournisseur";
|
$sql .= ", s.code_compta_fournisseur";
|
||||||
$sql.= ", s.logo";
|
$sql .= ", s.logo";
|
||||||
$sql.= ", s.email";
|
$sql .= ", s.email";
|
||||||
$sql.= ", s.datec, s.tms, s.status, s.entity";
|
$sql .= ", s.datec, s.tms, s.status, s.entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE s.client IN (1, 3)";
|
$sql .= " WHERE s.client IN (1, 3)";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($user->socid) $sql.= " AND s.rowid = $user->socid";
|
if ($user->socid) $sql .= " AND s.rowid = $user->socid";
|
||||||
$sql.= " ORDER BY s.tms DESC";
|
$sql .= " ORDER BY s.tms DESC";
|
||||||
$sql.= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -115,8 +115,8 @@ class box_clients extends ModeleBoxes
|
|||||||
while ($line < $num)
|
while ($line < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$datec=$this->db->jdate($objp->datec);
|
$datec = $this->db->jdate($objp->datec);
|
||||||
$datem=$this->db->jdate($objp->tms);
|
$datem = $this->db->jdate($objp->tms);
|
||||||
$thirdpartystatic->id = $objp->socid;
|
$thirdpartystatic->id = $objp->socid;
|
||||||
$thirdpartystatic->name = $objp->name;
|
$thirdpartystatic->name = $objp->name;
|
||||||
$thirdpartystatic->code_client = $objp->code_client;
|
$thirdpartystatic->code_client = $objp->code_client;
|
||||||
@ -148,7 +148,7 @@ class box_clients extends ModeleBoxes
|
|||||||
$line++;
|
$line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers"));
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,9 +32,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
|||||||
*/
|
*/
|
||||||
class box_fournisseurs extends ModeleBoxes
|
class box_fournisseurs extends ModeleBoxes
|
||||||
{
|
{
|
||||||
public $boxcode="lastsuppliers";
|
public $boxcode = "lastsuppliers";
|
||||||
public $boximg="object_company";
|
public $boximg = "object_company";
|
||||||
public $boxlabel="BoxLastSuppliers";
|
public $boxlabel = "BoxLastSuppliers";
|
||||||
public $depends = array("fournisseur");
|
public $depends = array("fournisseur");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
|
$this->hidden = !($user->rights->societe->lire && empty($user->socid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,28 +74,28 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max = $max;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
$thirdpartystatic=new Societe($this->db);
|
$thirdpartystatic = new Societe($this->db);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
$thirdpartytmp=new Fournisseur($this->db);
|
$thirdpartytmp = new Fournisseur($this->db);
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
|
||||||
|
|
||||||
if ($user->rights->societe->lire)
|
if ($user->rights->societe->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
|
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
|
||||||
$sql.= " s.code_fournisseur, s.email as semail,";
|
$sql .= " s.code_fournisseur, s.email as semail,";
|
||||||
$sql.= " s.logo, s.code_compta_fournisseur, s.entity";
|
$sql .= " s.logo, s.code_compta_fournisseur, s.entity";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE s.fournisseur = 1";
|
$sql .= " WHERE s.fournisseur = 1";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
|
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||||
$sql.= " ORDER BY s.tms DESC ";
|
$sql .= " ORDER BY s.tms DESC ";
|
||||||
$sql.= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -106,8 +106,8 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
while ($line < $num)
|
while ($line < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$datec=$this->db->jdate($objp->datec);
|
$datec = $this->db->jdate($objp->datec);
|
||||||
$datem=$this->db->jdate($objp->tms);
|
$datem = $this->db->jdate($objp->tms);
|
||||||
$thirdpartytmp->id = $objp->socid;
|
$thirdpartytmp->id = $objp->socid;
|
||||||
$thirdpartytmp->name = $objp->name;
|
$thirdpartytmp->name = $objp->name;
|
||||||
$thirdpartytmp->email = $objp->semail;
|
$thirdpartytmp->email = $objp->semail;
|
||||||
@ -135,7 +135,7 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
$line++;
|
$line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$line][0] = array(
|
if ($num == 0) $this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'class="center"',
|
'td' => 'class="center"',
|
||||||
'text'=>$langs->trans("NoRecordedSuppliers"),
|
'text'=>$langs->trans("NoRecordedSuppliers"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -33,9 +33,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
|||||||
*/
|
*/
|
||||||
class box_propales extends ModeleBoxes
|
class box_propales extends ModeleBoxes
|
||||||
{
|
{
|
||||||
public $boxcode="lastpropals";
|
public $boxcode = "lastpropals";
|
||||||
public $boximg="object_propal";
|
public $boximg = "object_propal";
|
||||||
public $boxlabel="BoxLastProposals";
|
public $boxlabel = "BoxLastProposals";
|
||||||
public $depends = array("propal"); // conf->propal->enabled
|
public $depends = array("propal"); // conf->propal->enabled
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +61,7 @@ class box_propales extends ModeleBoxes
|
|||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->hidden = ! ($user->rights->propale->lire);
|
$this->hidden = !($user->rights->propale->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,45 +74,45 @@ class box_propales extends ModeleBoxes
|
|||||||
{
|
{
|
||||||
global $user, $langs, $conf;
|
global $user, $langs, $conf;
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max = $max;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
$propalstatic=new Propal($this->db);
|
$propalstatic = new Propal($this->db);
|
||||||
$societestatic = new Societe($this->db);
|
$societestatic = new Societe($this->db);
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals", $max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max));
|
||||||
|
|
||||||
if ($user->rights->propale->lire)
|
if ($user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.entity, s.email,";
|
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.entity, s.email,";
|
||||||
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
|
$sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
$sql .= " WHERE p.fk_soc = s.rowid";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql .= " AND p.entity = ".$conf->entity;
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
|
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||||
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";
|
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
|
||||||
else $sql.= " ORDER BY p.tms DESC, p.ref DESC ";
|
else $sql .= " ORDER BY p.tms DESC, p.ref DESC ";
|
||||||
$sql.= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$line = 0;
|
$line = 0;
|
||||||
|
|
||||||
while ($line < $num) {
|
while ($line < $num) {
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$date=$this->db->jdate($objp->dp);
|
$date = $this->db->jdate($objp->dp);
|
||||||
$datec=$this->db->jdate($objp->datec);
|
$datec = $this->db->jdate($objp->datec);
|
||||||
$datem=$this->db->jdate($objp->tms);
|
$datem = $this->db->jdate($objp->tms);
|
||||||
$dateterm=$this->db->jdate($objp->fin_validite);
|
$dateterm = $this->db->jdate($objp->fin_validite);
|
||||||
$dateclose=$this->db->jdate($objp->date_cloture);
|
$dateclose = $this->db->jdate($objp->date_cloture);
|
||||||
$propalstatic->id = $objp->rowid;
|
$propalstatic->id = $objp->rowid;
|
||||||
$propalstatic->ref = $objp->ref;
|
$propalstatic->ref = $objp->ref;
|
||||||
$propalstatic->total_ht = $objp->total_ht;
|
$propalstatic->total_ht = $objp->total_ht;
|
||||||
@ -161,7 +161,7 @@ class box_propales extends ModeleBoxes
|
|||||||
$line++;
|
$line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0)
|
if ($num == 0)
|
||||||
$this->info_box_contents[$line][0] = array(
|
$this->info_box_contents[$line][0] = array(
|
||||||
'td' => 'class="center"',
|
'td' => 'class="center"',
|
||||||
'text'=>$langs->trans("NoRecordedProposals"),
|
'text'=>$langs->trans("NoRecordedProposals"),
|
||||||
|
|||||||
@ -1804,7 +1804,7 @@ abstract class CommonObject
|
|||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) {
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||||
}
|
}
|
||||||
@ -1819,7 +1819,7 @@ abstract class CommonObject
|
|||||||
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
||||||
$sql .= $filter;
|
$sql .= $filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) {
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
$sql .= ' AND te.'.$tmparray[0].' = '.($tmparray[1] == 'societe' ? 's' : 'parenttable').'.rowid'; // If we need to link to this table to limit select to entity
|
$sql .= ' AND te.'.$tmparray[0].' = '.($tmparray[1] == 'societe' ? 's' : 'parenttable').'.rowid'; // If we need to link to this table to limit select to entity
|
||||||
}
|
}
|
||||||
@ -1836,7 +1836,7 @@ abstract class CommonObject
|
|||||||
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged) && $this->element != 'societe') {
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged) && $this->element != 'societe') {
|
||||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
$sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')';
|
$sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')';
|
||||||
}
|
}
|
||||||
@ -5625,7 +5625,7 @@ abstract class CommonObject
|
|||||||
$form = new Form($this->db);
|
$form = new Form($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($this->fields)) {
|
if (!empty($this->fields)) {
|
||||||
$val = $this->fields[$key];
|
$val = $this->fields[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -293,7 +293,7 @@ class Conf
|
|||||||
$rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
|
$rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
|
||||||
|
|
||||||
// Define default dir_output and dir_temp for directories of modules
|
// Define default dir_output and dir_temp for directories of modules
|
||||||
foreach($this->modules as $module)
|
foreach ($this->modules as $module)
|
||||||
{
|
{
|
||||||
//var_dump($module);
|
//var_dump($module);
|
||||||
// For multicompany sharings
|
// For multicompany sharings
|
||||||
@ -305,18 +305,18 @@ class Conf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// External modules storage
|
// External modules storage
|
||||||
if (! empty($this->modules_parts['dir']))
|
if (!empty($this->modules_parts['dir']))
|
||||||
{
|
{
|
||||||
foreach($this->modules_parts['dir'] as $module => $dirs)
|
foreach ($this->modules_parts['dir'] as $module => $dirs)
|
||||||
{
|
{
|
||||||
if (! empty($this->$module->enabled))
|
if (!empty($this->$module->enabled))
|
||||||
{
|
{
|
||||||
foreach($dirs as $type => $name) // $type is 'output' or 'temp'
|
foreach ($dirs as $type => $name) // $type is 'output' or 'temp'
|
||||||
{
|
{
|
||||||
$multidirname = 'multidir_'.$type;
|
$multidirname = 'multidir_'.$type;
|
||||||
$dirname = 'dir_'.$type;
|
$dirname = 'dir_'.$type;
|
||||||
|
|
||||||
if($type != 'temp')
|
if ($type != 'temp')
|
||||||
{
|
{
|
||||||
// For multicompany sharings
|
// For multicompany sharings
|
||||||
$this->$module->$multidirname = array($this->entity => $rootfordata."/".$name);
|
$this->$module->$multidirname = array($this->entity => $rootfordata."/".$name);
|
||||||
@ -370,43 +370,43 @@ class Conf
|
|||||||
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
||||||
|
|
||||||
// Sous module bons d'expedition
|
// Sous module bons d'expedition
|
||||||
$this->expedition_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_EXPEDITION)?$this->global->MAIN_SUBMODULE_EXPEDITION:0);
|
$this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0);
|
||||||
// Sous module bons de livraison
|
// Sous module bons de livraison
|
||||||
$this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0);
|
$this->livraison_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0);
|
||||||
|
|
||||||
// Module fournisseur
|
// Module fournisseur
|
||||||
if (! empty($this->fournisseur))
|
if (!empty($this->fournisseur))
|
||||||
{
|
{
|
||||||
$this->fournisseur->commande=new stdClass();
|
$this->fournisseur->commande = new stdClass();
|
||||||
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||||
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
||||||
$this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
$this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||||
$this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
|
$this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
|
||||||
|
|
||||||
$this->fournisseur->facture=new stdClass();
|
$this->fournisseur->facture = new stdClass();
|
||||||
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||||
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
||||||
$this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
$this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||||
$this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
|
$this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
|
||||||
|
|
||||||
$this->supplierproposal=new stdClass();
|
$this->supplierproposal = new stdClass();
|
||||||
$this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal");
|
$this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal");
|
||||||
$this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp");
|
$this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp");
|
||||||
$this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility
|
$this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility
|
||||||
$this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility
|
$this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility
|
||||||
|
|
||||||
$this->fournisseur->payment=new stdClass();
|
$this->fournisseur->payment = new stdClass();
|
||||||
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
|
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
|
||||||
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp");
|
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp");
|
||||||
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
|
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
|
||||||
$this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
|
$this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
|
||||||
|
|
||||||
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
|
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
|
||||||
if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties
|
if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties
|
||||||
{
|
{
|
||||||
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||||
{
|
{
|
||||||
$this->supplier_order=new stdClass();
|
$this->supplier_order = new stdClass();
|
||||||
$this->supplier_order->enabled = 1;
|
$this->supplier_order->enabled = 1;
|
||||||
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||||
$this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
$this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
||||||
@ -416,7 +416,7 @@ class Conf
|
|||||||
|
|
||||||
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||||
{
|
{
|
||||||
$this->supplier_invoice=new stdClass();
|
$this->supplier_invoice = new stdClass();
|
||||||
$this->supplier_invoice->enabled = 1;
|
$this->supplier_invoice->enabled = 1;
|
||||||
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||||
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
||||||
|
|||||||
@ -145,27 +145,27 @@ class FormAdmin
|
|||||||
public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '')
|
public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs,$conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_array($dirmenuarray)) return -1;
|
if (!is_array($dirmenuarray)) return -1;
|
||||||
|
|
||||||
$menuarray=array();
|
$menuarray = array();
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
{
|
{
|
||||||
foreach($dirmenuarray as $dirtoscan)
|
foreach ($dirmenuarray as $dirtoscan)
|
||||||
{
|
{
|
||||||
$dir=$dirroot.$dirtoscan;
|
$dir = $dirroot.$dirtoscan;
|
||||||
//print $dir.'<br>';
|
//print $dir.'<br>';
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle=opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && substr($file, 0, 5) != 'index')
|
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && substr($file, 0, 5) != 'index')
|
||||||
{
|
{
|
||||||
@ -174,20 +174,20 @@ class FormAdmin
|
|||||||
if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files
|
if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files
|
||||||
if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files
|
if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files
|
||||||
|
|
||||||
$filelib=preg_replace('/\.php$/i', '', $file);
|
$filelib = preg_replace('/\.php$/i', '', $file);
|
||||||
$prefix='';
|
$prefix = '';
|
||||||
// 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other
|
// 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other
|
||||||
if (preg_match('/^eldy/i', $file)) $prefix='0';
|
if (preg_match('/^eldy/i', $file)) $prefix = '0';
|
||||||
elseif (preg_match('/^smartphone/i', $file)) $prefix='2';
|
elseif (preg_match('/^smartphone/i', $file)) $prefix = '2';
|
||||||
else $prefix='3';
|
else $prefix = '3';
|
||||||
|
|
||||||
if ($file == $selected)
|
if ($file == $selected)
|
||||||
{
|
{
|
||||||
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected>'.$filelib.'</option>';
|
$menuarray[$prefix.'_'.$file] = '<option value="'.$file.'" selected>'.$filelib.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
|
$menuarray[$prefix.'_'.$file] = '<option value="'.$file.'">'.$filelib.'</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,24 +199,24 @@ class FormAdmin
|
|||||||
ksort($menuarray);
|
ksort($menuarray);
|
||||||
|
|
||||||
// Output combo list of menus
|
// Output combo list of menus
|
||||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
|
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||||
$oldprefix='';
|
$oldprefix = '';
|
||||||
foreach ($menuarray as $key => $val)
|
foreach ($menuarray as $key => $val)
|
||||||
{
|
{
|
||||||
$tab=explode('_', $key);
|
$tab = explode('_', $key);
|
||||||
$newprefix=$tab[0];
|
$newprefix = $tab[0];
|
||||||
if ($newprefix=='1' && ($conf->global->MAIN_FEATURES_LEVEL < 1)) continue;
|
if ($newprefix == '1' && ($conf->global->MAIN_FEATURES_LEVEL < 1)) continue;
|
||||||
if ($newprefix=='2' && ($conf->global->MAIN_FEATURES_LEVEL < 2)) continue;
|
if ($newprefix == '2' && ($conf->global->MAIN_FEATURES_LEVEL < 2)) continue;
|
||||||
if ($newprefix != $oldprefix) // Add separators
|
if ($newprefix != $oldprefix) // Add separators
|
||||||
{
|
{
|
||||||
// Affiche titre
|
// Affiche titre
|
||||||
print '<option value="-1" disabled>';
|
print '<option value="-1" disabled>';
|
||||||
if ($newprefix=='0') print '-- '.$langs->trans("VersionRecommanded").' --';
|
if ($newprefix == '0') print '-- '.$langs->trans("VersionRecommanded").' --';
|
||||||
if ($newprefix=='1') print '-- '.$langs->trans("VersionExperimental").' --';
|
if ($newprefix == '1') print '-- '.$langs->trans("VersionExperimental").' --';
|
||||||
if ($newprefix=='2') print '-- '.$langs->trans("VersionDevelopment").' --';
|
if ($newprefix == '2') print '-- '.$langs->trans("VersionDevelopment").' --';
|
||||||
if ($newprefix=='3') print '-- '.$langs->trans("Other").' --';
|
if ($newprefix == '3') print '-- '.$langs->trans("Other").' --';
|
||||||
print '</option>';
|
print '</option>';
|
||||||
$oldprefix=$newprefix;
|
$oldprefix = $newprefix;
|
||||||
}
|
}
|
||||||
print $val."\n"; // Show menu entry
|
print $val."\n"; // Show menu entry
|
||||||
}
|
}
|
||||||
@ -235,37 +235,37 @@ class FormAdmin
|
|||||||
public function select_menu_families($selected, $htmlname, $dirmenuarray)
|
public function select_menu_families($selected, $htmlname, $dirmenuarray)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs,$conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
//$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set
|
//$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set
|
||||||
$expdevmenu=array();
|
$expdevmenu = array();
|
||||||
|
|
||||||
$menuarray=array();
|
$menuarray = array();
|
||||||
|
|
||||||
foreach($dirmenuarray as $dirmenu)
|
foreach ($dirmenuarray as $dirmenu)
|
||||||
{
|
{
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
{
|
{
|
||||||
$dir=$dirroot.$dirmenu;
|
$dir = $dirroot.$dirmenu;
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle=opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||||
{
|
{
|
||||||
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i', '', $file);
|
$filelib = preg_replace('/(_backoffice|_frontoffice)?\.php$/i', '', $file);
|
||||||
if (preg_match('/^index/i', $filelib)) continue;
|
if (preg_match('/^index/i', $filelib)) continue;
|
||||||
if (preg_match('/^default/i', $filelib)) continue;
|
if (preg_match('/^default/i', $filelib)) continue;
|
||||||
if (preg_match('/^empty/i', $filelib)) continue;
|
if (preg_match('/^empty/i', $filelib)) continue;
|
||||||
if (preg_match('/\.lib/i', $filelib)) continue;
|
if (preg_match('/\.lib/i', $filelib)) continue;
|
||||||
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) continue;
|
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) continue;
|
||||||
|
|
||||||
$menuarray[$filelib]=1;
|
$menuarray[$filelib] = 1;
|
||||||
}
|
}
|
||||||
$menuarray['all']=1;
|
$menuarray['all'] = 1;
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
@ -277,11 +277,11 @@ class FormAdmin
|
|||||||
|
|
||||||
// Affichage liste deroulante des menus
|
// Affichage liste deroulante des menus
|
||||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
$oldprefix='';
|
$oldprefix = '';
|
||||||
foreach ($menuarray as $key => $val)
|
foreach ($menuarray as $key => $val)
|
||||||
{
|
{
|
||||||
$tab=explode('_', $key);
|
$tab = explode('_', $key);
|
||||||
$newprefix=$tab[0];
|
$newprefix = $tab[0];
|
||||||
print '<option value="'.$key.'"';
|
print '<option value="'.$key.'"';
|
||||||
if ($key == $selected)
|
if ($key == $selected)
|
||||||
{
|
{
|
||||||
@ -307,7 +307,7 @@ class FormAdmin
|
|||||||
public function select_timezone($selected, $htmlname)
|
public function select_timezone($selected, $htmlname)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs,$conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
print '<option value="-1"> </option>';
|
print '<option value="-1"> </option>';
|
||||||
@ -367,21 +367,21 @@ class FormAdmin
|
|||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
|
|
||||||
$sql = "SELECT code, label, width, height, unit";
|
$sql = "SELECT code, label, width, height, unit";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paper_format";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||||
$sql.= " WHERE active=1";
|
$sql .= " WHERE active=1";
|
||||||
if ($filter) $sql.=" AND code LIKE '%".$this->db->escape($filter)."%'";
|
if ($filter) $sql .= " AND code LIKE '%".$this->db->escape($filter)."%'";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num=$this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i=0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj=$this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$unitKey = $langs->trans('SizeUnit'.$obj->unit);
|
$unitKey = $langs->trans('SizeUnit'.$obj->unit);
|
||||||
|
|
||||||
$paperformat[$obj->code]= $langs->trans('PaperFormat'.strtoupper($obj->code)).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
|
$paperformat[$obj->code] = $langs->trans('PaperFormat'.strtoupper($obj->code)).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -391,27 +391,27 @@ class FormAdmin
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$out='';
|
$out = '';
|
||||||
|
|
||||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
if ($showempty)
|
if ($showempty)
|
||||||
{
|
{
|
||||||
$out.= '<option value=""';
|
$out .= '<option value=""';
|
||||||
if ($selected == '') $out.= ' selected';
|
if ($selected == '') $out .= ' selected';
|
||||||
$out.= '> </option>';
|
$out .= '> </option>';
|
||||||
}
|
}
|
||||||
foreach ($paperformat as $key => $value)
|
foreach ($paperformat as $key => $value)
|
||||||
{
|
{
|
||||||
if ($selected == $key)
|
if ($selected == $key)
|
||||||
{
|
{
|
||||||
$out.= '<option value="'.$key.'" selected>'.$value.'</option>';
|
$out .= '<option value="'.$key.'" selected>'.$value.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.= '<option value="'.$key.'">'.$value.'</option>';
|
$out .= '<option value="'.$key.'">'.$value.'</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.= '</select>';
|
$out .= '</select>';
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,21 +45,21 @@
|
|||||||
*/
|
*/
|
||||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array())
|
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array())
|
||||||
{
|
{
|
||||||
if (empty($minLength)) $minLength=1;
|
if (empty($minLength)) $minLength = 1;
|
||||||
|
|
||||||
$dataforrenderITem='ui-autocomplete';
|
$dataforrenderITem = 'ui-autocomplete';
|
||||||
$dataforitem='ui-autocomplete-item';
|
$dataforitem = 'ui-autocomplete-item';
|
||||||
// Allow two constant to use other values for backward compatibility
|
// Allow two constant to use other values for backward compatibility
|
||||||
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem=constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
|
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem = constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
|
||||||
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem=constant('JS_QUERY_AUTOCOMPLETE_ITEM');
|
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem = constant('JS_QUERY_AUTOCOMPLETE_ITEM');
|
||||||
|
|
||||||
// Input search_htmlname is original field
|
// Input search_htmlname is original field
|
||||||
// Input htmlname is a second input field used when using ajax autocomplete.
|
// Input htmlname is a second input field used when using ajax autocomplete.
|
||||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
||||||
|
|
||||||
$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
|
$script .= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
|
||||||
$script.= '<script>'."\n";
|
$script .= '<script>'."\n";
|
||||||
$script.= '$(document).ready(function() {
|
$script .= '$(document).ready(function() {
|
||||||
var autoselect = '.$autoselect.';
|
var autoselect = '.$autoselect.';
|
||||||
var options = '.json_encode($ajaxoptions).';
|
var options = '.json_encode($ajaxoptions).';
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
|
|
||||||
$("input#search_'.$htmlname.'").autocomplete({
|
$("input#search_'.$htmlname.'").autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
$.get("'.$url.($urloption ? '?'.$urloption : '').'", { '.$htmlname.': request.term }, function(data){
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
response($.map( data, function(item) {
|
response($.map( data, function(item) {
|
||||||
@ -134,7 +134,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else console.error("Error: Ajax url '.$url.($urloption?'?'.$urloption:'').' has returned an empty page. Should be an empty json array.");
|
else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
|
||||||
}, "json");
|
}, "json");
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -203,7 +203,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
};
|
};
|
||||||
|
|
||||||
});';
|
});';
|
||||||
$script.= '</script>';
|
$script .= '</script>';
|
||||||
|
|
||||||
return $script;
|
return $script;
|
||||||
}
|
}
|
||||||
@ -225,8 +225,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLength = 2, $autoselect = 0)
|
function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLength = 2, $autoselect = 0)
|
||||||
{
|
{
|
||||||
$script = '<!-- Autocomplete -->'."\n";
|
$script = '<!-- Autocomplete -->'."\n";
|
||||||
$script.= '<script>';
|
$script .= '<script>';
|
||||||
$script.= 'jQuery(document).ready(function() {
|
$script .= 'jQuery(document).ready(function() {
|
||||||
var fields = '.json_encode($fields).';
|
var fields = '.json_encode($fields).';
|
||||||
var nboffields = fields.length;
|
var nboffields = fields.length;
|
||||||
var autoselect = '.$autoselect.';
|
var autoselect = '.$autoselect.';
|
||||||
@ -236,7 +236,7 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLen
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
minLength: '.$minLength.',
|
minLength: '.$minLength.',
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
jQuery.getJSON( "'.$url.($option?'?'.$option:'').'", { '.$htmlname.': request.term }, function(data){
|
jQuery.getJSON( "'.$url.($option ? '?'.$option : '').'", { '.$htmlname.': request.term }, function(data){
|
||||||
response( jQuery.map( data, function( item ) {
|
response( jQuery.map( data, function( item ) {
|
||||||
if (autoselect == 1 && data.length == 1) {
|
if (autoselect == 1 && data.length == 1) {
|
||||||
jQuery("#'.$htmlname.'").val(item.value);
|
jQuery("#'.$htmlname.'").val(item.value);
|
||||||
@ -315,7 +315,7 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLen
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
$script.= '</script>';
|
$script .= '</script>';
|
||||||
|
|
||||||
return $script;
|
return $script;
|
||||||
}
|
}
|
||||||
@ -333,11 +333,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$newtitle=dol_textishtml($title)?dol_string_nohtmltag($title, 1):$title;
|
$newtitle = dol_textishtml($title) ?dol_string_nohtmltag($title, 1) : $title;
|
||||||
$msg= '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
|
$msg = '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
|
||||||
$msg.= $message;
|
$msg .= $message;
|
||||||
$msg.= '</div>'."\n";
|
$msg .= '</div>'."\n";
|
||||||
$msg.= '<script>
|
$msg .= '<script>
|
||||||
jQuery(function() {
|
jQuery(function() {
|
||||||
jQuery("#dialog-info").dialog({
|
jQuery("#dialog-info").dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
@ -353,7 +353,7 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
$msg.= "\n";
|
$msg .= "\n";
|
||||||
|
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
@ -377,20 +377,20 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// select2 can be disabled for smartphones
|
// select2 can be disabled for smartphones
|
||||||
if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone' && ! empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return '';
|
if (!empty($conf->browser->layout) && $conf->browser->layout == 'phone' && !empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return '';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
if (!empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||||
if (empty($conf->use_javascript_ajax)) return '';
|
if (empty($conf->use_javascript_ajax)) return '';
|
||||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
|
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) return '';
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
|
||||||
|
|
||||||
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
|
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete = 0;
|
||||||
|
|
||||||
$tmpplugin='select2';
|
$tmpplugin = 'select2';
|
||||||
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(\''.(preg_match('/^\./', $htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
|
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
|
||||||
dir: \'ltr\',
|
dir: \'ltr\',
|
||||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
||||||
minimumInputLength: '.$minLengthToAutocomplete.',
|
minimumInputLength: '.$minLengthToAutocomplete.',
|
||||||
@ -411,12 +411,12 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
},
|
},
|
||||||
dropdownCssClass: \'ui-dialog\'
|
dropdownCssClass: \'ui-dialog\'
|
||||||
})';
|
})';
|
||||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
if ($forcefocus) $msg .= '.select2(\'focus\')';
|
||||||
$msg.= ';'."\n";
|
$msg .= ';'."\n";
|
||||||
|
|
||||||
if (is_array($events) && count($events)) // If an array of js events to do were provided.
|
if (is_array($events) && count($events)) // If an array of js events to do were provided.
|
||||||
{
|
{
|
||||||
$msg.= '
|
$msg .= '
|
||||||
jQuery("#'.$htmlname.'").change(function () {
|
jQuery("#'.$htmlname.'").change(function () {
|
||||||
var obj = '.json_encode($events).';
|
var obj = '.json_encode($events).';
|
||||||
$.each(obj, function(key,values) {
|
$.each(obj, function(key,values) {
|
||||||
@ -465,8 +465,8 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
}';
|
}';
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg.= '});'."\n";
|
$msg .= '});'."\n";
|
||||||
$msg.= "</script>\n";
|
$msg .= "</script>\n";
|
||||||
|
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
@ -495,7 +495,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out= "\n<!-- Ajax code to switch constant ".$code." -->".'
|
$out = "\n<!-- Ajax code to switch constant ".$code." -->".'
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var input = '.json_encode($input).';
|
var input = '.json_encode($input).';
|
||||||
@ -530,10 +530,10 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
|
|||||||
});
|
});
|
||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
|
|
||||||
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
$out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
||||||
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"), 'switch_on'):img_picto($langs->trans("Disabled"), 'switch_off')).'</span>';
|
$out .= '<span id="set_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on') : img_picto($langs->trans("Disabled"), 'switch_off')).'</span>';
|
||||||
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"), 'switch_off'):img_picto($langs->trans("Enabled"), 'switch_on')).'</span>';
|
$out .= '<span id="del_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off') : img_picto($langs->trans("Enabled"), 'switch_on')).'</span>';
|
||||||
$out.="\n";
|
$out .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
@ -555,7 +555,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$out= '<script>
|
$out = '<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
var input = '.json_encode($input).';
|
var input = '.json_encode($input).';
|
||||||
|
|
||||||
@ -620,8 +620,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
$out.= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'hideobject':'').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
|
$out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
|
||||||
$out.= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'':'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
|
$out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,13 +76,13 @@ function product_prepare_head($object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sub products
|
// Sub products
|
||||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/composition/card.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/composition/card.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans('AssociatedProducts');
|
$head[$h][1] = $langs->trans('AssociatedProducts');
|
||||||
|
|
||||||
$nbFatherAndChild = $object->hasFatherOrChild();
|
$nbFatherAndChild = $object->hasFatherOrChild();
|
||||||
if ($nbFatherAndChild > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbFatherAndChild.'</span>';
|
if ($nbFatherAndChild > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFatherAndChild.'</span>';
|
||||||
$head[$h][2] = 'subproduct';
|
$head[$h][2] = 'subproduct';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -110,15 +110,15 @@ function product_prepare_head($object)
|
|||||||
$head[$h][1] = $langs->trans('ProductCombinations');
|
$head[$h][1] = $langs->trans('ProductCombinations');
|
||||||
$head[$h][2] = 'combinations';
|
$head[$h][2] = 'combinations';
|
||||||
$nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
|
$nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
|
||||||
if ($nbVariant > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbVariant.'</span>';
|
if ($nbVariant > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbVariant.'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
|
if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
|
||||||
{
|
{
|
||||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire)
|
if (!empty($conf->stock->enabled) && $user->rights->stock->lire)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("Stock");
|
$head[$h][1] = $langs->trans("Stock");
|
||||||
@ -156,11 +156,11 @@ function product_prepare_head($object)
|
|||||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
{
|
{
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if(!empty($object->note_private)) $nbNote++;
|
if (!empty($object->note_private)) $nbNote++;
|
||||||
if(!empty($object->note_public)) $nbNote++;
|
if (!empty($object->note_public)) $nbNote++;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/note.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/product/note.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Notes');
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'note';
|
$head[$h][2] = 'note';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -168,18 +168,18 @@ function product_prepare_head($object)
|
|||||||
// Attachments
|
// Attachments
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||||
if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
|
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
|
||||||
if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos';
|
if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos';
|
||||||
if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos';
|
if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos';
|
||||||
$nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
}
|
}
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
@ -225,10 +225,10 @@ function productlot_prepare_head($object)
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/productlot_document.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/stock/productlot_document.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("Documents");
|
$head[$h][1] = $langs->trans("Documents");
|
||||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho
|
|||||||
if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label]))
|
if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label]))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||||
$measuringUnits= new CUnits($db);
|
$measuringUnits = new CUnits($db);
|
||||||
|
|
||||||
if ($measuring_style == '' && $scale == '')
|
if ($measuring_style == '' && $scale == '')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -265,7 +265,7 @@ function project_timesheet_prepare_head($mode, $fuser = null)
|
|||||||
|
|
||||||
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH))
|
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param?'?'.$param:'');
|
$head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param ? '?'.$param : '');
|
||||||
$head[$h][1] = $langs->trans("InputPerMonth");
|
$head[$h][1] = $langs->trans("InputPerMonth");
|
||||||
$head[$h][2] = 'inputpermonth';
|
$head[$h][2] = 'inputpermonth';
|
||||||
$h++;
|
$h++;
|
||||||
@ -1735,19 +1735,19 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
global $conf, $db, $user, $bc, $langs;
|
global $conf, $db, $user, $bc, $langs;
|
||||||
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
|
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
|
||||||
|
|
||||||
$numlines=count($lines);
|
$numlines = count($lines);
|
||||||
|
|
||||||
$lastprojectid=0;
|
$lastprojectid = 0;
|
||||||
$workloadforid=array();
|
$workloadforid = array();
|
||||||
$totalforeachweek=array();
|
$totalforeachweek = array();
|
||||||
$lineswithoutlevel0=array();
|
$lineswithoutlevel0 = array();
|
||||||
|
|
||||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
if ($parent == 0) // Always and only if at first level
|
if ($parent == 0) // Always and only if at first level
|
||||||
{
|
{
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0; $i < $numlines; $i++)
|
||||||
{
|
{
|
||||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1755,24 +1755,24 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
|
|
||||||
if (empty($oldprojectforbreak))
|
if (empty($oldprojectforbreak))
|
||||||
{
|
{
|
||||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0; $i < $numlines; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
|
|
||||||
if ($lines[$i]->fk_task_parent == $parent)
|
if ($lines[$i]->fk_task_parent == $parent)
|
||||||
{
|
{
|
||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || !empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
// Break on a new project
|
// Break on a new project
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
{
|
{
|
||||||
$lastprojectid=$lines[$i]->fk_project;
|
$lastprojectid = $lines[$i]->fk_project;
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1781,31 +1781,31 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
if (empty($workloadforid[$projectstatic->id]))
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
{
|
{
|
||||||
$projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
$projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id] = 1;
|
||||||
}
|
}
|
||||||
//var_dump($projectstatic->weekWorkLoadPerTask);
|
//var_dump($projectstatic->weekWorkLoadPerTask);
|
||||||
//var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
|
//var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
|
||||||
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref = $lines[$i]->projectref;
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
$projectstatic->title = $lines[$i]->projectlabel;
|
||||||
$projectstatic->public=$lines[$i]->public;
|
$projectstatic->public = $lines[$i]->public;
|
||||||
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
|
$projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
|
||||||
|
|
||||||
$taskstatic->id=$lines[$i]->id;
|
$taskstatic->id = $lines[$i]->id;
|
||||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
$taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
|
||||||
$taskstatic->label=$lines[$i]->label;
|
$taskstatic->label = $lines[$i]->label;
|
||||||
$taskstatic->date_start=$lines[$i]->date_start;
|
$taskstatic->date_start = $lines[$i]->date_start;
|
||||||
$taskstatic->date_end=$lines[$i]->date_end;
|
$taskstatic->date_end = $lines[$i]->date_end;
|
||||||
|
|
||||||
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
$thirdpartystatic->id = $lines[$i]->thirdparty_id;
|
||||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
$thirdpartystatic->name = $lines[$i]->thirdparty_name;
|
||||||
$thirdpartystatic->email=$lines[$i]->thirdparty_email;
|
$thirdpartystatic->email = $lines[$i]->thirdparty_email;
|
||||||
|
|
||||||
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
|
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven trforbreak">'."\n";
|
print '<tr class="oddeven trforbreak">'."\n";
|
||||||
print '<td colspan="'.(6+count($TWeek)).'">';
|
print '<td colspan="'.(6 + count($TWeek)).'">';
|
||||||
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
|
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
|
||||||
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
|
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
|
||||||
if ($projectstatic->title)
|
if ($projectstatic->title)
|
||||||
@ -1840,11 +1840,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
// Ref
|
// Ref
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print '<!-- Task id = '.$lines[$i]->id.' -->';
|
print '<!-- Task id = '.$lines[$i]->id.' -->';
|
||||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
for ($k = 0; $k < $level; $k++) print " ";
|
||||||
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
print $taskstatic->getNomUrl(1, 'withproject', 'time');
|
||||||
// Label task
|
// Label task
|
||||||
print '<br>';
|
print '<br>';
|
||||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
for ($k = 0; $k < $level; $k++) print " ";
|
||||||
//print $taskstatic->getNomUrl(0, 'withproject', 'time');
|
//print $taskstatic->getNomUrl(0, 'withproject', 'time');
|
||||||
print $taskstatic->label;
|
print $taskstatic->label;
|
||||||
//print "<br>";
|
//print "<br>";
|
||||||
@ -1860,7 +1860,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
|
|
||||||
// Progress declared %
|
// Progress declared %
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Time spent by everybody
|
// Time spent by everybody
|
||||||
@ -1877,66 +1877,66 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
|
|
||||||
// Time spent by user
|
// Time spent by user
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id);
|
$tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
|
||||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
|
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
|
||||||
else print '--:--';
|
else print '--:--';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
$disabledproject=1;$disabledtask=1;
|
$disabledproject = 1; $disabledtask = 1;
|
||||||
//print "x".$lines[$i]->fk_project;
|
//print "x".$lines[$i]->fk_project;
|
||||||
//var_dump($lines[$i]);
|
//var_dump($lines[$i]);
|
||||||
//var_dump($projectsrole[$lines[$i]->fk_project]);
|
//var_dump($projectsrole[$lines[$i]->fk_project]);
|
||||||
// If at least one role for project
|
// If at least one role for project
|
||||||
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
|
if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
|
||||||
{
|
{
|
||||||
$disabledproject=0;
|
$disabledproject = 0;
|
||||||
$disabledtask=0;
|
$disabledtask = 0;
|
||||||
}
|
}
|
||||||
// If $restricteditformytask is on and I have no role on task, i disable edit
|
// If $restricteditformytask is on and I have no role on task, i disable edit
|
||||||
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
|
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
$disabledtask=1;
|
$disabledtask = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//var_dump($projectstatic->weekWorkLoadPerTask);
|
//var_dump($projectstatic->weekWorkLoadPerTask);
|
||||||
//TODO
|
//TODO
|
||||||
// Fields to show current time
|
// Fields to show current time
|
||||||
$tableCell=''; $modeinput='hours';
|
$tableCell = ''; $modeinput = 'hours';
|
||||||
$TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
|
$TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
|
||||||
$TFirstDay[reset($TWeek)] = 1;
|
$TFirstDay[reset($TWeek)] = 1;
|
||||||
foreach($TFirstDay as &$fday) {
|
foreach ($TFirstDay as &$fday) {
|
||||||
$fday--;
|
$fday--;
|
||||||
}
|
}
|
||||||
foreach ($TWeek as $weekNb)
|
foreach ($TWeek as $weekNb)
|
||||||
{
|
{
|
||||||
$weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
|
$weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
|
||||||
$totalforeachweek[$weekNb]+=$weekWorkLoad;
|
$totalforeachweek[$weekNb] += $weekWorkLoad;
|
||||||
|
|
||||||
$alreadyspent='';
|
$alreadyspent = '';
|
||||||
if ($weekWorkLoad > 0) $alreadyspent=convertSecondToTime($weekWorkLoad, 'allhourmin');
|
if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
|
||||||
$alttitle=$langs->trans("AddHereTimeSpentForWeek", $weekNb);
|
$alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb);
|
||||||
|
|
||||||
|
|
||||||
$tableCell ='<td align="center" class="hide">';
|
$tableCell = '<td align="center" class="hide">';
|
||||||
$placeholder='';
|
$placeholder = '';
|
||||||
if ($alreadyspent)
|
if ($alreadyspent)
|
||||||
{
|
{
|
||||||
$tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$weekNb.']" name="task['.$lines[$i]->id.']['.$weekNb.']" value="'.$alreadyspent.'"></span>';
|
$tableCell .= '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$weekNb.']" name="task['.$lines[$i]->id.']['.$weekNb.']" value="'.$alreadyspent.'"></span>';
|
||||||
//$placeholder=' placeholder="00:00"';
|
//$placeholder=' placeholder="00:00"';
|
||||||
//$tableCell.='+';
|
//$tableCell.='+';
|
||||||
}
|
}
|
||||||
|
|
||||||
$tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$TFirstDay[$weekNb].']" name="task['.$lines[$i]->id.']['.$TFirstDay[$weekNb].']" value="" cols="2" maxlength="5"';
|
$tableCell .= '<input type="text" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$TFirstDay[$weekNb].']" name="task['.$lines[$i]->id.']['.$TFirstDay[$weekNb].']" value="" cols="2" maxlength="5"';
|
||||||
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
$tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||||
$tableCell.=' onkeyup="updateTotal('.$weekNb.',\''.$modeinput.'\')"';
|
$tableCell .= ' onkeyup="updateTotal('.$weekNb.',\''.$modeinput.'\')"';
|
||||||
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$weekNb.',\''.$modeinput.'\')" />';
|
$tableCell .= ' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$weekNb.',\''.$modeinput.'\')" />';
|
||||||
$tableCell.='</td>';
|
$tableCell .= '</td>';
|
||||||
print $tableCell;
|
print $tableCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning
|
// Warning
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject"));
|
if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject"));
|
||||||
elseif ($disabledtask)
|
elseif ($disabledtask)
|
||||||
{
|
{
|
||||||
$titleassigntask = $langs->trans("AssignTaskToMe");
|
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||||
@ -1959,9 +1959,9 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
|||||||
$ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
|
$ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
|
||||||
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
|
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
|
||||||
//var_dump($ret);
|
//var_dump($ret);
|
||||||
foreach($ret as $key => $val)
|
foreach ($ret as $key => $val)
|
||||||
{
|
{
|
||||||
$totalforeachweek[$key]+=$val;
|
$totalforeachweek[$key] += $val;
|
||||||
}
|
}
|
||||||
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
|
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
|
||||||
//var_dump($totalforeachday);
|
//var_dump($totalforeachday);
|
||||||
@ -2202,8 +2202,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
|
|||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
// Because color of prospection status has no meaning yet, it is used if hidden constant is set
|
// Because color of prospection status has no meaning yet, it is used if hidden constant is set
|
||||||
if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
|
if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
|
||||||
if ($langs->trans("OppStatus" . $oppStatusCode) != "OppStatus" . $oppStatusCode) {
|
if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) {
|
||||||
print $langs->trans("OppStatus" . $oppStatusCode);
|
print $langs->trans("OppStatus".$oppStatusCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($statusOppList[$objp->opp_status])) {
|
if (isset($statusOppList[$objp->opp_status])) {
|
||||||
@ -2215,9 +2215,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
|
|||||||
}
|
}
|
||||||
if ($oppStatusCode) {
|
if ($oppStatusCode) {
|
||||||
if (!empty($oppStatusColor)) {
|
if (!empty($oppStatusColor)) {
|
||||||
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" style="display: inline-block; width: 4px; border: 5px solid rgb(' . $oppStatusColor . '); border-radius: 2px;" title="' . $langs->trans("OppStatus" . $oppStatusCode) . '"></a>';
|
print '<a href="'.dol_buildpath('/projet/list.php?search_opp_status='.$objp->opp_status, 1).'" style="display: inline-block; width: 4px; border: 5px solid rgb('.$oppStatusColor.'); border-radius: 2px;" title="'.$langs->trans("OppStatus".$oppStatusCode).'"></a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" title="' . $langs->trans("OppStatus".$oppStatusCode) . '">' . $oppStatusCode . '</a>';
|
print '<a href="'.dol_buildpath('/projet/list.php?search_opp_status='.$objp->opp_status, 1).'" title="'.$langs->trans("OppStatus".$oppStatusCode).'">'.$oppStatusCode.'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1315,27 +1315,27 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -621,7 +621,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
{
|
{
|
||||||
// We found a page break
|
// We found a page break
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -1475,27 +1475,27 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class html_cerfafr extends ModeleDon
|
|||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "cerfafr";
|
$this->name = "cerfafr";
|
||||||
@ -76,46 +76,46 @@ class html_cerfafr extends ModeleDon
|
|||||||
public function write_file($don, $outputlangs, $currency = '')
|
public function write_file($don, $outputlangs, $currency = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user,$conf,$langs,$mysoc;
|
global $user, $conf, $langs, $mysoc;
|
||||||
|
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
$id = (! is_object($don)?$don:'');
|
$id = (!is_object($don) ? $don : '');
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (!is_object($outputlangs)) $outputlangs = $langs;
|
||||||
|
|
||||||
// Load traductions files required by page
|
// Load traductions files required by page
|
||||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "donations"));
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "donations"));
|
||||||
|
|
||||||
$currency = !empty($currency) ? $currency : $conf->currency;
|
$currency = !empty($currency) ? $currency : $conf->currency;
|
||||||
|
|
||||||
if (! empty($conf->don->dir_output))
|
if (!empty($conf->don->dir_output))
|
||||||
{
|
{
|
||||||
// Definition of the object don (for upward compatibility)
|
// Definition of the object don (for upward compatibility)
|
||||||
if (! is_object($don))
|
if (!is_object($don))
|
||||||
{
|
{
|
||||||
$don = new Don($this->db);
|
$don = new Don($this->db);
|
||||||
$ret=$don->fetch($id);
|
$ret = $don->fetch($id);
|
||||||
$id=$don->id;
|
$id = $don->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if (! empty($don->specimen))
|
if (!empty($don->specimen))
|
||||||
{
|
{
|
||||||
$dir = $conf->don->dir_output;
|
$dir = $conf->don->dir_output;
|
||||||
$file = $dir . "/SPECIMEN.html";
|
$file = $dir."/SPECIMEN.html";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$donref = dol_sanitizeFileName($don->ref);
|
$donref = dol_sanitizeFileName($don->ref);
|
||||||
$dir = $conf->don->dir_output . "/" . $donref;
|
$dir = $conf->don->dir_output."/".$donref;
|
||||||
$file = $dir . "/" . $donref . ".html";
|
$file = $dir."/".$donref.".html";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (!file_exists($dir))
|
||||||
{
|
{
|
||||||
if (dol_mkdir($dir) < 0)
|
if (dol_mkdir($dir) < 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotCreateDir", $dir);
|
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,13 +133,13 @@ class html_cerfafr extends ModeleDon
|
|||||||
}
|
}
|
||||||
else $paymentmode = '';
|
else $paymentmode = '';
|
||||||
|
|
||||||
if ($don->modepaymentcode=='CHQ'){
|
if ($don->modepaymentcode == 'CHQ') {
|
||||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||||
}
|
}
|
||||||
elseif ($don->modepaymentcode=='LIQ'){
|
elseif ($don->modepaymentcode == 'LIQ') {
|
||||||
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||||
}
|
}
|
||||||
elseif ($don->modepaymentcode=='VIR' || $don->modepaymentcode=='PRE' || $don->modepaymentcode=='CB'){
|
elseif ($don->modepaymentcode == 'VIR' || $don->modepaymentcode == 'PRE' || $don->modepaymentcode == 'CB') {
|
||||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
|
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -159,7 +159,7 @@ class html_cerfafr extends ModeleDon
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Define contents
|
// Define contents
|
||||||
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
$donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html";
|
||||||
$form = implode('', file($donmodel));
|
$form = implode('', file($donmodel));
|
||||||
$form = str_replace('__REF__', $don->id, $form);
|
$form = str_replace('__REF__', $don->id, $form);
|
||||||
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
|
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
|
||||||
@ -203,59 +203,59 @@ class html_cerfafr extends ModeleDon
|
|||||||
|
|
||||||
$form = str_replace('__ModePaiement__', $ModePaiement, $form);
|
$form = str_replace('__ModePaiement__', $ModePaiement, $form);
|
||||||
|
|
||||||
$frencharticle='';
|
$frencharticle = '';
|
||||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='<font size="+1">Article 200, 238 bis et 978 du code général des impôts (CGI)</font>';
|
if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle = '<font size="+1">Article 200, 238 bis et 978 du code général des impôts (CGI)</font>';
|
||||||
$form = str_replace('__FrenchArticle__', $frencharticle, $form);
|
$form = str_replace('__FrenchArticle__', $frencharticle, $form);
|
||||||
|
|
||||||
$frencheligibility='';
|
$frencheligibility = '';
|
||||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :';
|
if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility = 'Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :';
|
||||||
$form = str_replace('__FrenchEligibility__', $frencheligibility, $form);
|
$form = str_replace('__FrenchEligibility__', $frencheligibility, $form);
|
||||||
|
|
||||||
$art200='';
|
$art200 = '';
|
||||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
||||||
if ($conf->global->DONATION_ART200 >= 1)
|
if ($conf->global->DONATION_ART200 >= 1)
|
||||||
{
|
{
|
||||||
$art200='<input type="checkbox" disabled="true" checked="checked" >200 du CGI';
|
$art200 = '<input type="checkbox" disabled="true" checked="checked" >200 du CGI';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$art200='<input type="checkbox" disabled="true">200 du CGI';
|
$art200 = '<input type="checkbox" disabled="true">200 du CGI';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$form = str_replace('__ARTICLE200__', $art200, $form);
|
$form = str_replace('__ARTICLE200__', $art200, $form);
|
||||||
|
|
||||||
$art238='';
|
$art238 = '';
|
||||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
||||||
if ($conf->global->DONATION_ART238 >= 1)
|
if ($conf->global->DONATION_ART238 >= 1)
|
||||||
{
|
{
|
||||||
$art238='<input type="checkbox" disabled="true" checked="checked" >238 bis du CGI';
|
$art238 = '<input type="checkbox" disabled="true" checked="checked" >238 bis du CGI';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$art238='<input type="checkbox" disabled="true">238 bis du CGI';
|
$art238 = '<input type="checkbox" disabled="true">238 bis du CGI';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$form = str_replace('__ARTICLE238__', $art238, $form);
|
$form = str_replace('__ARTICLE238__', $art238, $form);
|
||||||
|
|
||||||
$art978='';
|
$art978 = '';
|
||||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
||||||
if ($conf->global->DONATION_ART978 >= 1)
|
if ($conf->global->DONATION_ART978 >= 1)
|
||||||
{
|
{
|
||||||
$art978='<input type="checkbox" disabled="true" checked="checked" >978 du CGI';
|
$art978 = '<input type="checkbox" disabled="true" checked="checked" >978 du CGI';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$art978='<input type="checkbox" disabled="true">978 du CGI';
|
$art978 = '<input type="checkbox" disabled="true">978 du CGI';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$form = str_replace('__ARTICLE978__', $art978, $form);
|
$form = str_replace('__ARTICLE978__', $art978, $form);
|
||||||
|
|
||||||
// Save file on disk
|
// Save file on disk
|
||||||
dol_syslog("html_cerfafr::write_file $file");
|
dol_syslog("html_cerfafr::write_file $file");
|
||||||
$handle=fopen($file, "w");
|
$handle = fopen($file, "w");
|
||||||
fwrite($handle, $form);
|
fwrite($handle, $form);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (!empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
$this->result = array('fullpath'=>$file);
|
$this->result = array('fullpath'=>$file);
|
||||||
@ -264,13 +264,13 @@ class html_cerfafr extends ModeleDon
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotCreateDir", $dir);
|
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR");
|
$this->error = $langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,147 +288,147 @@ class html_cerfafr extends ModeleDon
|
|||||||
$unite = array();
|
$unite = array();
|
||||||
$dix = array();
|
$dix = array();
|
||||||
$cent = array();
|
$cent = array();
|
||||||
if(empty($devise1)) $dev1='euros';
|
if (empty($devise1)) $dev1 = 'euros';
|
||||||
else $dev1=$devise1;
|
else $dev1 = $devise1;
|
||||||
if(empty($devise2)) $dev2='centimes';
|
if (empty($devise2)) $dev2 = 'centimes';
|
||||||
else $dev2=$devise2;
|
else $dev2 = $devise2;
|
||||||
$valeur_entiere=intval($montant);
|
$valeur_entiere = intval($montant);
|
||||||
$valeur_decimal=intval(round($montant-intval($montant), 2)*100);
|
$valeur_decimal = intval(round($montant - intval($montant), 2) * 100);
|
||||||
$dix_c=intval($valeur_decimal%100/10);
|
$dix_c = intval($valeur_decimal % 100 / 10);
|
||||||
$cent_c=intval($valeur_decimal%1000/100);
|
$cent_c = intval($valeur_decimal % 1000 / 100);
|
||||||
$unite[1]=$valeur_entiere%10;
|
$unite[1] = $valeur_entiere % 10;
|
||||||
$dix[1]=intval($valeur_entiere%100/10);
|
$dix[1] = intval($valeur_entiere % 100 / 10);
|
||||||
$cent[1]=intval($valeur_entiere%1000/100);
|
$cent[1] = intval($valeur_entiere % 1000 / 100);
|
||||||
$unite[2]=intval($valeur_entiere%10000/1000);
|
$unite[2] = intval($valeur_entiere % 10000 / 1000);
|
||||||
$dix[2]=intval($valeur_entiere%100000/10000);
|
$dix[2] = intval($valeur_entiere % 100000 / 10000);
|
||||||
$cent[2]=intval($valeur_entiere%1000000/100000);
|
$cent[2] = intval($valeur_entiere % 1000000 / 100000);
|
||||||
$unite[3]=intval($valeur_entiere%10000000/1000000);
|
$unite[3] = intval($valeur_entiere % 10000000 / 1000000);
|
||||||
$dix[3]=intval($valeur_entiere%100000000/10000000);
|
$dix[3] = intval($valeur_entiere % 100000000 / 10000000);
|
||||||
$cent[3]=intval($valeur_entiere%1000000000/100000000);
|
$cent[3] = intval($valeur_entiere % 1000000000 / 100000000);
|
||||||
$chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
|
$chif = array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
|
||||||
$secon_c='';
|
$secon_c = '';
|
||||||
$trio_c='';
|
$trio_c = '';
|
||||||
for($i=1; $i<=3; $i++) {
|
for ($i = 1; $i <= 3; $i++) {
|
||||||
$prim[$i]='';
|
$prim[$i] = '';
|
||||||
$secon[$i]='';
|
$secon[$i] = '';
|
||||||
$trio[$i]='';
|
$trio[$i] = '';
|
||||||
if ($dix[$i]==0) {
|
if ($dix[$i] == 0) {
|
||||||
$secon[$i]='';
|
$secon[$i] = '';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==1) {
|
elseif ($dix[$i] == 1) {
|
||||||
$secon[$i]='';
|
$secon[$i] = '';
|
||||||
$prim[$i]=$chif[($unite[$i]+10)];
|
$prim[$i] = $chif[($unite[$i] + 10)];
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==2) {
|
elseif ($dix[$i] == 2) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='vingt et';
|
$secon[$i] = 'vingt et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
} else {
|
} else {
|
||||||
$secon[$i]='vingt';
|
$secon[$i] = 'vingt';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==3) {
|
elseif ($dix[$i] == 3) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='trente et';
|
$secon[$i] = 'trente et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
} else {
|
} else {
|
||||||
$secon[$i]='trente';
|
$secon[$i] = 'trente';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==4) {
|
elseif ($dix[$i] == 4) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='quarante et';
|
$secon[$i] = 'quarante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quarante';
|
$secon[$i] = 'quarante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==5) {
|
elseif ($dix[$i] == 5) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='cinquante et';
|
$secon[$i] = 'cinquante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='cinquante';
|
$secon[$i] = 'cinquante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==6) {
|
elseif ($dix[$i] == 6) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='soixante et';
|
$secon[$i] = 'soixante et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='soixante';
|
$secon[$i] = 'soixante';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==7) {
|
elseif ($dix[$i] == 7) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='soixante et';
|
$secon[$i] = 'soixante et';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i] = $chif[$unite[$i] + 10];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='soixante';
|
$secon[$i] = 'soixante';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i] = $chif[$unite[$i] + 10];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==8) {
|
elseif ($dix[$i] == 8) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='quatre-vingts et';
|
$secon[$i] = 'quatre-vingts et';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quatre-vingt';
|
$secon[$i] = 'quatre-vingt';
|
||||||
$prim[$i]=$chif[$unite[$i]];
|
$prim[$i] = $chif[$unite[$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($dix[$i]==9) {
|
elseif ($dix[$i] == 9) {
|
||||||
if ($unite[$i]==1) {
|
if ($unite[$i] == 1) {
|
||||||
$secon[$i]='quatre-vingts et';
|
$secon[$i] = 'quatre-vingts et';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i] = $chif[$unite[$i] + 10];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$secon[$i]='quatre-vingts';
|
$secon[$i] = 'quatre-vingts';
|
||||||
$prim[$i]=$chif[$unite[$i]+10];
|
$prim[$i] = $chif[$unite[$i] + 10];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($cent[$i]==1) $trio[$i]='cent';
|
if ($cent[$i] == 1) $trio[$i] = 'cent';
|
||||||
elseif($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents';
|
elseif ($cent[$i] != 0 || $cent[$i] != '') $trio[$i] = $chif[$cent[$i]].' cents';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
|
$chif2 = array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
|
||||||
$secon_c=$chif2[$dix_c];
|
$secon_c = $chif2[$dix_c];
|
||||||
if ($cent_c==1) $trio_c='cent';
|
if ($cent_c == 1) $trio_c = 'cent';
|
||||||
elseif ($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
|
elseif ($cent_c != 0 || $cent_c != '') $trio_c = $chif[$cent_c].' cents';
|
||||||
|
|
||||||
if (($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
|
if (($cent[3] == 0 || $cent[3] == '') && ($dix[3] == 0 || $dix[3] == '') && ($unite[3] == 1))
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million ';
|
$somme = $trio[3].' '.$secon[3].' '.$prim[3].' million ';
|
||||||
elseif (($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
|
elseif (($cent[3] != 0 && $cent[3] != '') || ($dix[3] != 0 && $dix[3] != '') || ($unite[3] != 0 && $unite[3] != ''))
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
$somme = $trio[3].' '.$secon[3].' '.$prim[3].' millions ';
|
||||||
else
|
else
|
||||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
$somme = $trio[3].' '.$secon[3].' '.$prim[3];
|
||||||
|
|
||||||
if (($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1))
|
||||||
$somme = $somme.' mille ';
|
$somme = $somme.' mille ';
|
||||||
elseif (($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
|
elseif (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != ''))
|
||||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
|
$somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2].' milles ';
|
||||||
else
|
else
|
||||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
|
$somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2];
|
||||||
|
|
||||||
$somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
|
$somme = $somme.$trio[1].' '.$secon[1].' '.$prim[1];
|
||||||
|
|
||||||
$somme = $somme. ' '. $dev1 .' ' ;
|
$somme = $somme.' '.$dev1.' ';
|
||||||
|
|
||||||
if (($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
|
if (($cent_c == '0' || $cent_c == '') && ($dix_c == '0' || $dix_c == ''))
|
||||||
return $somme. ' et zéro '. $dev2;
|
return $somme.' et zéro '.$dev2;
|
||||||
else
|
else
|
||||||
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
return $somme.$trio_c.' '.$secon_c.' '.$dev2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -494,7 +494,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$curY = $tab_top_newpage;
|
$curY = $tab_top_newpage;
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -539,7 +539,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
// We found a page break
|
// We found a page break
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -1051,13 +1051,13 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||||
|
|
||||||
// Show online payment link
|
// Show online payment link
|
||||||
$useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
|
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
|
||||||
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
|
if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$langs->loadLangs(array('payment', 'paybox'));
|
$langs->loadLangs(array('payment', 'paybox'));
|
||||||
$servicename=$langs->transnoentities('Online');
|
$servicename = $langs->transnoentities('Online');
|
||||||
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
|
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
|
||||||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||||
|
|
||||||
@ -1707,27 +1707,27 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1963,27 +1963,27 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
* \ingroup category
|
* \ingroup category
|
||||||
* \brief Fichier de description et activation du module Categorie
|
* \brief Fichier de description et activation du module Categorie
|
||||||
*/
|
*/
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,11 +64,11 @@ class modCategorie extends DolibarrModules
|
|||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
$this->config_page_url = array('categorie.php@categories');
|
$this->config_page_url = array('categorie.php@categories');
|
||||||
$this->langfiles = array("products","companies","categories","members");
|
$this->langfiles = array("products", "companies", "categories", "members");
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array();
|
$this->const = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
$this->const[$r][0] = "CATEGORIE_RECURSIV_ADD";
|
$this->const[$r][0] = "CATEGORIE_RECURSIV_ADD";
|
||||||
$this->const[$r][1] = "yesno";
|
$this->const[$r][1] = "yesno";
|
||||||
$this->const[$r][2] = "0";
|
$this->const[$r][2] = "0";
|
||||||
@ -83,7 +83,7 @@ class modCategorie extends DolibarrModules
|
|||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'categorie';
|
$this->rights_class = 'categorie';
|
||||||
|
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$this->rights[$r][0] = 241; // id de la permission
|
$this->rights[$r][0] = 241; // id de la permission
|
||||||
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
|
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
|
||||||
@ -114,110 +114,110 @@ class modCategorie extends DolibarrModules
|
|||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
//--------
|
//--------
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]='category_'.$r;
|
$this->export_code[$r] = 'category_'.$r;
|
||||||
$this->export_label[$r]='CatSupList';
|
$this->export_label[$r] = 'CatSupList';
|
||||||
$this->export_icon[$r]='category';
|
$this->export_icon[$r] = 'category';
|
||||||
$this->export_enabled[$r]='$conf->fournisseur->enabled';
|
$this->export_enabled[$r] = '$conf->fournisseur->enabled';
|
||||||
$this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire"));
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire"));
|
||||||
$this->export_fields_array[$r]=array(
|
$this->export_fields_array[$r] = array(
|
||||||
'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",
|
'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix",
|
||||||
's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",
|
's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address",
|
||||||
's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",
|
's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||||
's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",
|
's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital",
|
||||||
's.note_public'=>"NotePublic"
|
's.note_public'=>"NotePublic"
|
||||||
);
|
);
|
||||||
$this->export_TypeFields_array[$r]=array(
|
$this->export_TypeFields_array[$r] = array(
|
||||||
'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",
|
'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date",
|
||||||
's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",
|
's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||||
's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",
|
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text",
|
||||||
's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text"
|
's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text"
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r]=array(
|
$this->export_entities_array[$r] = array(
|
||||||
's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",
|
's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company",
|
||||||
's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",
|
's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company",
|
||||||
's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",
|
's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company",
|
||||||
's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company"
|
's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company"
|
||||||
); // We define here only fields that use another picto
|
); // We define here only fields that use another picto
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
|
||||||
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, ';
|
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, ';
|
||||||
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
|
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
|
||||||
$this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
|
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
|
||||||
$this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories
|
$this->export_sql_end[$r] .= ' AND u.type = 1'; // Supplier categories
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]='category_'.$r;
|
$this->export_code[$r] = 'category_'.$r;
|
||||||
$this->export_label[$r]='CatCusList';
|
$this->export_label[$r] = 'CatCusList';
|
||||||
$this->export_icon[$r]='category';
|
$this->export_icon[$r] = 'category';
|
||||||
$this->export_enabled[$r]='$conf->societe->enabled';
|
$this->export_enabled[$r] = '$conf->societe->enabled';
|
||||||
$this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire"));
|
||||||
$this->export_fields_array[$r]=array(
|
$this->export_fields_array[$r] = array(
|
||||||
'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",
|
'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix",
|
||||||
's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",
|
's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address",
|
||||||
's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",
|
's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||||
's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",
|
's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital",
|
||||||
's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'
|
's.note_public'=>"NotePublic", 's.fk_prospectlevel'=>'ProspectLevel', 's.fk_stcomm'=>'ProspectStatus'
|
||||||
);
|
);
|
||||||
$this->export_TypeFields_array[$r]=array(
|
$this->export_TypeFields_array[$r] = array(
|
||||||
'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",
|
'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text",
|
||||||
's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",
|
's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label",
|
||||||
'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",
|
'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text",
|
||||||
's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code',
|
's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code',
|
||||||
's.fk_stcomm'=>'List:c_stcomm:libelle:code'
|
's.fk_stcomm'=>'List:c_stcomm:libelle:code'
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r]=array(
|
$this->export_entities_array[$r] = array(
|
||||||
's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",
|
's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company",
|
||||||
's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",
|
's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company",
|
||||||
's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",
|
's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company",
|
||||||
's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company',
|
's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company',
|
||||||
's.fk_stcomm'=>'company'
|
's.fk_stcomm'=>'company'
|
||||||
); // We define here only fields that use another picto
|
); // We define here only fields that use another picto
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
|
||||||
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, ';
|
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, ';
|
||||||
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
|
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
|
||||||
$this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
|
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
|
||||||
$this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories
|
$this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories
|
||||||
|
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$fieldname='extra.'.$obj->name;
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldlabel = ucfirst($obj->label);
|
||||||
$typeFilter="Text";
|
$typeFilter = "Text";
|
||||||
switch($obj->type)
|
switch ($obj->type)
|
||||||
{
|
{
|
||||||
case 'int':
|
case 'int':
|
||||||
case 'double':
|
case 'double':
|
||||||
case 'price':
|
case 'price':
|
||||||
$typeFilter="Numeric";
|
$typeFilter = "Numeric";
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
$typeFilter="Date";
|
$typeFilter = "Date";
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$typeFilter="Boolean";
|
$typeFilter = "Boolean";
|
||||||
break;
|
break;
|
||||||
case 'sellist':
|
case 'sellist':
|
||||||
$typeFilter="List:".$obj->param;
|
$typeFilter = "List:".$obj->param;
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$typeFilter="Select:".$obj->param;
|
$typeFilter = "Select:".$obj->param;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
|
||||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
|
||||||
$this->export_entities_array[$r][$fieldname]='company';
|
$this->export_entities_array[$r][$fieldname] = 'company';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add axtra fields
|
// End add axtra fields
|
||||||
@ -227,42 +227,42 @@ class modCategorie extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]='category_'.$r;
|
$this->export_code[$r] = 'category_'.$r;
|
||||||
$this->export_label[$r]='CatProdList';
|
$this->export_label[$r] = 'CatProdList';
|
||||||
$this->export_icon[$r]='category';
|
$this->export_icon[$r] = 'category';
|
||||||
$this->export_enabled[$r]='$conf->product->enabled || $conf->service->enabled';
|
$this->export_enabled[$r] = '$conf->product->enabled || $conf->service->enabled';
|
||||||
$this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "lire"));
|
||||||
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
|
$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref');
|
||||||
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text');
|
$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.ref'=>'Text');
|
||||||
$this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto
|
$this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product'); // We define here only fields that use another picto
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
|
||||||
$this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
|
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
|
||||||
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
|
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
|
||||||
$this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories
|
$this->export_sql_end[$r] .= ' AND u.type = 0'; // Supplier categories
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]='category_'.$r;
|
$this->export_code[$r] = 'category_'.$r;
|
||||||
$this->export_label[$r]='CatMemberList';
|
$this->export_label[$r] = 'CatMemberList';
|
||||||
$this->export_icon[$r]='category';
|
$this->export_icon[$r] = 'category';
|
||||||
$this->export_enabled[$r]='$conf->adherent->enabled';
|
$this->export_enabled[$r] = '$conf->adherent->enabled';
|
||||||
$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "lire"));
|
||||||
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
|
$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||||
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
|
$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||||
$this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto
|
$this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
|
||||||
$this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
|
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
|
||||||
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
|
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
|
||||||
$this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories
|
$this->export_sql_end[$r] .= ' AND u.type = 3'; // Member categories
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]='category_'.$r;
|
$this->export_code[$r] = 'category_'.$r;
|
||||||
$this->export_label[$r]='CatContactList';
|
$this->export_label[$r] = 'CatContactList';
|
||||||
$this->export_icon[$r]='category';
|
$this->export_icon[$r] = 'category';
|
||||||
$this->export_enabled[$r]='$conf->societe->enabled';
|
$this->export_enabled[$r] = '$conf->societe->enabled';
|
||||||
$this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire"));
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire"));
|
||||||
$this->export_fields_array[$r]=array (
|
$this->export_fields_array[$r] = array(
|
||||||
'u.rowid' => "CategId",
|
'u.rowid' => "CategId",
|
||||||
'u.label' => "Label",
|
'u.label' => "Label",
|
||||||
'u.description' => "Description",
|
'u.description' => "Description",
|
||||||
@ -297,7 +297,7 @@ class modCategorie extends DolibarrModules
|
|||||||
's.url'=>"Url",
|
's.url'=>"Url",
|
||||||
's.email'=>"Email"
|
's.email'=>"Email"
|
||||||
);
|
);
|
||||||
$this->export_TypeFields_array[$r] = array (
|
$this->export_TypeFields_array[$r] = array(
|
||||||
'u.label' => "Text",
|
'u.label' => "Text",
|
||||||
'u.description' => "Text",
|
'u.description' => "Text",
|
||||||
'p.lastname' => 'Text',
|
'p.lastname' => 'Text',
|
||||||
@ -313,7 +313,7 @@ class modCategorie extends DolibarrModules
|
|||||||
's.url'=>"Text",
|
's.url'=>"Text",
|
||||||
's.email'=>"Text"
|
's.email'=>"Text"
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r] = array (
|
$this->export_entities_array[$r] = array(
|
||||||
'u.rowid' => "category",
|
'u.rowid' => "category",
|
||||||
'u.label' => "category",
|
'u.label' => "category",
|
||||||
'u.description' => "category",
|
'u.description' => "category",
|
||||||
@ -350,67 +350,67 @@ class modCategorie extends DolibarrModules
|
|||||||
); // We define here only fields that use another picto
|
); // We define here only fields that use another picto
|
||||||
|
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$fieldname='extra.'.$obj->name;
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldlabel = ucfirst($obj->label);
|
||||||
$typeFilter="Text";
|
$typeFilter = "Text";
|
||||||
switch($obj->type)
|
switch ($obj->type)
|
||||||
{
|
{
|
||||||
case 'int':
|
case 'int':
|
||||||
case 'double':
|
case 'double':
|
||||||
case 'price':
|
case 'price':
|
||||||
$typeFilter="Numeric";
|
$typeFilter = "Numeric";
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
$typeFilter="Date";
|
$typeFilter = "Date";
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$typeFilter="Boolean";
|
$typeFilter = "Boolean";
|
||||||
break;
|
break;
|
||||||
case 'sellist':
|
case 'sellist':
|
||||||
$typeFilter="List:".$obj->param;
|
$typeFilter = "List:".$obj->param;
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$typeFilter="Select:".$obj->param;
|
$typeFilter = "Select:".$obj->param;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
|
||||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
|
||||||
$this->export_entities_array[$r][$fieldname]='contact';
|
$this->export_entities_array[$r][$fieldname] = 'contact';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add axtra fields
|
// End add axtra fields
|
||||||
|
|
||||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_contact as cp, '.MAIN_DB_PREFIX.'socpeople as p';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country ON p.fk_pays = country.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
||||||
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
|
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
|
||||||
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
|
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
//--------
|
//--------
|
||||||
|
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]="CatList"; // Translation key
|
$this->import_label[$r] = "CatList"; // Translation key
|
||||||
$this->import_icon[$r]=$this->picto;
|
$this->import_icon[$r] = $this->picto;
|
||||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
$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('ca'=>MAIN_DB_PREFIX.'categorie');
|
$this->import_tables_array[$r] = array('ca'=>MAIN_DB_PREFIX.'categorie');
|
||||||
$this->import_fields_array[$r]=array(
|
$this->import_fields_array[$r] = array(
|
||||||
'ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description",
|
'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description",
|
||||||
'ca.fk_parent' => 'Parent'
|
'ca.fk_parent' => 'Parent'
|
||||||
);
|
);
|
||||||
$this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]');
|
$this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]');
|
||||||
$this->import_convertvalue_array[$r] = array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'ca.fk_parent' => array(
|
'ca.fk_parent' => array(
|
||||||
'rule' => 'fetchidfromcodeandlabel',
|
'rule' => 'fetchidfromcodeandlabel',
|
||||||
@ -421,96 +421,96 @@ class modCategorie extends DolibarrModules
|
|||||||
'codefromfield' => 'ca.type'
|
'codefromfield' => 'ca.type'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$typeexample="";
|
$typeexample = "";
|
||||||
if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; }
|
if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; }
|
||||||
if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; }
|
if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; }
|
||||||
if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; }
|
if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; }
|
||||||
if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; }
|
if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; }
|
||||||
$this->import_examplevalues_array[$r] = array(
|
$this->import_examplevalues_array[$r] = array(
|
||||||
'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"My Category description",
|
'ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"My Category description",
|
||||||
'ca.fk_parent' => '0'
|
'ca.fk_parent' => '0'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($conf->product->enabled))
|
if (!empty($conf->product->enabled))
|
||||||
{
|
{
|
||||||
//Products
|
//Products
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]="CatProdLinks"; // Translation key
|
$this->import_label[$r] = "CatProdLinks"; // Translation key
|
||||||
$this->import_icon[$r]=$this->picto;
|
$this->import_icon[$r] = $this->picto;
|
||||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
$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('cp'=>MAIN_DB_PREFIX.'categorie_product');
|
$this->import_tables_array[$r] = array('cp'=>MAIN_DB_PREFIX.'categorie_product');
|
||||||
$this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*");
|
$this->import_fields_array[$r] = array('cp.fk_categorie'=>"Category*", 'cp.fk_product'=>"Product*");
|
||||||
$this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0');
|
$this->import_regex_array[$r] = array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0');
|
||||||
|
|
||||||
$this->import_convertvalue_array[$r]=array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
|
'cp.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
|
||||||
'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product')
|
'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product')
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456");
|
$this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"Imported category", 'cp.fk_product'=>"PREF123456");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->societe->enabled))
|
if (!empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
// Customers
|
// Customers
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]="CatCusLinks"; // Translation key
|
$this->import_label[$r] = "CatCusLinks"; // Translation key
|
||||||
$this->import_icon[$r]=$this->picto;
|
$this->import_icon[$r] = $this->picto;
|
||||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
$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('cs'=>MAIN_DB_PREFIX.'categorie_societe');
|
$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
|
||||||
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*");
|
$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"ThirdParty*");
|
||||||
$this->import_regex_array[$r]=array(
|
$this->import_regex_array[$r] = array(
|
||||||
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2',
|
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2',
|
||||||
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0'
|
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->import_convertvalue_array[$r]=array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
|
'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
|
||||||
'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
|
'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty')
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany");
|
||||||
|
|
||||||
// Contacts/Addresses
|
// Contacts/Addresses
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]="CatContactsLinks"; // Translation key
|
$this->import_label[$r] = "CatContactsLinks"; // Translation key
|
||||||
$this->import_icon[$r]=$this->picto;
|
$this->import_icon[$r] = $this->picto;
|
||||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
$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('cs'=>MAIN_DB_PREFIX.'categorie_contact');
|
$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_contact');
|
||||||
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_socpeople'=>"Contact ID*");
|
$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_socpeople'=>"Contact ID*");
|
||||||
$this->import_regex_array[$r]=array(
|
$this->import_regex_array[$r] = array(
|
||||||
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4'
|
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4'
|
||||||
//'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople'
|
//'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->import_convertvalue_array[$r]=array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category')
|
'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category')
|
||||||
//'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact')
|
//'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact')
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_socpeople'=>"123");
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (!empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
// Suppliers
|
// Suppliers
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]="CatSupLinks"; // Translation key
|
$this->import_label[$r] = "CatSupLinks"; // Translation key
|
||||||
$this->import_icon[$r]=$this->picto;
|
$this->import_icon[$r] = $this->picto;
|
||||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
$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('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
|
$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
|
||||||
$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*");
|
$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"Supplier*");
|
||||||
$this->import_regex_array[$r]=array(
|
$this->import_regex_array[$r] = array(
|
||||||
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1',
|
'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1',
|
||||||
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0'
|
'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->import_convertvalue_array[$r]=array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
|
'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
|
||||||
'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
|
'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty')
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
* \ingroup projet
|
* \ingroup projet
|
||||||
* \brief Fichier de description et activation du module Projet
|
* \brief Fichier de description et activation du module Projet
|
||||||
*/
|
*/
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ class modProjet extends DolibarrModules
|
|||||||
|
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
$this->config_page_url = array("project.php@projet");
|
$this->config_page_url = array("project.php@projet");
|
||||||
$this->picto='project';
|
$this->picto = 'project';
|
||||||
|
|
||||||
// Data directories to create when module is enabled
|
// Data directories to create when module is enabled
|
||||||
$this->dirs = array("/projet/temp");
|
$this->dirs = array("/projet/temp");
|
||||||
@ -68,12 +68,12 @@ class modProjet extends DolibarrModules
|
|||||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||||
$this->langfiles = array('projects');
|
$this->langfiles = array('projects');
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array();
|
$this->const = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$this->const[$r][0] = "PROJECT_ADDON_PDF";
|
$this->const[$r][0] = "PROJECT_ADDON_PDF";
|
||||||
$this->const[$r][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
@ -139,7 +139,7 @@ class modProjet extends DolibarrModules
|
|||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array();
|
$this->boxes = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
$this->boxes[$r][1] = "box_project.php";
|
$this->boxes[$r][1] = "box_project.php";
|
||||||
$r++;
|
$r++;
|
||||||
$this->boxes[$r][1] = "box_task.php";
|
$this->boxes[$r][1] = "box_task.php";
|
||||||
@ -148,7 +148,7 @@ class modProjet extends DolibarrModules
|
|||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'projet';
|
$this->rights_class = 'projet';
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 41; // id de la permission
|
$this->rights[$r][0] = 41; // id de la permission
|
||||||
@ -210,38 +210,38 @@ class modProjet extends DolibarrModules
|
|||||||
|
|
||||||
//Exports
|
//Exports
|
||||||
//--------
|
//--------
|
||||||
$r=1;
|
$r = 1;
|
||||||
|
|
||||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
$this->export_label[$r] = 'ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
$this->export_permission[$r]=array(array("projet","export"));
|
$this->export_permission[$r] = array(array("projet", "export"));
|
||||||
$this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
|
$this->export_dependencies_array[$r] = array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
|
||||||
|
|
||||||
$this->export_TypeFields_array[$r]=array(
|
$this->export_TypeFields_array[$r] = array(
|
||||||
's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 's.fk_pays'=>'List:c_country:label',
|
||||||
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
's.phone'=>'Text', 's.email'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text',
|
||||||
'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text",
|
'p.rowid'=>"List:projet:ref::project", 'p.ref'=>"Text", 'p.title'=>"Text",
|
||||||
'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean',
|
'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean',
|
||||||
'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric',
|
||||||
'pt.rowid'=>'Numeric','pt.ref'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text",
|
||||||
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"
|
'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)", 'ptt.note'=>"Text"
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r]=array(
|
$this->export_entities_array[$r] = array(
|
||||||
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 's.fk_pays'=>'company',
|
||||||
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'
|
's.phone'=>'company', 's.email'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company'
|
||||||
);
|
);
|
||||||
$this->export_fields_array[$r]=array(
|
$this->export_fields_array[$r] = array(
|
||||||
's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
|
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 's.fk_pays'=>'Country',
|
||||||
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||||
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel',
|
'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel',
|
||||||
'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime',
|
'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime',
|
||||||
'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description"
|
'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description"
|
||||||
);
|
);
|
||||||
// Add multicompany field
|
// Add multicompany field
|
||||||
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
||||||
{
|
{
|
||||||
$nbofallowedentities=count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1
|
$nbofallowedentities = count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1
|
||||||
if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity');
|
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('p.entity'=>'Entity');
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
@ -251,68 +251,68 @@ class modProjet extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add fields for project
|
// Add fields for project
|
||||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
|
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array());
|
||||||
// Add extra fields for project
|
// Add extra fields for project
|
||||||
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
|
$keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
// Add fields for tasks
|
// Add fields for tasks
|
||||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription"));
|
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription"));
|
||||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask"));
|
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask"));
|
||||||
// Add extra fields for task
|
// Add extra fields for task
|
||||||
$keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2';
|
$keyforselect = 'projet_task'; $keyforelement = 'projecttask'; $keyforaliasextra = 'extra2';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
// End add extra fields
|
// End add extra fields
|
||||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
|
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote"));
|
||||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
|
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time', 'ptt.task_date'=>'task_time', 'ptt.task_duration'=>"task_time", 'ptt.fk_user'=>"task_time", 'ptt.note'=>"task_time"));
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
||||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed"));
|
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed"));
|
||||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time"));
|
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time"));
|
||||||
}
|
}
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid';
|
||||||
}
|
}
|
||||||
$this->export_sql_end[$r] .=" WHERE p.entity IN (".getEntity('project').")";
|
$this->export_sql_end[$r] .= " WHERE p.entity IN (".getEntity('project').")";
|
||||||
|
|
||||||
|
|
||||||
// Import list of tasks
|
// Import list of tasks
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]='tasksofprojects';
|
$this->import_code[$r] = 'tasksofprojects';
|
||||||
$this->import_label[$r]='ImportDatasetTasks';
|
$this->import_label[$r] = 'ImportDatasetTasks';
|
||||||
$this->import_icon[$r]='task';
|
$this->import_icon[$r] = 'task';
|
||||||
$this->import_entities_array[$r]=array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon
|
$this->import_entities_array[$r] = array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon
|
||||||
$this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
|
$this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
|
||||||
$this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation");
|
$this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation");
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$fieldname='extra.'.$obj->name;
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldlabel = ucfirst($obj->label);
|
||||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add extra fields
|
// End add extra fields
|
||||||
$this->import_fieldshidden_array[$r]=array('t.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
$this->import_fieldshidden_array[$r] = array('t.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||||
$this->import_convertvalue_array[$r]=array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'),
|
't.fk_projet'=>array('rule'=>'fetchidfromref', 'classfile'=>'/projet/class/project.class.php', 'class'=>'Project', 'method'=>'fetch', 'element'=>'Project'),
|
||||||
't.ref'=>array('rule'=>'getrefifauto')
|
't.ref'=>array('rule'=>'getrefifauto')
|
||||||
);
|
);
|
||||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||||
$this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
$this->import_regex_array[$r] = array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
||||||
$this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note");
|
$this->import_examplevalues_array[$r] = array('t.fk_projet'=>'MyProjectRef', 't.ref'=>"auto or TK2010-1234", 't.label'=>"My task", 't.progress'=>"0 (not started) to 100 (finished)", 't.datec'=>'1972-10-10', 't.note_private'=>"My private note", 't.note_public'=>"My public note");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,54 +327,54 @@ class modProjet extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
//ODT template for project
|
//ODT template for project
|
||||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt';
|
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt';
|
||||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/projects';
|
$dirodt = DOL_DATA_ROOT.'/doctemplates/projects';
|
||||||
$dest=$dirodt.'/template_project.odt';
|
$dest = $dirodt.'/template_project.odt';
|
||||||
|
|
||||||
if (file_exists($src) && ! file_exists($dest))
|
if (file_exists($src) && !file_exists($dest))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
dol_mkdir($dirodt);
|
dol_mkdir($dirodt);
|
||||||
$result=dol_copy($src, $dest, 0, 0);
|
$result = dol_copy($src, $dest, 0, 0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
|
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ODT template for tasks
|
//ODT template for tasks
|
||||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt';
|
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt';
|
||||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/tasks';
|
$dirodt = DOL_DATA_ROOT.'/doctemplates/tasks';
|
||||||
$dest=$dirodt.'/template_task_summary.odt';
|
$dest = $dirodt.'/template_task_summary.odt';
|
||||||
|
|
||||||
if (file_exists($src) && ! file_exists($dest))
|
if (file_exists($src) && !file_exists($dest))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
dol_mkdir($dirodt);
|
dol_mkdir($dirodt);
|
||||||
$result=dol_copy($src, $dest, 0, 0);
|
$result = dol_copy($src, $dest, 0, 0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
|
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
$sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity;
|
||||||
$sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")";
|
||||||
$sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity;
|
||||||
$sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")";
|
||||||
$sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity;
|
$sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity;
|
||||||
$sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")";
|
$sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")";
|
||||||
|
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
|
|||||||
@ -502,7 +502,7 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
$curY = $tab_top_newpage;
|
$curY = $tab_top_newpage;
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -548,7 +548,7 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
// We found a page break
|
// We found a page break
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -1101,28 +1101,28 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
//Local tax 1 before VAT
|
//Local tax 1 before VAT
|
||||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||||
//{
|
//{
|
||||||
foreach($this->localtax1 as $localtax_type => $localtax_rate)
|
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
|
||||||
{
|
{
|
||||||
if (in_array((string) $localtax_type, array('1','3','5'))) continue;
|
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
|
||||||
|
|
||||||
foreach($localtax_rate as $tvakey => $tvaval)
|
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||||
{
|
{
|
||||||
if ($tvakey!=0) // On affiche pas taux 0
|
if ($tvakey != 0) // On affiche pas taux 0
|
||||||
{
|
{
|
||||||
//$this->atleastoneratenotnull++;
|
//$this->atleastoneratenotnull++;
|
||||||
|
|
||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
|
||||||
$tvacompl='';
|
$tvacompl = '';
|
||||||
if (preg_match('/\*/', $tvakey))
|
if (preg_match('/\*/', $tvakey))
|
||||||
{
|
{
|
||||||
$tvakey=str_replace('*', '', $tvakey);
|
$tvakey = str_replace('*', '', $tvakey);
|
||||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||||
}
|
}
|
||||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
||||||
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
|
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||||
|
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
||||||
@ -1133,13 +1133,13 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
//Local tax 2 before VAT
|
//Local tax 2 before VAT
|
||||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||||
//{
|
//{
|
||||||
foreach($this->localtax2 as $localtax_type => $localtax_rate)
|
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
|
||||||
{
|
{
|
||||||
if (in_array((string) $localtax_type, array('1','3','5'))) continue;
|
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
|
||||||
|
|
||||||
foreach($localtax_rate as $tvakey => $tvaval)
|
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||||
{
|
{
|
||||||
if ($tvakey!=0) // On affiche pas taux 0
|
if ($tvakey != 0) // On affiche pas taux 0
|
||||||
{
|
{
|
||||||
//$this->atleastoneratenotnull++;
|
//$this->atleastoneratenotnull++;
|
||||||
|
|
||||||
@ -1148,15 +1148,15 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
|
||||||
$tvacompl='';
|
$tvacompl = '';
|
||||||
if (preg_match('/\*/', $tvakey))
|
if (preg_match('/\*/', $tvakey))
|
||||||
{
|
{
|
||||||
$tvakey=str_replace('*', '', $tvakey);
|
$tvakey = str_replace('*', '', $tvakey);
|
||||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||||
}
|
}
|
||||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
||||||
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
|
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||||
|
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
||||||
@ -1192,11 +1192,11 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
//Local tax 1 after VAT
|
//Local tax 1 after VAT
|
||||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||||
//{
|
//{
|
||||||
foreach($this->localtax1 as $localtax_type => $localtax_rate)
|
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
|
||||||
{
|
{
|
||||||
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
|
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
|
||||||
|
|
||||||
foreach($localtax_rate as $tvakey => $tvaval)
|
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||||
{
|
{
|
||||||
if ($tvakey != 0) // On affiche pas taux 0
|
if ($tvakey != 0) // On affiche pas taux 0
|
||||||
{
|
{
|
||||||
@ -1205,16 +1205,16 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
|
||||||
$tvacompl='';
|
$tvacompl = '';
|
||||||
if (preg_match('/\*/', $tvakey))
|
if (preg_match('/\*/', $tvakey))
|
||||||
{
|
{
|
||||||
$tvakey=str_replace('*', '', $tvakey);
|
$tvakey = str_replace('*', '', $tvakey);
|
||||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||||
}
|
}
|
||||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
|
||||||
|
|
||||||
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
|
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
||||||
}
|
}
|
||||||
@ -1224,11 +1224,11 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
//Local tax 2 after VAT
|
//Local tax 2 after VAT
|
||||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||||
//{
|
//{
|
||||||
foreach($this->localtax2 as $localtax_type => $localtax_rate)
|
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
|
||||||
{
|
{
|
||||||
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
|
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
|
||||||
|
|
||||||
foreach($localtax_rate as $tvakey => $tvaval)
|
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||||
{
|
{
|
||||||
// retrieve global local tax
|
// retrieve global local tax
|
||||||
if ($tvakey != 0) // On affiche pas taux 0
|
if ($tvakey != 0) // On affiche pas taux 0
|
||||||
@ -1238,16 +1238,16 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
$index++;
|
$index++;
|
||||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||||
|
|
||||||
$tvacompl='';
|
$tvacompl = '';
|
||||||
if (preg_match('/\*/', $tvakey))
|
if (preg_match('/\*/', $tvakey))
|
||||||
{
|
{
|
||||||
$tvakey=str_replace('*', '', $tvakey);
|
$tvakey = str_replace('*', '', $tvakey);
|
||||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||||
}
|
}
|
||||||
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
|
||||||
|
|
||||||
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
|
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
|
||||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||||
|
|
||||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
|
||||||
@ -1476,7 +1476,7 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
if ($this->emetteur->logo)
|
if ($this->emetteur->logo)
|
||||||
{
|
{
|
||||||
$logodir = $conf->mycompany->dir_output;
|
$logodir = $conf->mycompany->dir_output;
|
||||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||||
{
|
{
|
||||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||||
@ -1528,27 +1528,27 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -594,7 +594,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
$curY = $tab_top_newpage;
|
$curY = $tab_top_newpage;
|
||||||
|
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -640,7 +640,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
{
|
{
|
||||||
// We found a page break
|
// We found a page break
|
||||||
// Allows data in the first page if description is long enough to break in multiples pages
|
// Allows data in the first page if description is long enough to break in multiples pages
|
||||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||||
$showpricebeforepagebreak = 1;
|
$showpricebeforepagebreak = 1;
|
||||||
else
|
else
|
||||||
$showpricebeforepagebreak = 0;
|
$showpricebeforepagebreak = 0;
|
||||||
@ -1588,27 +1588,27 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PDF_SHOW_PROJECT))
|
if (!empty($conf->global->PDF_SHOW_PROJECT))
|
||||||
{
|
{
|
||||||
$object->fetch_projet();
|
$object->fetch_projet();
|
||||||
if (! empty($object->project->ref))
|
if (!empty($object->project->ref))
|
||||||
{
|
{
|
||||||
$posy+=3;
|
$posy += 3;
|
||||||
$pdf->SetXY($posx, $posy);
|
$pdf->SetXY($posx, $posy);
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R');
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public $fields=array(
|
public $fields = array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||||
@ -455,11 +455,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql .= " l.date_start, l.date_end,";
|
$sql .= " l.date_start, l.date_end,";
|
||||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||||
$sql.= ", pfp.rowid as fk_pfp, pfp.packaging";
|
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn";
|
||||||
$sql .= " WHERE l.fk_commande = ".$this->id;
|
$sql .= " WHERE l.fk_commande = ".$this->id;
|
||||||
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
||||||
$sql .= " ORDER BY l.rang, l.rowid";
|
$sql .= " ORDER BY l.rang, l.rowid";
|
||||||
@ -1701,7 +1701,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||||
{
|
{
|
||||||
$prod = new Product($this->db, $fk_product);
|
$prod = new Product($this->db, $fk_product);
|
||||||
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid));
|
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid));
|
||||||
if ($qty < $prod->packaging)
|
if ($qty < $prod->packaging)
|
||||||
{
|
{
|
||||||
$qty = $prod->packaging;
|
$qty = $prod->packaging;
|
||||||
@ -1710,7 +1710,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
if (($qty % $prod->packaging) > 0)
|
if (($qty % $prod->packaging) > 0)
|
||||||
{
|
{
|
||||||
$coeff = intval($qty/$prod->packaging) + 1;
|
$coeff = intval($qty / $prod->packaging) + 1;
|
||||||
$qty = $prod->packaging * $coeff;
|
$qty = $prod->packaging * $coeff;
|
||||||
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
||||||
}
|
}
|
||||||
@ -2679,7 +2679,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
if (($qty % $this->line->packaging) > 0)
|
if (($qty % $this->line->packaging) > 0)
|
||||||
{
|
{
|
||||||
$coeff = intval($qty/$this->line->packaging) + 1;
|
$coeff = intval($qty / $this->line->packaging) + 1;
|
||||||
$qty = $this->line->packaging * $coeff;
|
$qty = $this->line->packaging * $coeff;
|
||||||
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
||||||
}
|
}
|
||||||
@ -3451,11 +3451,11 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
||||||
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||||
$sql.= ", pfp.rowid as fk_pfp, pfp.packaging";
|
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
|
||||||
$sql .= ' WHERE cd.rowid = '.$rowid;
|
$sql .= ' WHERE cd.rowid = '.$rowid;
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -218,7 +218,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
public $fk_facture_source;
|
public $fk_facture_source;
|
||||||
|
|
||||||
|
|
||||||
public $fields=array(
|
public $fields = array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||||
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||||
@ -2287,7 +2287,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
if ($facturestatic->hasDelay()) {
|
if ($facturestatic->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
$response->url_late=DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
@ -360,7 +360,7 @@ class ProductFournisseur extends Product
|
|||||||
$sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
$sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||||
$sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
$sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||||
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging = ".(empty($packaging) ? 1 : $packaging);
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging);
|
||||||
$sql .= " WHERE rowid = ".$this->product_fourn_price_id;
|
$sql .= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||||
// TODO Add price_base_type and price_ttc
|
// TODO Add price_base_type and price_ttc
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ class ProductFournisseur extends Product
|
|||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
|
||||||
$sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
$sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
||||||
$sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)";
|
$sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging";
|
||||||
$sql .= " values(";
|
$sql .= " values(";
|
||||||
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||||
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||||
@ -438,14 +438,14 @@ class ProductFournisseur extends Product
|
|||||||
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||||
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)) ;
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging));
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
$this->product_fourn_price_id = 0;
|
$this->product_fourn_price_id = 0;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price");
|
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error++;
|
$error++;
|
||||||
@ -505,7 +505,7 @@ class ProductFournisseur extends Product
|
|||||||
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
||||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||||
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
|
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ class ProductFournisseur extends Product
|
|||||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||||
$sql .= " AND pfp.fk_soc = s.rowid";
|
$sql .= " AND pfp.fk_soc = s.rowid";
|
||||||
|
|||||||
@ -166,7 +166,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql .= " WHERE cf.fk_soc = s.rowid";
|
$sql .= " WHERE cf.fk_soc = s.rowid";
|
||||||
$sql.= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
|
$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing
|
||||||
if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid;
|
if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
$sql .= " GROUP BY cf.fk_statut";
|
$sql .= " GROUP BY cf.fk_statut";
|
||||||
@ -253,23 +253,23 @@ if (!empty($conf->fournisseur->enabled))
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
$sql .= " DISTINCT";
|
$sql .= " DISTINCT";
|
||||||
}
|
}
|
||||||
$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
|
$sql .= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||||
{
|
{
|
||||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
$sql.= " WHERE ((ug.fk_user = u.rowid";
|
$sql .= " WHERE ((ug.fk_user = u.rowid";
|
||||||
$sql.= " AND ug.entity IN (".getEntity('usergroup')."))";
|
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||||
$sql.= " OR u.entity = 0)"; // Show always superadmin
|
$sql .= " OR u.entity = 0)"; // Show always superadmin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql.= " WHERE (u.entity IN (".getEntity('user').")";
|
$sql .= " WHERE (u.entity IN (".getEntity('user').")";
|
||||||
}
|
}
|
||||||
$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved
|
$sql .= " AND u.fk_soc IS NULL"; // An external user can not approved
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -290,7 +290,7 @@ if ($resql)
|
|||||||
$userstatic->id = $obj->rowid;
|
$userstatic->id = $obj->rowid;
|
||||||
$userstatic->getrights('fournisseur');
|
$userstatic->getrights('fournisseur');
|
||||||
|
|
||||||
if (! empty($userstatic->rights->fournisseur->commande->approuver))
|
if (!empty($userstatic->rights->fournisseur->commande->approuver))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|||||||
@ -25,39 +25,39 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Load Dolibarr environment
|
// Load Dolibarr environment
|
||||||
$res=0;
|
$res = 0;
|
||||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
|
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
|
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||||
// Try main.inc.php using relative path
|
// Try main.inc.php using relative path
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
|
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
|
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
|
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||||
if (! $res) die("Include of main fails");
|
if (!$res) die("Include of main fails");
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("mymodule@mymodule"));
|
$langs->loadLangs(array("mymodule@mymodule"));
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
//if (! $user->rights->mymodule->myobject->read) accessforbidden();
|
//if (! $user->rights->mymodule->myobject->read) accessforbidden();
|
||||||
$socid=GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
if (isset($user->socid) && $user->socid > 0)
|
if (isset($user->socid) && $user->socid > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$max=5;
|
$max = 5;
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -164,8 +164,8 @@ END MODULEBUILDER DRAFT MYOBJECT */
|
|||||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
|
||||||
$NBMAX=3;
|
$NBMAX = 3;
|
||||||
$max=3;
|
$max = 3;
|
||||||
|
|
||||||
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
||||||
// Last modified myobject
|
// Last modified myobject
|
||||||
|
|||||||
@ -639,7 +639,7 @@ class Mo extends CommonObject
|
|||||||
if ($bom->id > 0)
|
if ($bom->id > 0)
|
||||||
{
|
{
|
||||||
// Lines to consume
|
// Lines to consume
|
||||||
if (! $error) {
|
if (!$error) {
|
||||||
foreach ($bom->lines as $line)
|
foreach ($bom->lines as $line)
|
||||||
{
|
{
|
||||||
$moline = new MoLine($this->db);
|
$moline = new MoLine($this->db);
|
||||||
|
|||||||
@ -670,57 +670,57 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['m.rowid']['checked']))
|
if (!empty($arrayfields['m.rowid']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.datem']['checked']))
|
if (!empty($arrayfields['m.datem']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['p.ref']['checked']))
|
if (!empty($arrayfields['p.ref']['checked']))
|
||||||
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['p.label']['checked']))
|
if (!empty($arrayfields['p.label']['checked']))
|
||||||
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.batch']['checked']))
|
if (!empty($arrayfields['m.batch']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['pl.eatby']['checked']))
|
if (!empty($arrayfields['pl.eatby']['checked']))
|
||||||
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['pl.sellby']['checked']))
|
if (!empty($arrayfields['pl.sellby']['checked']))
|
||||||
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['e.ref']['checked'])) {
|
if (!empty($arrayfields['e.ref']['checked'])) {
|
||||||
// We are on a specific warehouse card, no filter on other should be possible
|
// We are on a specific warehouse card, no filter on other should be possible
|
||||||
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.fk_user_author']['checked']))
|
if (!empty($arrayfields['m.fk_user_author']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.inventorycode']['checked']))
|
if (!empty($arrayfields['m.inventorycode']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.label']['checked']))
|
if (!empty($arrayfields['m.label']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.type_mouvement']['checked']))
|
if (!empty($arrayfields['m.type_mouvement']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (! empty($arrayfields['origin']['checked']))
|
if (!empty($arrayfields['origin']['checked']))
|
||||||
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||||
if (! empty($arrayfields['m.value']['checked']))
|
if (!empty($arrayfields['m.value']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (! empty($arrayfields['m.price']['checked']))
|
if (!empty($arrayfields['m.price']['checked']))
|
||||||
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
|
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters = array('arrayfields' => $arrayfields,'param' => $param,'sortfield' => $sortfield,'sortorder' => $sortorder);
|
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (! empty($arrayfields['m.datec']['checked'])) {
|
if (!empty($arrayfields['m.datec']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.tms']['checked'])) {
|
if (!empty($arrayfields['m.tms']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||||
}
|
}
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql) {
|
if (!$resql) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -752,7 +752,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$warehousestatic->label = $objp->warehouse_ref;
|
$warehousestatic->label = $objp->warehouse_ref;
|
||||||
$warehousestatic->lieu = $objp->lieu;
|
$warehousestatic->lieu = $objp->lieu;
|
||||||
|
|
||||||
if (! empty($objp->fk_origin)) {
|
if (!empty($objp->fk_origin)) {
|
||||||
$origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
|
$origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
|
||||||
} else {
|
} else {
|
||||||
$origin = '';
|
$origin = '';
|
||||||
@ -760,21 +760,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
// Id movement
|
// Id movement
|
||||||
if (! empty($arrayfields['m.rowid']['checked'])) {
|
if (!empty($arrayfields['m.rowid']['checked'])) {
|
||||||
// This is primary not movement id
|
// This is primary not movement id
|
||||||
print '<td>' . $objp->mid . '</td>';
|
print '<td>'.$objp->mid.'</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.datem']['checked'])) {
|
if (!empty($arrayfields['m.datem']['checked'])) {
|
||||||
// Date
|
// Date
|
||||||
print '<td>' . dol_print_date($db->jdate($objp->datem), 'dayhour') . '</td>';
|
print '<td>'.dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.ref']['checked'])) {
|
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||||
// Product ref
|
// Product ref
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $productstatic->getNomUrl(1, 'stock', 16);
|
print $productstatic->getNomUrl(1, 'stock', 16);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.label']['checked'])) {
|
if (!empty($arrayfields['p.label']['checked'])) {
|
||||||
// Product label
|
// Product label
|
||||||
print '<td>';
|
print '<td>';
|
||||||
/*
|
/*
|
||||||
@ -786,7 +786,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print $productstatic->label;
|
print $productstatic->label;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.batch']['checked'])) {
|
if (!empty($arrayfields['m.batch']['checked'])) {
|
||||||
print '<td class="center nowraponall">';
|
print '<td class="center nowraponall">';
|
||||||
if ($productlot->id > 0)
|
if ($productlot->id > 0)
|
||||||
print $productlot->getNomUrl(1);
|
print $productlot->getNomUrl(1);
|
||||||
@ -794,25 +794,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
|
print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['pl.eatby']['checked'])) {
|
if (!empty($arrayfields['pl.eatby']['checked'])) {
|
||||||
print '<td class="center">' . dol_print_date($objp->eatby, 'day') . '</td>';
|
print '<td class="center">'.dol_print_date($objp->eatby, 'day').'</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['pl.sellby']['checked'])) {
|
if (!empty($arrayfields['pl.sellby']['checked'])) {
|
||||||
print '<td class="center">' . dol_print_date($objp->sellby, 'day') . '</td>';
|
print '<td class="center">'.dol_print_date($objp->sellby, 'day').'</td>';
|
||||||
}
|
}
|
||||||
// Warehouse
|
// Warehouse
|
||||||
if (! empty($arrayfields['e.ref']['checked'])) {
|
if (!empty($arrayfields['e.ref']['checked'])) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $warehousestatic->getNomUrl(1);
|
print $warehousestatic->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
// Author
|
// Author
|
||||||
if (! empty($arrayfields['m.fk_user_author']['checked'])) {
|
if (!empty($arrayfields['m.fk_user_author']['checked'])) {
|
||||||
print '<td class="tdoverflowmax100">';
|
print '<td class="tdoverflowmax100">';
|
||||||
print $userstatic->getNomUrl(- 1);
|
print $userstatic->getNomUrl(-1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.inventorycode']['checked'])) {
|
if (!empty($arrayfields['m.inventorycode']['checked'])) {
|
||||||
// Inventory code
|
// Inventory code
|
||||||
print '<td>';
|
print '<td>';
|
||||||
//print '<a href="' . DOL_URL_ROOT . '/product/stock/movement_card.php' . '?id=' . $objp->entrepot_id . '&search_inventorycode=' . $objp->inventorycode . '&search_type_mouvement=' . $objp->type_mouvement . '">';
|
//print '<a href="' . DOL_URL_ROOT . '/product/stock/movement_card.php' . '?id=' . $objp->entrepot_id . '&search_inventorycode=' . $objp->inventorycode . '&search_type_mouvement=' . $objp->type_mouvement . '">';
|
||||||
@ -820,32 +820,32 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
//print '</a>';
|
//print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.label']['checked'])) {
|
if (!empty($arrayfields['m.label']['checked'])) {
|
||||||
// Label of movement
|
// Label of movement
|
||||||
print '<td class="tdoverflowmax100aaa">' . $objp->label . '</td>';
|
print '<td class="tdoverflowmax100aaa">'.$objp->label.'</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.type_mouvement']['checked'])) {
|
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
|
||||||
// Type of movement
|
// Type of movement
|
||||||
switch ($objp->type_mouvement) {
|
switch ($objp->type_mouvement) {
|
||||||
case "0":
|
case "0":
|
||||||
print '<td class="center">' . $langs->trans('StockIncreaseAfterCorrectTransfer') . '</td>';
|
print '<td class="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
print '<td class="center">' . $langs->trans('StockDecreaseAfterCorrectTransfer') . '</td>';
|
print '<td class="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>';
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
print '<td class="center">' . $langs->trans('StockDecrease') . '</td>';
|
print '<td class="center">'.$langs->trans('StockDecrease').'</td>';
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
print '<td class="center">' . $langs->trans('StockIncrease') . '</td>';
|
print '<td class="center">'.$langs->trans('StockIncrease').'</td>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['origin']['checked'])) {
|
if (!empty($arrayfields['origin']['checked'])) {
|
||||||
// Origin of movement
|
// Origin of movement
|
||||||
print '<td class="nowraponall">' . $origin . '</td>';
|
print '<td class="nowraponall">'.$origin.'</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.value']['checked'])) {
|
if (!empty($arrayfields['m.value']['checked'])) {
|
||||||
// Qty
|
// Qty
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ($objp->qt > 0)
|
if ($objp->qt > 0)
|
||||||
@ -853,7 +853,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print $objp->qty;
|
print $objp->qty;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['m.price']['checked'])) {
|
if (!empty($arrayfields['m.price']['checked'])) {
|
||||||
// Price
|
// Price
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ($objp->price != 0)
|
if ($objp->price != 0)
|
||||||
@ -867,11 +867,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$selected = 0;
|
$selected = 0;
|
||||||
if (in_array($obj->rowid, $arrayofselected))
|
if (in_array($obj->rowid, $arrayofselected))
|
||||||
$selected = 1;
|
$selected = 1;
|
||||||
print '<input id="cb' . $obj->rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i)
|
if (!$i)
|
||||||
$totalarray['nbfield'] ++;
|
$totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -167,7 +167,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Line to produce
|
// Line to produce
|
||||||
$moline->fk_mo = $object->id;
|
$moline->fk_mo = $object->id;
|
||||||
$moline->qty = GETPOST('qtytoadd', 'int');;
|
$moline->qty = GETPOST('qtytoadd', 'int'); ;
|
||||||
$moline->fk_product = GETPOST('productidtoadd', 'int');
|
$moline->fk_product = GETPOST('productidtoadd', 'int');
|
||||||
$moline->role = 'toconsume';
|
$moline->role = 'toconsume';
|
||||||
$moline->position = 0;
|
$moline->position = 0;
|
||||||
@ -546,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
if (! in_array($action, array('consumeorproduce', 'consumeandproduceall')))
|
if (!in_array($action, array('consumeorproduce', 'consumeandproduceall')))
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
@ -700,14 +700,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (!empty($object->lines))
|
if (!empty($object->lines))
|
||||||
{
|
{
|
||||||
$nblinetoconsume = 0;
|
$nblinetoconsume = 0;
|
||||||
foreach($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
if ($line->role == 'toconsume') {
|
if ($line->role == 'toconsume') {
|
||||||
$nblinetoconsume++;
|
$nblinetoconsume++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$nblinetoconsumecursor = 0;
|
$nblinetoconsumecursor = 0;
|
||||||
foreach($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
if ($line->role == 'toconsume') {
|
if ($line->role == 'toconsume') {
|
||||||
$nblinetoconsumecursor++;
|
$nblinetoconsumecursor++;
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
|
$arrayoflines = $object->fetchLinesLinked('consumed', $line->id);
|
||||||
$alreadyconsumed = 0;
|
$alreadyconsumed = 0;
|
||||||
foreach($arrayoflines as $line2) {
|
foreach ($arrayoflines as $line2) {
|
||||||
$alreadyconsumed += $line2['qty'];
|
$alreadyconsumed += $line2['qty'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Show detailed of already consumed with js code to collapse
|
// Show detailed of already consumed with js code to collapse
|
||||||
foreach($arrayoflines as $line2) {
|
foreach ($arrayoflines as $line2) {
|
||||||
print '<tr class="expanddetail'.$line->id.' hideobject opacitylow">';
|
print '<tr class="expanddetail'.$line->id.' hideobject opacitylow">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print dol_print_date($line2['date'], 'dayhour');
|
print dol_print_date($line2['date'], 'dayhour');
|
||||||
@ -792,7 +792,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ToConsume").'</td>';
|
print '<td>'.$langs->trans("ToConsume").'</td>';
|
||||||
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
|
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
|
||||||
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
|
if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
|
||||||
print '<td class="right"><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
print '<td class="right"><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -851,14 +851,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (!empty($object->lines))
|
if (!empty($object->lines))
|
||||||
{
|
{
|
||||||
$nblinetoproduce = 0;
|
$nblinetoproduce = 0;
|
||||||
foreach($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
if ($line->role == 'toproduce') {
|
if ($line->role == 'toproduce') {
|
||||||
$nblinetoproduce++;
|
$nblinetoproduce++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$nblinetoproducecursor = 0;
|
$nblinetoproducecursor = 0;
|
||||||
foreach($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
if ($line->role == 'toproduce') {
|
if ($line->role == 'toproduce') {
|
||||||
$nblinetoproducecursor++;
|
$nblinetoproducecursor++;
|
||||||
|
|
||||||
@ -867,7 +867,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
$arrayoflines = $object->fetchLinesLinked('produced', $line->id);
|
$arrayoflines = $object->fetchLinesLinked('produced', $line->id);
|
||||||
$alreadyproduced = 0;
|
$alreadyproduced = 0;
|
||||||
foreach($arrayoflines as $line2) {
|
foreach ($arrayoflines as $line2) {
|
||||||
$alreadyproduced += $line2['qty'];
|
$alreadyproduced += $line2['qty'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Show detailed of already consumed with js code to collapse
|
// Show detailed of already consumed with js code to collapse
|
||||||
foreach($arrayoflines as $line2) {
|
foreach ($arrayoflines as $line2) {
|
||||||
print '<tr class="expanddetailtoproduce'.$line->id.' hideobject opacitylow">';
|
print '<tr class="expanddetailtoproduce'.$line->id.' hideobject opacitylow">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print dol_print_date($line2['date'], 'dayhour');
|
print dol_print_date($line2['date'], 'dayhour');
|
||||||
@ -928,7 +928,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ToProduce").'</td>';
|
print '<td>'.$langs->trans("ToProduce").'</td>';
|
||||||
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
|
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
|
||||||
if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
|
if ($action == 'consumeorproduce' && !GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
|
||||||
print '<td class="right"><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
print '<td class="right"><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|||||||
@ -37,31 +37,31 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin","products"));
|
$langs->loadLangs(array("admin", "products"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled)))
|
if (!$user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled)))
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$value = GETPOST('value', 'alpha');
|
$value = GETPOST('value', 'alpha');
|
||||||
$label = GETPOST('label', 'alpha');
|
$label = GETPOST('label', 'alpha');
|
||||||
$scandir = GETPOST('scan_dir', 'alpha');
|
$scandir = GETPOST('scan_dir', 'alpha');
|
||||||
$type='product';
|
$type = 'product';
|
||||||
|
|
||||||
// Pricing Rules
|
// Pricing Rules
|
||||||
$select_pricing_rules=array(
|
$select_pricing_rules = array(
|
||||||
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price
|
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price
|
||||||
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level
|
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level
|
||||||
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer
|
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer
|
||||||
);
|
);
|
||||||
$keyforparam='PRODUIT_CUSTOMER_PRICES_BY_QTY';
|
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || !empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
|
||||||
$keyforparam='PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
|
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2 || ! empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')';
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->$keyforparam)) $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility').'+'.$langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')';
|
||||||
|
|
||||||
// Clean param
|
// Clean param
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) {
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) {
|
||||||
dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ $error = 0;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$nomessageinsetmoduleoptions=1;
|
$nomessageinsetmoduleoptions = 1;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'setcodeproduct')
|
if ($action == 'setcodeproduct')
|
||||||
@ -91,12 +91,12 @@ if ($action == 'setcodeproduct')
|
|||||||
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
|
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'), 'chaine', 0, '', $conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
}
|
}
|
||||||
if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0)
|
if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'), 'chaine', 0, '', $conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
}
|
}
|
||||||
if ($action == 'other')
|
if ($action == 'other')
|
||||||
{
|
{
|
||||||
@ -114,8 +114,8 @@ if ($action == 'other')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$multirule=explode('&', $princingrules);
|
$multirule = explode('&', $princingrules);
|
||||||
foreach($multirule as $rulesselected)
|
foreach ($multirule as $rulesselected)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ if ($action == 'other')
|
|||||||
}
|
}
|
||||||
else // We clear this mode
|
else // We clear this mode
|
||||||
{
|
{
|
||||||
if (strpos($rule, '&')===false) {
|
if (strpos($rule, '&') === false) {
|
||||||
$res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,20 +172,20 @@ if ($action == 'other')
|
|||||||
|
|
||||||
if ($action == 'specimen') // For products
|
if ($action == 'specimen') // For products
|
||||||
{
|
{
|
||||||
$modele= GETPOST('module', 'alpha');
|
$modele = GETPOST('module', 'alpha');
|
||||||
|
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->initAsSpecimen();
|
$product->initAsSpecimen();
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file = ''; $classname = ''; $filefound = 0;
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$file=dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0);
|
$file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound = 1;
|
||||||
$classname = "pdf_".$modele;
|
$classname = "pdf_".$modele;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ if ($action == 'set')
|
|||||||
$value = GETPOST('value');
|
$value = GETPOST('value');
|
||||||
if (GETPOST('value', 'alpha')) $res = dolibarr_set_const($db, $const, $value, 'chaine', 0, '', $conf->entity);
|
if (GETPOST('value', 'alpha')) $res = dolibarr_set_const($db, $const, $value, 'chaine', 0, '', $conf->entity);
|
||||||
else $res = dolibarr_del_const($db, $const, $conf->entity);
|
else $res = dolibarr_del_const($db, $const, $conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($action == 'other')
|
//if ($action == 'other')
|
||||||
@ -267,7 +267,7 @@ if ($action == 'set')
|
|||||||
|
|
||||||
if ($action)
|
if ($action)
|
||||||
{
|
{
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ if ($action)
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$formbarcode=new FormBarCode($db);
|
$formbarcode = new FormBarCode($db);
|
||||||
|
|
||||||
$title = $langs->trans('ProductServiceSetup');
|
$title = $langs->trans('ProductServiceSetup');
|
||||||
$tab = $langs->trans("ProductsAndServices");
|
$tab = $langs->trans("ProductsAndServices");
|
||||||
@ -298,17 +298,17 @@ elseif (empty($conf->service->enabled))
|
|||||||
|
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($title, $linkback, 'title_setup');
|
print load_fiche_titre($title, $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = product_admin_prepare_head();
|
$head = product_admin_prepare_head();
|
||||||
dol_fiche_head($head, 'general', $tab, -1, 'product');
|
dol_fiche_head($head, 'general', $tab, -1, 'product');
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
// Module to manage product / services code
|
// Module to manage product / services code
|
||||||
$dirproduct=array('/core/modules/product/');
|
$dirproduct = array('/core/modules/product/');
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ProductCodeChecker"), '', '');
|
print load_fiche_titre($langs->trans("ProductCodeChecker"), '', '');
|
||||||
|
|
||||||
@ -330,16 +330,16 @@ foreach ($dirproduct as $dirroot)
|
|||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
// Loop on each module find in opened directory
|
// Loop on each module find in opened directory
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (substr($file, 0, 16) == 'mod_codeproduct_' && substr($file, -3) == 'php')
|
if (substr($file, 0, 16) == 'mod_codeproduct_' && substr($file, -3) == 'php')
|
||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file)-4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dol_include_once($dirroot.$file.'.php');
|
dol_include_once($dirroot.$file.'.php');
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
dol_syslog($e->getMessage(), LOG_ERR);
|
dol_syslog($e->getMessage(), LOG_ERR);
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ foreach ($dirproduct as $dirroot)
|
|||||||
print '<td>'.$modCodeProduct->info($langs).'</td>'."\n";
|
print '<td>'.$modCodeProduct->info($langs).'</td>'."\n";
|
||||||
print '<td class="nowrap">'.$modCodeProduct->getExample($langs).'</td>'."\n";
|
print '<td class="nowrap">'.$modCodeProduct->getExample($langs).'</td>'."\n";
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file)
|
if (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file)
|
||||||
{
|
{
|
||||||
print '<td class="center">'."\n";
|
print '<td class="center">'."\n";
|
||||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||||
@ -365,16 +365,16 @@ foreach ($dirproduct as $dirroot)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$disabled = false;
|
$disabled = false;
|
||||||
if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
|
if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if (! $disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeproduct&value='.$file.'">';
|
if (!$disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeproduct&value='.$file.'">';
|
||||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||||
if (! $disabled) print '</a>';
|
if (!$disabled) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
$s=$modCodeProduct->getToolTip($langs, null, -1);
|
$s = $modCodeProduct->getToolTip($langs, null, -1);
|
||||||
print $form->textwithpicto('', $s, 1);
|
print $form->textwithpicto('', $s, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -389,14 +389,14 @@ print '</table>';
|
|||||||
// Module to build doc
|
// Module to build doc
|
||||||
$def = array();
|
$def = array();
|
||||||
$sql = "SELECT nom";
|
$sql = "SELECT nom";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql.= " WHERE type = '".$type."'";
|
$sql .= " WHERE type = '".$type."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$resql=$db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$num_rows=$db->num_rows($resql);
|
$num_rows = $db->num_rows($resql);
|
||||||
while ($i < $num_rows)
|
while ($i < $num_rows)
|
||||||
{
|
{
|
||||||
$array = $db->fetch_array($resql);
|
$array = $db->fetch_array($resql);
|
||||||
@ -427,41 +427,41 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
foreach (array('','/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/product".$valdir);
|
$dir = dol_buildpath($reldir."core/modules/product".$valdir);
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle=opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
$filelist[]=$file;
|
$filelist[] = $file;
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
arsort($filelist);
|
arsort($filelist);
|
||||||
|
|
||||||
foreach($filelist as $file)
|
foreach ($filelist as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||||
{
|
{
|
||||||
if (file_exists($dir.'/'.$file))
|
if (file_exists($dir.'/'.$file))
|
||||||
{
|
{
|
||||||
$name = substr($file, 4, dol_strlen($file) -16);
|
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||||
|
|
||||||
require_once $dir.'/'.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
$modulequalified=1;
|
$modulequalified = 1;
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||||
|
|
||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven"><td width="100">';
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print (empty($module->name)?$name:$module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
@ -497,14 +497,14 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
if ($module->type == 'pdf')
|
if ($module->type == 'pdf')
|
||||||
{
|
{
|
||||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
@ -561,10 +561,10 @@ print '<td width="80"> </td></tr>'."\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$rowspan = 4;
|
$rowspan = 4;
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++;
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++;
|
||||||
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++;
|
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++;
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++;
|
if (!empty($conf->global->MAIN_MULTILANGS)) $rowspan++;
|
||||||
if (! empty($conf->fournisseur->enabled)) $rowspan++;
|
if (!empty($conf->fournisseur->enabled)) $rowspan++;
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -578,10 +578,10 @@ else
|
|||||||
}
|
}
|
||||||
print '<td width="60" class="right">';
|
print '<td width="60" class="right">';
|
||||||
$current_rule = 'PRODUCT_PRICE_UNIQ';
|
$current_rule = 'PRODUCT_PRICE_UNIQ';
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule='PRODUIT_MULTIPRICES';
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule = 'PRODUIT_MULTIPRICES';
|
||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY';
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY';
|
||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES';
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES';
|
||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
|
||||||
print $form->selectarray("princingrule", $select_pricing_rules, $current_rule);
|
print $form->selectarray("princingrule", $select_pricing_rules, $current_rule);
|
||||||
print '</td><td rowspan="'.$rowspan.'" class="nohover right">';
|
print '</td><td rowspan="'.$rowspan.'" class="nohover right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
@ -590,7 +590,7 @@ print '</tr>';
|
|||||||
|
|
||||||
|
|
||||||
// multiprix nombre de prix a proposer
|
// multiprix nombre de prix a proposer
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>';
|
print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>';
|
||||||
@ -620,7 +620,7 @@ if (empty($conf->use_javascript_ajax))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td width="60" class="right">';
|
print '<td width="60" class="right">';
|
||||||
$arrval=array(
|
$arrval = array(
|
||||||
'0'=>$langs->trans("No"),
|
'0'=>$langs->trans("No"),
|
||||||
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
|
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
|
||||||
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
|
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
|
||||||
@ -670,38 +670,38 @@ print '</tr>';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// View product description in thirdparty language
|
// View product description in thirdparty language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>';
|
print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>';
|
||||||
print '<td width="60" class="right">';
|
print '<td width="60" class="right">';
|
||||||
print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)?$conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE:0), 1);
|
print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) ? $conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE : 0), 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (!empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("UseProductFournDesc").'</td>';
|
print '<td>'.$langs->trans("UseProductFournDesc").'</td>';
|
||||||
print '<td width="60" class="right">';
|
print '<td width="60" class="right">';
|
||||||
print $form->selectyesno("activate_useProdFournDesc", (! empty($conf->global->PRODUIT_FOURN_TEXTS)?$conf->global->PRODUIT_FOURN_TEXTS:0), 1);
|
print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("UseProductSupplierPackaging").'</td>';
|
print '<td>'.$langs->trans("UseProductSupplierPackaging").'</td>';
|
||||||
print '<td width="60" align="right">';
|
print '<td width="60" align="right">';
|
||||||
print $form->selectyesno("activate_useProdSupplierPackaging", (! empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)?$conf->global->PRODUCT_USE_SUPPLIER_PACKAGING:0), 1);
|
print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUCT_CANVAS_ABILITY))
|
if (!empty($conf->global->PRODUCT_CANVAS_ABILITY))
|
||||||
{
|
{
|
||||||
// Add canvas feature
|
// Add canvas feature
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/";
|
$dir = DOL_DOCUMENT_ROOT."/product/canvas/";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("ProductSpecial").'</td>'."\n";
|
print '<td>'.$langs->trans("ProductSpecial").'</td>'."\n";
|
||||||
@ -710,12 +710,12 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY))
|
|||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
|
||||||
$handle=opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
|
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1724,7 +1724,7 @@ class Product extends CommonObject
|
|||||||
$sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
$sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
||||||
$sql .= " ,pfp.default_vat_code";
|
$sql .= " ,pfp.default_vat_code";
|
||||||
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||||
$sql .= " WHERE pfp.rowid = ".$prodfournprice;
|
$sql .= " WHERE pfp.rowid = ".$prodfournprice;
|
||||||
if ($qty > 0) { $sql .= " AND pfp.quantity <= ".$qty;
|
if ($qty > 0) { $sql .= " AND pfp.quantity <= ".$qty;
|
||||||
@ -1778,7 +1778,7 @@ class Product extends CommonObject
|
|||||||
$sql .= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.desc_fourn as desc_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
$sql .= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.desc_fourn as desc_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
|
||||||
$sql .= " ,pfp.default_vat_code";
|
$sql .= " ,pfp.default_vat_code";
|
||||||
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||||
$sql .= " WHERE pfp.fk_product = ".$product_id;
|
$sql .= " WHERE pfp.fk_product = ".$product_id;
|
||||||
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
||||||
|
|||||||
@ -181,7 +181,7 @@ class PriceParser
|
|||||||
//Do processing
|
//Do processing
|
||||||
$res = $entry->process();
|
$res = $entry->process();
|
||||||
//Store any error or clear status if OK
|
//Store any error or clear status if OK
|
||||||
$entry->update_status($res < 1?$entry->error:'', $user);
|
$entry->update_status($res < 1 ? $entry->error : '', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get all global values
|
//Get all global values
|
||||||
@ -216,7 +216,7 @@ class PriceParser
|
|||||||
{
|
{
|
||||||
$data = explode($this->special_chr, $expression);
|
$data = explode($this->special_chr, $expression);
|
||||||
$variable = $this->special_chr.$data[1];
|
$variable = $this->special_chr.$data[1];
|
||||||
if (isset($data[2])) $variable.= $this->special_chr;
|
if (isset($data[2])) $variable .= $this->special_chr;
|
||||||
$this->error_parser = array(23, array($variable, $expression));
|
$this->error_parser = array(23, array($variable, $expression));
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ class PriceParser
|
|||||||
if ($res < 0) {
|
if ($res < 0) {
|
||||||
$this->error_parser = array(25, null);
|
$this->error_parser = array(25, null);
|
||||||
return -1;
|
return -1;
|
||||||
} elseif($res == 0){
|
} elseif ($res == 0) {
|
||||||
$supplier_min_price = 0;
|
$supplier_min_price = 0;
|
||||||
} else {
|
} else {
|
||||||
$supplier_min_price = $productFournisseur->fourn_unitprice;
|
$supplier_min_price = $productFournisseur->fourn_unitprice;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class MouvementStock extends CommonObject
|
|||||||
public $batch;
|
public $batch;
|
||||||
|
|
||||||
|
|
||||||
public $fields=array(
|
public $fields = array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||||
'datem' =>array('type'=>'datetime', 'label'=>'Datem', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
'datem' =>array('type'=>'datetime', 'label'=>'Datem', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||||
@ -376,8 +376,8 @@ class MouvementStock extends CommonObject
|
|||||||
if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
|
if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
|
||||||
{
|
{
|
||||||
$fk_project = 0;
|
$fk_project = 0;
|
||||||
if(!empty($this->origin)) { // This is set by caller for tracking reason
|
if (!empty($this->origin)) { // This is set by caller for tracking reason
|
||||||
$origintype = empty($this->origin->origin_type)?$this->origin->element:$this->origin->origin_type;
|
$origintype = empty($this->origin->origin_type) ? $this->origin->element : $this->origin->origin_type;
|
||||||
$fk_origin = $this->origin->id;
|
$fk_origin = $this->origin->id;
|
||||||
if ($origintype == 'project') $fk_project = $fk_origin;
|
if ($origintype == 'project') $fk_project = $fk_origin;
|
||||||
else
|
else
|
||||||
@ -985,7 +985,7 @@ class MouvementStock extends CommonObject
|
|||||||
$origintype_array = explode('@', $origintype);
|
$origintype_array = explode('@', $origintype);
|
||||||
$classname = ucfirst($origintype_array[0]);
|
$classname = ucfirst($origintype_array[0]);
|
||||||
$modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]);
|
$modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]);
|
||||||
$result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
|
$result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$classname = ucfirst($classname);
|
$classname = ucfirst($classname);
|
||||||
|
|||||||
@ -160,7 +160,7 @@ if ($action == 'order' && isset($_POST['valid']))
|
|||||||
$desc = $productsupplier->description;
|
$desc = $productsupplier->description;
|
||||||
}
|
}
|
||||||
$line->desc = $desc;
|
$line->desc = $desc;
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
// TODO Get desc in language of thirdparty
|
// TODO Get desc in language of thirdparty
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ $sql .= ', s.fk_product';
|
|||||||
|
|
||||||
if ($usevirtualstock)
|
if ($usevirtualstock)
|
||||||
{
|
{
|
||||||
if (! empty($conf->commande->enabled)) {
|
if (!empty($conf->commande->enabled)) {
|
||||||
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
$sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||||
$sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1";
|
$sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1";
|
||||||
$sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity('commande').")";
|
$sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity('commande').")";
|
||||||
@ -372,7 +372,7 @@ if ($usevirtualstock)
|
|||||||
$sqlCommandesCli = '0';
|
$sqlCommandesCli = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->expedition->enabled)) {
|
if (!empty($conf->expedition->enabled)) {
|
||||||
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||||
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
|
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
|
||||||
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
|
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
|
||||||
@ -384,7 +384,7 @@ if ($usevirtualstock)
|
|||||||
$sqlExpeditionsCli = '0';
|
$sqlExpeditionsCli = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->fournisseur->enabled)) {
|
if (!empty($conf->fournisseur->enabled)) {
|
||||||
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||||
$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
|
$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
|
||||||
$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
|
$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
|
||||||
@ -404,7 +404,7 @@ if ($usevirtualstock)
|
|||||||
$sqlReceptionFourn = '0';
|
$sqlReceptionFourn = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->mrp->enabled)) {
|
if (!empty($conf->mrp->enabled)) {
|
||||||
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
|
||||||
$sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
|
$sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
|
||||||
$sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5";
|
$sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5";
|
||||||
|
|||||||
@ -263,8 +263,8 @@ if (empty($reshook))
|
|||||||
$object->socid = GETPOST('socid', 'int');
|
$object->socid = GETPOST('socid', 'int');
|
||||||
$object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
|
$object->description = GETPOST('description', 'none'); // Do not use 'alpha' here, we want field as it is
|
||||||
$object->public = GETPOST('public', 'alpha');
|
$object->public = GETPOST('public', 'alpha');
|
||||||
$object->date_start = (! GETPOST('projectstart')) ? '' : $date_start;
|
$object->date_start = (!GETPOST('projectstart')) ? '' : $date_start;
|
||||||
$object->date_end = (! GETPOST('projectend')) ? '' : $date_end;
|
$object->date_end = (!GETPOST('projectend')) ? '' : $date_end;
|
||||||
if (GETPOSTISSET('opp_amount')) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
|
if (GETPOSTISSET('opp_amount')) $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
|
||||||
if (GETPOSTISSET('budget_amount')) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
|
if (GETPOSTISSET('budget_amount')) $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
|
||||||
if (GETPOSTISSET('opp_status')) $object->opp_status = $opp_status;
|
if (GETPOSTISSET('opp_status')) $object->opp_status = $opp_status;
|
||||||
|
|||||||
@ -131,7 +131,7 @@ $arrayfields = array(
|
|||||||
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103),
|
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103),
|
||||||
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104),
|
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104),
|
||||||
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105),
|
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105),
|
||||||
'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>106),
|
'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>106),
|
||||||
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
|
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
|
||||||
'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115),
|
'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115),
|
||||||
'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116),
|
'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116),
|
||||||
@ -847,16 +847,16 @@ while ($i < min($num, $limit))
|
|||||||
$totalarray['val']['p.opp_amount'] += $obj->opp_amount;
|
$totalarray['val']['p.opp_amount'] += $obj->opp_amount;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.opp_amount';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount';
|
||||||
}
|
}
|
||||||
// Opp percent
|
// Opp percent
|
||||||
if (! empty($arrayfields['p.opp_percent']['checked']))
|
if (!empty($arrayfields['p.opp_percent']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%';
|
if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Opp weighted amount
|
// Opp weighted amount
|
||||||
if (!empty($arrayfields['opp_weighted_amount']['checked']))
|
if (!empty($arrayfields['opp_weighted_amount']['checked']))
|
||||||
@ -868,11 +868,11 @@ while ($i < min($num, $limit))
|
|||||||
$totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
|
$totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount';
|
||||||
}
|
}
|
||||||
// Budget
|
// Budget
|
||||||
if (! empty($arrayfields['p.budget_amount']['checked']))
|
if (!empty($arrayfields['p.budget_amount']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ($obj->budget_amount != '')
|
if ($obj->budget_amount != '')
|
||||||
@ -881,11 +881,11 @@ while ($i < min($num, $limit))
|
|||||||
$totalarray['val']['p.budget_amount'] += $obj->budget_amount;
|
$totalarray['val']['p.budget_amount'] += $obj->budget_amount;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='p.budget_amount';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount';
|
||||||
}
|
}
|
||||||
// Usage opportunity
|
// Usage opportunity
|
||||||
if (! empty($arrayfields['p.usage_opportunity']['checked']))
|
if (!empty($arrayfields['p.usage_opportunity']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if ($obj->usage_opportunity)
|
if ($obj->usage_opportunity)
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
Sorry. You are not allowed to access this resource.
|
Sorry. You are not allowed to access this resource.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
|
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
You requested a website or a page that does not exists.
|
You requested a website or a page that does not exists.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.':''; ?>
|
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class Contacts extends DolibarrApi
|
|||||||
{
|
{
|
||||||
throw new RestException(401, 'No permission to read contacts');
|
throw new RestException(401, 'No permission to read contacts');
|
||||||
}
|
}
|
||||||
if ($id ==0) {
|
if ($id == 0) {
|
||||||
$result = $this->contact->initAsSpecimen();
|
$result = $this->contact->initAsSpecimen();
|
||||||
} else {
|
} else {
|
||||||
$result = $this->contact->fetch($id);
|
$result = $this->contact->fetch($id);
|
||||||
@ -87,7 +87,7 @@ class Contacts extends DolibarrApi
|
|||||||
|
|
||||||
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
||||||
{
|
{
|
||||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($includecount)
|
if ($includecount)
|
||||||
@ -134,37 +134,37 @@ class Contacts extends DolibarrApi
|
|||||||
$search_sale = DolibarrApiAccess::$user->id;
|
$search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object = t.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||||
// We need this table joined to the select in order to filter by sale
|
// We need this table joined to the select in order to filter by sale
|
||||||
$sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
}
|
}
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON t.fk_soc = s.rowid";
|
||||||
$sql.= ' WHERE t.entity IN (' . getEntity('socpeople') . ')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('socpeople').')';
|
||||||
if ($socids) $sql.= " AND t.fk_soc IN (" . $socids . ")";
|
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0)
|
||||||
$sql.= " AND t.fk_soc = sc.fk_soc";
|
$sql .= " AND t.fk_soc = sc.fk_soc";
|
||||||
if ($search_sale > 0)
|
if ($search_sale > 0)
|
||||||
$sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
$sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale > 0)
|
if ($search_sale > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND sc.fk_user = " . $search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
}
|
}
|
||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
if ($limit)
|
if ($limit)
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ class Contacts extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -199,7 +199,7 @@ class Contacts extends DolibarrApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RestException(503, 'Error when retrieve contacts : ' . $sql);
|
throw new RestException(503, 'Error when retrieve contacts : '.$sql);
|
||||||
}
|
}
|
||||||
if (!count($obj_ret))
|
if (!count($obj_ret))
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ class Contacts extends DolibarrApi
|
|||||||
|
|
||||||
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
||||||
{
|
{
|
||||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($request_data as $field => $value)
|
foreach ($request_data as $field => $value)
|
||||||
@ -290,7 +290,7 @@ class Contacts extends DolibarrApi
|
|||||||
|
|
||||||
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
|
||||||
{
|
{
|
||||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$this->contact->oldcopy = clone $this->contact;
|
$this->contact->oldcopy = clone $this->contact;
|
||||||
return $this->contact->delete();
|
return $this->contact->delete();
|
||||||
@ -330,7 +330,7 @@ class Contacts extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!DolibarrApi::_checkAccessToResource('contact', $contact->id, 'socpeople&societe')) {
|
if (!DolibarrApi::_checkAccessToResource('contact', $contact->id, 'socpeople&societe')) {
|
||||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
@ -362,7 +362,7 @@ class Contacts extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,24 +396,24 @@ class Contacts extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function addCategory($id, $category_id)
|
public function addCategory($id, $category_id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||||
throw new RestException(401, 'Insufficient rights');
|
throw new RestException(401, 'Insufficient rights');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->contact->fetch($id);
|
$result = $this->contact->fetch($id);
|
||||||
if (! $result) {
|
if (!$result) {
|
||||||
throw new RestException(404, 'Contact not found');
|
throw new RestException(404, 'Contact not found');
|
||||||
}
|
}
|
||||||
$category = new Categorie($this->db);
|
$category = new Categorie($this->db);
|
||||||
$result = $category->fetch($category_id);
|
$result = $category->fetch($category_id);
|
||||||
if (! $result) {
|
if (!$result) {
|
||||||
throw new RestException(404, 'category not found');
|
throw new RestException(404, 'category not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
|
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
if (! DolibarrApi::_checkAccessToResource('category', $category->id)) {
|
if (!DolibarrApi::_checkAccessToResource('category', $category->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,24 +436,24 @@ class Contacts extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public function deleteCategory($id, $category_id)
|
public function deleteCategory($id, $category_id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||||
throw new RestException(401, 'Insufficient rights');
|
throw new RestException(401, 'Insufficient rights');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->contact->fetch($id);
|
$result = $this->contact->fetch($id);
|
||||||
if( ! $result ) {
|
if (!$result) {
|
||||||
throw new RestException(404, 'Contact not found');
|
throw new RestException(404, 'Contact not found');
|
||||||
}
|
}
|
||||||
$category = new Categorie($this->db);
|
$category = new Categorie($this->db);
|
||||||
$result = $category->fetch($category_id);
|
$result = $category->fetch($category_id);
|
||||||
if( ! $result ) {
|
if (!$result) {
|
||||||
throw new RestException(404, 'category not found');
|
throw new RestException(404, 'category not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
|
if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
if( ! DolibarrApi::_checkAccessToResource('category', $category->id)) {
|
if (!DolibarrApi::_checkAccessToResource('category', $category->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -236,17 +236,17 @@ if ($action == "change") // Change customer for TakePOS
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
if ($num_lines==0)
|
if ($num_lines == 0)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$invoice = new Facture($db);
|
$invoice = new Facture($db);
|
||||||
$constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
$constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||||
$invoice->socid = $conf->global->$constforthirdpartyid;
|
$invoice->socid = $conf->global->$constforthirdpartyid;
|
||||||
$invoice->date = dol_now();
|
$invoice->date = dol_now();
|
||||||
$invoice->module_source = 'takepos';
|
$invoice->module_source = 'takepos';
|
||||||
$invoice->pos_source = $_SESSION["takeposterminal"];
|
$invoice->pos_source = $_SESSION["takeposterminal"];
|
||||||
$placeid =$invoice->create($user);
|
$placeid = $invoice->create($user);
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,140 +356,140 @@ if ($search_status == '') $search_status = 1; // always display active thirdpart
|
|||||||
External user socid=x + No permission to see ALL customers => Can see only himself
|
External user socid=x + No permission to see ALL customers => Can see only himself
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$formother=new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
$companyparent=new Societe($db);
|
$companyparent = new Societe($db);
|
||||||
$formcompany=new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
$prospectstatic=new Client($db);
|
$prospectstatic = new Client($db);
|
||||||
$prospectstatic->client=2;
|
$prospectstatic->client = 2;
|
||||||
$prospectstatic->loadCacheOfProspStatus();
|
$prospectstatic->loadCacheOfProspStatus();
|
||||||
|
|
||||||
|
|
||||||
$title=$langs->trans("ListOfThirdParties");
|
$title = $langs->trans("ListOfThirdParties");
|
||||||
if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers");
|
if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title = $langs->trans("ListOfCustomers");
|
||||||
if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects");
|
if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title = $langs->trans("ListOfProspects");
|
||||||
if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers");
|
if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title = $langs->trans("ListOfSuppliers");
|
||||||
|
|
||||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||||
$tab_level = array();
|
$tab_level = array();
|
||||||
$sql = "SELECT code, label, sortorder";
|
$sql = "SELECT code, label, sortorder";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||||
$sql.= " WHERE active > 0";
|
$sql .= " WHERE active > 0";
|
||||||
$sql.= " ORDER BY sortorder";
|
$sql .= " ORDER BY sortorder";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $db->fetch_object($resql))
|
while ($obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
// Compute level text
|
// Compute level text
|
||||||
$level=$langs->trans($obj->code);
|
$level = $langs->trans($obj->code);
|
||||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
if ($level == $obj->code) $level = $langs->trans($obj->label);
|
||||||
$tab_level[$obj->code] = $level;
|
$tab_level[$obj->code] = $level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
|
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
|
||||||
$sql.= " s.entity,";
|
$sql .= " s.entity,";
|
||||||
$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
$sql .= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
||||||
$sql.= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
|
$sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
|
||||||
$sql.= " s.tms as date_update, s.datec as date_creation,";
|
$sql .= " s.tms as date_update, s.datec as date_creation,";
|
||||||
$sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,";
|
$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,";
|
||||||
$sql.= " s2.nom as name2,";
|
$sql .= " s2.nom as name2,";
|
||||||
$sql.= " typent.code as typent_code,";
|
$sql .= " typent.code as typent_code,";
|
||||||
$sql.= " staff.code as staff_code,";
|
$sql .= " staff.code as staff_code,";
|
||||||
$sql.= " country.code as country_code, country.label as country_label,";
|
$sql .= " country.code as country_code, country.label as country_label,";
|
||||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql.= " region.code_region as region_code, region.nom as region_name";
|
$sql .= " region.code_region as region_code, region.nom as region_name";
|
||||||
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
|
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||||
// We'll need these fields in order to filter by categ
|
// We'll need these fields in order to filter by categ
|
||||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||||
if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc";
|
if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters=array();
|
$parameters = array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
|
||||||
// We'll need this table joined to the select in order to filter by categ
|
// We'll need this table joined to the select in order to filter by categ
|
||||||
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
if (!empty($search_categ_cus)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||||
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
|
||||||
// We'll need this table joined to the select in order to filter by sale
|
// We'll need this table joined to the select in order to filter by sale
|
||||||
if ($search_sale == -2) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
if ($search_sale == -2) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||||
elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||||
if ($search_sale && $search_sale != -2) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
||||||
if ($search_sale == -2) $sql.= " AND sc.fk_user IS NULL";
|
if ($search_sale == -2) $sql .= " AND sc.fk_user IS NULL";
|
||||||
elseif ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale);
|
elseif ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||||
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||||
if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup);
|
if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup);
|
||||||
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||||
if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
if ($search_categ_sup == -2) $sql .= " AND cs.fk_categorie IS NULL";
|
||||||
|
|
||||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti);
|
if (strlen($search_cti)) $sql .= natural_search('s.phone', $search_cti);
|
||||||
|
|
||||||
if ($search_id > 0) $sql.= natural_search("s.rowid", $search_id, 1);
|
if ($search_id > 0) $sql .= natural_search("s.rowid", $search_id, 1);
|
||||||
if ($search_nom) $sql.= natural_search("s.nom", $search_nom);
|
if ($search_nom) $sql .= natural_search("s.nom", $search_nom);
|
||||||
if ($search_alias) $sql.= natural_search("s.name_alias", $search_alias);
|
if ($search_alias) $sql .= natural_search("s.name_alias", $search_alias);
|
||||||
if ($search_nom_only) $sql.= natural_search("s.nom", $search_nom_only);
|
if ($search_nom_only) $sql .= natural_search("s.nom", $search_nom_only);
|
||||||
if ($search_customer_code) $sql.= natural_search("s.code_client", $search_customer_code);
|
if ($search_customer_code) $sql .= natural_search("s.code_client", $search_customer_code);
|
||||||
if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur", $search_supplier_code);
|
if ($search_supplier_code) $sql .= natural_search("s.code_fournisseur", $search_supplier_code);
|
||||||
if ($search_account_customer_code) $sql.= natural_search("s.code_compta", $search_account_customer_code);
|
if ($search_account_customer_code) $sql .= natural_search("s.code_compta", $search_account_customer_code);
|
||||||
if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur", $search_account_supplier_code);
|
if ($search_account_supplier_code) $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code);
|
||||||
if ($search_town) $sql.= natural_search("s.town", $search_town);
|
if ($search_town) $sql .= natural_search("s.town", $search_town);
|
||||||
if (strlen($search_zip)) $sql.= natural_search("s.zip", $search_zip);
|
if (strlen($search_zip)) $sql .= natural_search("s.zip", $search_zip);
|
||||||
if ($search_state) $sql.= natural_search("state.nom", $search_state);
|
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||||
if ($search_region) $sql.= natural_search("region.nom", $search_region);
|
if ($search_region) $sql .= natural_search("region.nom", $search_region);
|
||||||
if ($search_country && $search_country != '-1') $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
|
if ($search_country && $search_country != '-1') $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
|
||||||
if ($search_email) $sql.= natural_search("s.email", $search_email);
|
if ($search_email) $sql .= natural_search("s.email", $search_email);
|
||||||
if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone);
|
if (strlen($search_phone)) $sql .= natural_search("s.phone", $search_phone);
|
||||||
if (strlen($search_fax)) $sql.= natural_search("s.fax", $search_fax);
|
if (strlen($search_fax)) $sql .= natural_search("s.fax", $search_fax);
|
||||||
if ($search_url) $sql.= natural_search("s.url", $search_url);
|
if ($search_url) $sql .= natural_search("s.url", $search_url);
|
||||||
if (strlen($search_idprof1)) $sql.= natural_search("s.siren", $search_idprof1);
|
if (strlen($search_idprof1)) $sql .= natural_search("s.siren", $search_idprof1);
|
||||||
if (strlen($search_idprof2)) $sql.= natural_search("s.siret", $search_idprof2);
|
if (strlen($search_idprof2)) $sql .= natural_search("s.siret", $search_idprof2);
|
||||||
if (strlen($search_idprof3)) $sql.= natural_search("s.ape", $search_idprof3);
|
if (strlen($search_idprof3)) $sql .= natural_search("s.ape", $search_idprof3);
|
||||||
if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4", $search_idprof4);
|
if (strlen($search_idprof4)) $sql .= natural_search("s.idprof4", $search_idprof4);
|
||||||
if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5", $search_idprof5);
|
if (strlen($search_idprof5)) $sql .= natural_search("s.idprof5", $search_idprof5);
|
||||||
if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6", $search_idprof6);
|
if (strlen($search_idprof6)) $sql .= natural_search("s.idprof6", $search_idprof6);
|
||||||
if (strlen($search_vat)) $sql.= natural_search("s.tva_intra", $search_vat);
|
if (strlen($search_vat)) $sql .= natural_search("s.tva_intra", $search_vat);
|
||||||
// Filter on type of thirdparty
|
// Filter on type of thirdparty
|
||||||
if ($search_type > 0 && in_array($search_type, array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
|
if ($search_type > 0 && in_array($search_type, array('1,3', '2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
|
||||||
if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AND s.fournisseur = 1";
|
if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AND s.fournisseur = 1";
|
||||||
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
|
||||||
if ($search_status!='' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2);
|
if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2);
|
||||||
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode);
|
if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode);
|
||||||
if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql.= natural_search("s.fk_typent", $search_type_thirdparty, 2);
|
if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2);
|
||||||
if (! empty($search_staff) && $search_staff != '-1') $sql.= natural_search("s.fk_effectif", $search_staff, 2);
|
if (!empty($search_staff) && $search_staff != '-1') $sql .= natural_search("s.fk_effectif", $search_staff, 2);
|
||||||
if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3);
|
if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3);
|
||||||
if ($search_parent_name) $sql.= natural_search("s2.nom", $search_parent_name);
|
if ($search_parent_name) $sql .= natural_search("s2.nom", $search_parent_name);
|
||||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm", $search_stcomm, 2);
|
if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("s.fk_stcomm", $search_stcomm, 2);
|
||||||
if ($search_import_key) $sql.= natural_search("s.import_key", $search_import_key);
|
if ($search_import_key) $sql .= natural_search("s.import_key", $search_import_key);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters = array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
@ -626,258 +626,258 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$textprofid=array();
|
$textprofid = array();
|
||||||
foreach(array(1,2,3,4,5,6) as $key)
|
foreach (array(1, 2, 3, 4, 5, 6) as $key)
|
||||||
{
|
{
|
||||||
$label=$langs->transnoentities("ProfId".$key.$mysoc->country_code);
|
$label = $langs->transnoentities("ProfId".$key.$mysoc->country_code);
|
||||||
$textprofid[$key]='';
|
$textprofid[$key] = '';
|
||||||
if ($label != "ProfId".$key.$mysoc->country_code)
|
if ($label != "ProfId".$key.$mysoc->country_code)
|
||||||
{ // Get only text between ()
|
{ // Get only text between ()
|
||||||
if (preg_match('/\((.*)\)/i', $label, $reg)) $label=$reg[1];
|
if (preg_match('/\((.*)\)/i', $label, $reg)) $label = $reg[1];
|
||||||
$textprofid[$key]=$langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label);
|
$textprofid[$key] = $langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$topicmail="Information";
|
$topicmail = "Information";
|
||||||
$modelmail="thirdparty";
|
$modelmail = "thirdparty";
|
||||||
$objecttmp=new Societe($db);
|
$objecttmp = new Societe($db);
|
||||||
$trackid='thi'.$object->id;
|
$trackid = 'thi'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($search_all)
|
if ($search_all)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter='';
|
$moreforfilter = '';
|
||||||
if (empty($type) || $type == 'c' || $type == 'p')
|
if (empty($type) || $type == 'c' || $type == 'p')
|
||||||
{
|
{
|
||||||
if (! empty($conf->categorie->enabled))
|
if (!empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
|
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
|
||||||
$moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort'));
|
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort'));
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter .= '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($type) || $type == 'f')
|
if (empty($type) || $type == 'f')
|
||||||
{
|
{
|
||||||
if (! empty($conf->categorie->enabled))
|
if (!empty($conf->categorie->enabled))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('SuppliersCategoriesShort').': ';
|
$moreforfilter .= $langs->trans('SuppliersCategoriesShort').': ';
|
||||||
$moreforfilter.=$formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1);
|
$moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1);
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter .= '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
if ($user->rights->societe->client->voir || $socid)
|
||||||
{
|
{
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
$moreforfilter .= $langs->trans('SalesRepresentatives').': ';
|
||||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300', 1);
|
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300', 1);
|
||||||
$moreforfilter.='</div>';
|
$moreforfilter .= '</div>';
|
||||||
}
|
}
|
||||||
if ($moreforfilter)
|
if ($moreforfilter)
|
||||||
{
|
{
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print $moreforfilter;
|
print $moreforfilter;
|
||||||
$parameters=array('type'=>$type);
|
$parameters = array('type'=>$type);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
if ($massactionbutton && $contextpage != 'poslist') $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
if ($massactionbutton && $contextpage != 'poslist') $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
if (empty($arrayfields['customerorsupplier']['checked'])) print '<input type="hidden" name="type" value="'.$type.'">';
|
if (empty($arrayfields['customerorsupplier']['checked'])) print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
|
|
||||||
// Fields title search
|
// Fields title search
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
if (! empty($arrayfields['s.rowid']['checked']))
|
if (!empty($arrayfields['s.rowid']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (!empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
|
if (!empty($search_nom_only) && empty($search_nom)) $search_nom = $search_nom_only;
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.name_alias']['checked']))
|
if (!empty($arrayfields['s.name_alias']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Barcode
|
// Barcode
|
||||||
if (! empty($arrayfields['s.barcode']['checked']))
|
if (!empty($arrayfields['s.barcode']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Customer code
|
// Customer code
|
||||||
if (! empty($arrayfields['s.code_client']['checked']))
|
if (!empty($arrayfields['s.code_client']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Supplier code
|
// Supplier code
|
||||||
if (! empty($arrayfields['s.code_fournisseur']['checked']))
|
if (!empty($arrayfields['s.code_fournisseur']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Account Customer code
|
// Account Customer code
|
||||||
if (! empty($arrayfields['s.code_compta']['checked']))
|
if (!empty($arrayfields['s.code_compta']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
|
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Account Supplier code
|
// Account Supplier code
|
||||||
if (! empty($arrayfields['s.code_compta_fournisseur']['checked']))
|
if (!empty($arrayfields['s.code_compta_fournisseur']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">';
|
print '<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Town
|
// Town
|
||||||
if (! empty($arrayfields['s.town']['checked']))
|
if (!empty($arrayfields['s.town']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Zip
|
// Zip
|
||||||
if (! empty($arrayfields['s.zip']['checked']))
|
if (!empty($arrayfields['s.zip']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// State
|
// State
|
||||||
if (! empty($arrayfields['state.nom']['checked']))
|
if (!empty($arrayfields['state.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Region
|
// Region
|
||||||
if (! empty($arrayfields['region.nom']['checked']))
|
if (!empty($arrayfields['region.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Country
|
// Country
|
||||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Company type
|
// Company type
|
||||||
if (! empty($arrayfields['typent.code']['checked']))
|
if (!empty($arrayfields['typent.code']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Staff
|
// Staff
|
||||||
if (! empty($arrayfields['staff.code']['checked']))
|
if (!empty($arrayfields['staff.code']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100');
|
print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.email']['checked']))
|
if (!empty($arrayfields['s.email']['checked']))
|
||||||
{
|
{
|
||||||
// Email
|
// Email
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
print '<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.phone']['checked']))
|
if (!empty($arrayfields['s.phone']['checked']))
|
||||||
{
|
{
|
||||||
// Phone
|
// Phone
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.fax']['checked']))
|
if (!empty($arrayfields['s.fax']['checked']))
|
||||||
{
|
{
|
||||||
// Fax
|
// Fax
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.url']['checked']))
|
if (!empty($arrayfields['s.url']['checked']))
|
||||||
{
|
{
|
||||||
// Url
|
// Url
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.siren']['checked']))
|
if (!empty($arrayfields['s.siren']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf1
|
// IdProf1
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.siret']['checked']))
|
if (!empty($arrayfields['s.siret']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf2
|
// IdProf2
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.ape']['checked']))
|
if (!empty($arrayfields['s.ape']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf3
|
// IdProf3
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.idprof4']['checked']))
|
if (!empty($arrayfields['s.idprof4']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf4
|
// IdProf4
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.idprof5']['checked']))
|
if (!empty($arrayfields['s.idprof5']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf5
|
// IdProf5
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.idprof6']['checked']))
|
if (!empty($arrayfields['s.idprof6']['checked']))
|
||||||
{
|
{
|
||||||
// IdProf6
|
// IdProf6
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.tva_intra']['checked']))
|
if (!empty($arrayfields['s.tva_intra']['checked']))
|
||||||
{
|
{
|
||||||
// Vat number
|
// Vat number
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
|
|||||||
@ -35,7 +35,7 @@ $langs->loadLangs(array("companies", "projects"));
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
if ($user->socid) $socid=$user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
@ -46,8 +46,8 @@ $hookmanager->initHooks(array('projectthirdparty'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array('id'=>$socid);
|
$parameters = array('id'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
|
||||||
@ -71,25 +71,25 @@ if ($socid)
|
|||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$result = $object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
|
||||||
$title=$langs->trans("Projects");
|
$title = $langs->trans("Projects");
|
||||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title;
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
|
dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border centpercent tableforfield">';
|
print '<table class="border centpercent tableforfield">';
|
||||||
|
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ if ($socid)
|
|||||||
|
|
||||||
|
|
||||||
// Projects list
|
// Projects list
|
||||||
$result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
|
$result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -265,17 +265,17 @@ print $langs->trans("SortProductField");
|
|||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach($prod->fields as $k => $v) {
|
foreach ($prod->fields as $k => $v) {
|
||||||
$array[$k]=$k;
|
$array[$k] = $k;
|
||||||
}
|
}
|
||||||
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD)?'rowid':$conf->global->TAKEPOS_SORTPRODUCTFIELD), 0);
|
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||||
$htmltext.='</i>';
|
$htmltext .= '</i>';
|
||||||
// Color theme
|
// Color theme
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("ColorTheme");
|
print $langs->trans("ColorTheme");
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||||
|
|
||||||
/* <style type="text/css" > dont remove this line it's an ide hack */
|
/* <style type="text/css" > dont remove this line it's an ide hack */
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -232,7 +232,7 @@ class Website extends CommonObject
|
|||||||
$tmplangarray = explode(',', $this->otherlang);
|
$tmplangarray = explode(',', $this->otherlang);
|
||||||
if (is_array($tmplangarray)) {
|
if (is_array($tmplangarray)) {
|
||||||
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
|
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
|
||||||
foreach($tmplangarray as $val) {
|
foreach ($tmplangarray as $val) {
|
||||||
if (trim($val) == $this->lang) continue;
|
if (trim($val) == $this->lang) continue;
|
||||||
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
|
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ class Website extends CommonObject
|
|||||||
$tmplangarray = explode(',', $this->otherlang);
|
$tmplangarray = explode(',', $this->otherlang);
|
||||||
if (is_array($tmplangarray)) {
|
if (is_array($tmplangarray)) {
|
||||||
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
|
dol_mkdir($conf->website->dir_output.'/'.$this->ref);
|
||||||
foreach($tmplangarray as $val) {
|
foreach ($tmplangarray as $val) {
|
||||||
if (trim($val) == $this->lang) continue;
|
if (trim($val) == $this->lang) continue;
|
||||||
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
|
dol_mkdir($conf->website->dir_output.'/'.$this->ref.'/'.trim($val));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,53 +40,53 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
|
||||||
$langs->loadLangs(array("admin","other","website","errors"));
|
$langs->loadLangs(array("admin", "other", "website", "errors"));
|
||||||
|
|
||||||
if (! $user->rights->website->read) accessforbidden();
|
if (!$user->rights->website->read) accessforbidden();
|
||||||
|
|
||||||
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
|
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
$websiteid=GETPOST('websiteid', 'int');
|
$websiteid = GETPOST('websiteid', 'int');
|
||||||
$websitekey=GETPOST('website', 'alpha');
|
$websitekey = GETPOST('website', 'alpha');
|
||||||
$page=GETPOST('page', 'alpha');
|
$page = GETPOST('page', 'alpha');
|
||||||
$pageid=GETPOST('pageid', 'int');
|
$pageid = GETPOST('pageid', 'int');
|
||||||
$pageref=GETPOST('pageref', 'aZ09');
|
$pageref = GETPOST('pageref', 'aZ09');
|
||||||
$action=GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm=GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$cancel=GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
|
||||||
$type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
|
$type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
|
||||||
|
|
||||||
$section_dir = GETPOST('section_dir', 'alpha');
|
$section_dir = GETPOST('section_dir', 'alpha');
|
||||||
$file_manager = GETPOST('file_manager', 'alpha');
|
$file_manager = GETPOST('file_manager', 'alpha');
|
||||||
$replacesite = GETPOST('replacesite', 'alpha');
|
$replacesite = GETPOST('replacesite', 'alpha');
|
||||||
|
|
||||||
if (GETPOST('deletesite', 'alpha')) { $action='deletesite'; }
|
if (GETPOST('deletesite', 'alpha')) { $action = 'deletesite'; }
|
||||||
if (GETPOST('delete', 'alpha')) { $action='delete'; }
|
if (GETPOST('delete', 'alpha')) { $action = 'delete'; }
|
||||||
if (GETPOST('preview', 'alpha')) $action='preview';
|
if (GETPOST('preview', 'alpha')) $action = 'preview';
|
||||||
if (GETPOST('createsite', 'alpha')) { $action='createsite'; }
|
if (GETPOST('createsite', 'alpha')) { $action = 'createsite'; }
|
||||||
if (GETPOST('createcontainer', 'alpha')) { $action='createcontainer'; }
|
if (GETPOST('createcontainer', 'alpha')) { $action = 'createcontainer'; }
|
||||||
if (GETPOST('editcss', 'alpha')) { $action='editcss'; }
|
if (GETPOST('editcss', 'alpha')) { $action = 'editcss'; }
|
||||||
if (GETPOST('editmenu', 'alpha')) { $action='editmenu'; }
|
if (GETPOST('editmenu', 'alpha')) { $action = 'editmenu'; }
|
||||||
if (GETPOST('setashome', 'alpha')) { $action='setashome'; }
|
if (GETPOST('setashome', 'alpha')) { $action = 'setashome'; }
|
||||||
if (GETPOST('editmeta', 'alpha')) { $action='editmeta'; }
|
if (GETPOST('editmeta', 'alpha')) { $action = 'editmeta'; }
|
||||||
if (GETPOST('editsource', 'alpha')) { $action='editsource'; }
|
if (GETPOST('editsource', 'alpha')) { $action = 'editsource'; }
|
||||||
if (GETPOST('editcontent', 'alpha')) { $action='editcontent'; }
|
if (GETPOST('editcontent', 'alpha')) { $action = 'editcontent'; }
|
||||||
if (GETPOST('exportsite', 'alpha')) { $action='exportsite'; }
|
if (GETPOST('exportsite', 'alpha')) { $action = 'exportsite'; }
|
||||||
if (GETPOST('importsite', 'alpha')) { $action='importsite'; }
|
if (GETPOST('importsite', 'alpha')) { $action = 'importsite'; }
|
||||||
if (GETPOST('createfromclone', 'alpha')) { $action='createfromclone'; }
|
if (GETPOST('createfromclone', 'alpha')) { $action = 'createfromclone'; }
|
||||||
if (GETPOST('createpagefromclone', 'alpha')) { $action='createpagefromclone'; }
|
if (GETPOST('createpagefromclone', 'alpha')) { $action = 'createpagefromclone'; }
|
||||||
if (empty($action) && $file_manager) $action='file_manager';
|
if (empty($action) && $file_manager) $action = 'file_manager';
|
||||||
if (empty($action) && $replacesite) $action='replacesite';
|
if (empty($action) && $replacesite) $action = 'replacesite';
|
||||||
|
|
||||||
if (GETPOST('refreshsite') || GETPOST('refreshsite_x') || GETPOST('refreshsite.x')) $pageid = 0;
|
if (GETPOST('refreshsite') || GETPOST('refreshsite_x') || GETPOST('refreshsite.x')) $pageid = 0;
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
@ -279,20 +279,20 @@ if (GETPOST('refreshsite', 'alpha') || GETPOST('refreshsite.x', 'alpha') || GETP
|
|||||||
$pageid = $object->fk_default_home;
|
$pageid = $object->fk_default_home;
|
||||||
if (empty($pageid))
|
if (empty($pageid))
|
||||||
{
|
{
|
||||||
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
|
$array = $objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
|
||||||
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
||||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
$atleastonepage = (is_array($array) && count($array) > 0);
|
||||||
|
|
||||||
$firstpageid=0; $homepageid=0;
|
$firstpageid = 0; $homepageid = 0;
|
||||||
foreach($array as $key => $valpage)
|
foreach ($array as $key => $valpage)
|
||||||
{
|
{
|
||||||
if (empty($firstpageid)) $firstpageid=$valpage->id;
|
if (empty($firstpageid)) $firstpageid = $valpage->id;
|
||||||
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
|
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid = $valpage->id;
|
||||||
}
|
}
|
||||||
$pageid=($homepageid?$homepageid:$firstpageid); // We choose home page and if not defined yet, we take first page
|
$pageid = ($homepageid ? $homepageid : $firstpageid); // We choose home page and if not defined yet, we take first page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GETPOST('refreshpage', 'alpha') && ! in_array($action, array('updatecss'))) $action='preview';
|
if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview';
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
@ -2033,8 +2033,8 @@ if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource')
|
|||||||
|
|
||||||
if (!GETPOST('hide_websitemenu'))
|
if (!GETPOST('hide_websitemenu'))
|
||||||
{
|
{
|
||||||
$disabled='';
|
$disabled = '';
|
||||||
if (empty($user->rights->website->write)) $disabled=' disabled="disabled"';
|
if (empty($user->rights->website->write)) $disabled = ' disabled="disabled"';
|
||||||
|
|
||||||
//var_dump($objectpage);exit;
|
//var_dump($objectpage);exit;
|
||||||
print '<div class="centpercent websitebar">';
|
print '<div class="centpercent websitebar">';
|
||||||
@ -2078,19 +2078,19 @@ if (!GETPOST('hide_websitemenu'))
|
|||||||
|
|
||||||
if ($websitekey)
|
if ($websitekey)
|
||||||
{
|
{
|
||||||
$virtualurl='';
|
$virtualurl = '';
|
||||||
$dataroot=DOL_DATA_ROOT.'/website/'.$websitekey;
|
$dataroot = DOL_DATA_ROOT.'/website/'.$websitekey;
|
||||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
if (!empty($object->virtualhost)) $virtualurl = $object->virtualhost;
|
||||||
}
|
}
|
||||||
|
|
||||||
$array=array();
|
$array = array();
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
|
$array = $objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
|
||||||
$object->lines = $array;
|
$object->lines = $array;
|
||||||
}
|
}
|
||||||
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
||||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
$atleastonepage = (is_array($array) && count($array) > 0);
|
||||||
|
|
||||||
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
|
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
|
||||||
{
|
{
|
||||||
@ -2709,7 +2709,7 @@ if ($action == 'editcss')
|
|||||||
|
|
||||||
// Other languages
|
// Other languages
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
$htmltext= '';
|
$htmltext = '';
|
||||||
print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_OTHERLANG');
|
print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_OTHERLANG');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat" value="'.(GETPOSTISSET('WEBSITE_OTHERLANG') ? GETPOST('WEBSITE_OTHERLANG', 'alpha') : $object->otherlang).'" name="WEBSITE_OTHERLANG">';
|
print '<input type="text" class="flat" value="'.(GETPOSTISSET('WEBSITE_OTHERLANG') ? GETPOST('WEBSITE_OTHERLANG', 'alpha') : $object->otherlang).'" name="WEBSITE_OTHERLANG">';
|
||||||
@ -3103,7 +3103,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
|||||||
else $onlykeys[$langs->defaultlang] = $langs->defaultlang;
|
else $onlykeys[$langs->defaultlang] = $langs->defaultlang;
|
||||||
if ($object->otherlang) {
|
if ($object->otherlang) {
|
||||||
$tmparray = explode(',', $object->otherlang);
|
$tmparray = explode(',', $object->otherlang);
|
||||||
foreach($tmparray as $key) {
|
foreach ($tmparray as $key) {
|
||||||
$tmpkey = trim($key);
|
$tmpkey = trim($key);
|
||||||
if (strlen($key) == 2) {
|
if (strlen($key) == 2) {
|
||||||
$tmpkey = strtolower($key);
|
$tmpkey = strtolower($key);
|
||||||
@ -3476,7 +3476,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm')
|
|||||||
'website_readme'=>'WEBSITE_README',
|
'website_readme'=>'WEBSITE_README',
|
||||||
'website_manifestjson'=>'WEBSITE_MANIFEST_JSON'
|
'website_manifestjson'=>'WEBSITE_MANIFEST_JSON'
|
||||||
);
|
);
|
||||||
if (! empty($translateofrecordtype[$answerrecord['type']])) {
|
if (!empty($translateofrecordtype[$answerrecord['type']])) {
|
||||||
print $langs->trans($translateofrecordtype[$answerrecord['type']]);
|
print $langs->trans($translateofrecordtype[$answerrecord['type']]);
|
||||||
} else {
|
} else {
|
||||||
print $answerrecord['type'];
|
print $answerrecord['type'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user