Merge branch 'develop' of github.com:Dolibarr/dolibarr into new_creditnote
@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.hrm]
|
||||
file_filter = htdocs/langs/<lang>/hrm.lang
|
||||
source_file = htdocs/langs/en_US/hrm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.incoterm]
|
||||
file_filter = htdocs/langs/<lang>/incoterm.lang
|
||||
source_file = htdocs/langs/en_US/incoterm.lang
|
||||
|
||||
@ -19,6 +19,14 @@ Following changes may create regression for some external modules, but were nece
|
||||
Dolibarr better:
|
||||
- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead.
|
||||
- Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination.
|
||||
- A lot hooks used into PDF generation were not correctly implemented. We had to fix this. The result si that
|
||||
the following hook were set as hook of type "replace". This means if your module implement such hooks, it must
|
||||
return 0 to execute standard code or 1 to replace standard code (value to output should be set into resPrints instead).
|
||||
This is list of hooks modified:
|
||||
'pdf_getlinenum', 'pdf_getlineref', 'pdf_getlineref_supplier', 'pdf_getlinevatrate', 'pdf_getlineupexcltax',
|
||||
'pdf_getlineupwithtax', 'pdf_getlineqty', 'pdf_getlineqty_asked', 'pdf_getlineqty_shipped', 'pdf_getlineqty_keeptoship',
|
||||
'pdf_getlineunit', 'pdf_getlineremisepercent', 'pdf_getlineprogress', 'pdf_getlinetotalexcltax', 'pdf_getlinetotalwithtax'
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.8.1 compared to 3.8.0 *****
|
||||
|
||||
@ -1575,7 +1575,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$picto='user';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
|
||||
return $result;
|
||||
|
||||
@ -37,6 +37,7 @@ $langs->load("companies");
|
||||
$langs->load("products");
|
||||
$langs->load("members");
|
||||
$langs->load("projects");
|
||||
$langs->load("hrm");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
@ -46,10 +47,10 @@ $action = GETPOST('action');
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||
|
||||
// List of supported permanent search area
|
||||
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT");
|
||||
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT);
|
||||
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"));
|
||||
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
|
||||
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE");
|
||||
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE);
|
||||
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Employees"));
|
||||
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module4000Name');
|
||||
|
||||
|
||||
if ($action == 'update')
|
||||
@ -57,6 +58,7 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_SHORTLISTE_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
|
||||
@ -82,6 +84,7 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SEARCHFORM_EMPLOYEE", $_POST["MAIN_SEARCHFORM_EMPLOYEE"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
|
||||
@ -204,6 +207,12 @@ if ($action == 'edit') // Edit
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max size of short lists on customer card
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortListCustomerCard").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '"></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Disable javascript and ajax
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableJavascript").'</td><td>';
|
||||
@ -385,6 +394,11 @@ else // Show
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortListCustomerCard").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
// Disable javascript/ajax
|
||||
$var=!$var;
|
||||
|
||||
@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
|
||||
if (! isValidEmail($email))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorBadEMail",$email),'errors');
|
||||
setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,11 +118,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($mailmanspip->error,'errors');
|
||||
setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("MailmanCreationSuccess"));
|
||||
setEventMessages($langs->trans("MailmanCreationSuccess"), null);
|
||||
}
|
||||
}
|
||||
if ($action == 'testunsubscribe')
|
||||
@ -131,11 +131,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($mailmanspip->error,'errors');
|
||||
setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("MailmanDeletionSuccess"));
|
||||
setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,12 +156,15 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
|
||||
|
||||
$head = mailmanspip_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$var=true;
|
||||
|
||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
@ -200,21 +203,30 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
});
|
||||
</script>';
|
||||
|
||||
form_constantes($constantes,1);
|
||||
|
||||
form_constantes($constantes,2);
|
||||
|
||||
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
|
||||
//$link.=img_$langs->trans("Activate")
|
||||
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$link.='</a>';
|
||||
print load_fiche_titre($langs->trans('MailmanTitle'), $link,'');
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
|
||||
{
|
||||
|
||||
@ -54,28 +54,30 @@ if ($action == 'update' || $action == 'add')
|
||||
$constname=GETPOST("constname");
|
||||
$constvalue=GETPOST("constvalue");
|
||||
|
||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
|
||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constvalue) $constvalue=0;
|
||||
else $constvalue=1;
|
||||
}
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
foreach($_POST['constname'] as $key => $val)
|
||||
{
|
||||
$constname=$_POST["constname"][$key];
|
||||
$constvalue=$_POST["constvalue"][$key];
|
||||
$consttype=$_POST["consttype"][$key];
|
||||
$constnote=$_POST["constnote"][$key];
|
||||
|
||||
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
|
||||
$consttype=$_POST["consttype"];
|
||||
$constnote=GETPOST("constnote");
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adherent
|
||||
@ -115,7 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
|
||||
|
||||
$head = mailmanspip_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$var=true;
|
||||
|
||||
@ -124,6 +125,10 @@ $var=true;
|
||||
*/
|
||||
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
@ -139,21 +144,28 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
|
||||
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
print '<br>';
|
||||
form_constantes($constantes);
|
||||
print '<br>';
|
||||
|
||||
form_constantes($constantes,2);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Activate");
|
||||
$link.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$link.='</a>';
|
||||
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -184,7 +184,7 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if ($mode == 'search')
|
||||
{
|
||||
if ($modesearch == 'soc')
|
||||
@ -209,7 +209,7 @@ if ($mode == 'search')
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
@ -226,7 +226,7 @@ if ($id > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Alias name (commercial, trademark or alias name)
|
||||
print '<tr><td class="titelfield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
|
||||
print '<tr><td class="titelfield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
|
||||
print $object->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
@ -376,17 +376,6 @@ if ($id > 0)
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
|
||||
// display amount and link to unpaid bill
|
||||
$outstandingBills = $object->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
if ($object->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandingBills > $object->outstanding_limit)
|
||||
print img_warning($langs->trans("OutstandingBillReached"));
|
||||
//print ' / ' . price($soc->outstanding_limit);
|
||||
}
|
||||
print ')';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -491,14 +480,24 @@ if ($id > 0)
|
||||
|
||||
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=4;
|
||||
$tableaushown=1;
|
||||
$MAXLIST=$conf->global->MAIN_SIZE_SHORTLISTE_LIMIT;
|
||||
|
||||
// Lien recap
|
||||
$outstandingBills = $object->get_OutstandingBill();
|
||||
$warn = '';
|
||||
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingBills)
|
||||
{
|
||||
$warn = img_warning($langs->trans("OutstandingBillReached"));
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id.'">'.$langs->trans("ShowCustomerPreview").'</a></td></tr></table></td>';
|
||||
print '<td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id.'">'.$langs->trans("ShowCustomerPreview").'</a></td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans("CurrentOutstandingBill").'</td>';
|
||||
print '<td align="right">'.price($outstandingBills).$warn.'</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@ -684,7 +683,6 @@ if ($id > 0)
|
||||
if ($num > 0) {
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$tableaushown=1;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
@ -868,7 +866,6 @@ if ($id > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$tableaushown=1;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
@ -1024,6 +1021,7 @@ if ($id > 0)
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,348 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is freei software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/list.php
|
||||
* \ingroup commercial societe
|
||||
* \brief List of customers
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("customers");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("commercial");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,'societe',$socid,'');
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page=GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
|
||||
$search_company = GETPOST("search_company");
|
||||
$search_zipcode = GETPOST("search_zipcode");
|
||||
$search_town = GETPOST("search_town");
|
||||
$search_code = GETPOST("search_code");
|
||||
$search_compta = GETPOST("search_compta");
|
||||
$search_status = GETPOST("search_status",'int');
|
||||
$search_country = GETPOST("search_country",'int');
|
||||
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
// Load sale and categ filters
|
||||
$search_sale = GETPOST("search_sale",'int');
|
||||
$search_categ = GETPOST("search_categ",'int');
|
||||
$catid = GETPOST("catid",'int');
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('customerlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_sale="";
|
||||
$search_categ="";
|
||||
$catid="";
|
||||
$search_company="";
|
||||
$search_zipcode="";
|
||||
$search_town="";
|
||||
$search_code='';
|
||||
$search_compta='';
|
||||
$search_status='';
|
||||
$search_country="";
|
||||
$search_type_thirdparty='';
|
||||
}
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
||||
|
||||
/*
|
||||
* view
|
||||
*/
|
||||
|
||||
$formother=new FormOther($db);
|
||||
$form = new Form($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
|
||||
$sql.= " s.datec, s.canvas";
|
||||
$sql.= ",s.fk_pays";
|
||||
$sql.= ",typent.code as typent_code";
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
$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) ";
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.client IN (1, 3)";
|
||||
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company);
|
||||
if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode);
|
||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
|
||||
if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta);
|
||||
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale;
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('comm/list.php:', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$param = "&search_company=".htmlspecialchars($search_company);
|
||||
$param.="&search_code=".htmlspecialchars($search_code);
|
||||
$param.="&search_zipcode=".htmlspecialchars($search_zipcode);
|
||||
$param.="&search_town=".htmlspecialchars($search_town);
|
||||
if ($search_categ != '') $param.='&search_categ='.htmlspecialchars($search_categ);
|
||||
if ($search_sale > 0) $param.='&search_sale='.htmlspecialchars($search_sale);
|
||||
if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status);
|
||||
if ($search_country != '') $param.='&search_country='.htmlspecialchars($search_country);
|
||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.htmlspecialchars($search_type_thirdparty);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if (! empty($conf->categorie->enabled))
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_zipcode" value="'.$search_zipcode.'" size="10">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_town" value="'.$search_town.'" size="10">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_code" value="'.$search_code.'" size="10">';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_compta" value="'.$search_compta.'" size="10">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$thirdpartystatic->id=$obj->rowid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=$obj->client;
|
||||
$thirdpartystatic->code_client=$obj->code_client;
|
||||
$thirdpartystatic->canvas=$obj->canvas;
|
||||
$thirdpartystatic->status=$obj->status;
|
||||
$thirdpartystatic->name_alias=$obj->name_alias;
|
||||
print $thirdpartystatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.$obj->zip.'</td>';
|
||||
print '<td>'.$obj->town.'</td>';
|
||||
//Country
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
//Type ent
|
||||
print '<td align="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
print '<td>'.$obj->code_client.'</td>';
|
||||
print '<td>'.$obj->code_compta.'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
|
||||
$parameters=array('obj' => $obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -2181,7 +2181,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
|
||||
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES))
|
||||
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled&socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
||||
}
|
||||
|
||||
@ -1,613 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/prospect/list.php
|
||||
* \ingroup prospect
|
||||
* \brief Page to list prospects
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("propal");
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe',$socid,'');
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$socname = GETPOST("socname",'alpha');
|
||||
$stcomm = GETPOST("stcomm",'alpha'); // code
|
||||
$search_stcomm = GETPOST("search_stcomm",'int');
|
||||
$search_nom = GETPOST("search_nom");
|
||||
$search_zipcode = GETPOST("search_zipcode");
|
||||
$search_town = GETPOST("search_town");
|
||||
$search_state = GETPOST("search_state");
|
||||
$search_datec = GETPOST("search_datec");
|
||||
$search_categ = GETPOST("search_categ",'int');
|
||||
$search_status = GETPOST("search_status",'int');
|
||||
$catid = GETPOST("catid",'int');
|
||||
$search_country = GETPOST("search_country",'int');
|
||||
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
|
||||
$search_level_from = GETPOST("search_level_from","alpha");
|
||||
$search_level_to = GETPOST("search_level_to","alpha");
|
||||
|
||||
// If both parameters are set, search for everything BETWEEN them
|
||||
if ($search_level_from != '' && $search_level_to != '')
|
||||
{
|
||||
// Ensure that these parameters are numbers
|
||||
$search_level_from = (int) $search_level_from;
|
||||
$search_level_to = (int) $search_level_to;
|
||||
|
||||
// If from is greater than to, reverse orders
|
||||
if ($search_level_from > $search_level_to)
|
||||
{
|
||||
$tmp = $search_level_to;
|
||||
$search_level_to = $search_level_from;
|
||||
$search_level_from = $tmp;
|
||||
}
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range';
|
||||
}
|
||||
// If only "from" parameter is set, search for everything GREATER THAN it
|
||||
else if ($search_level_from != '')
|
||||
{
|
||||
// Ensure that this parameter is a number
|
||||
$search_level_from = (int) $search_level_from;
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range';
|
||||
}
|
||||
// If only "to" parameter is set, search for everything LOWER THAN it
|
||||
else if ($search_level_to != '')
|
||||
{
|
||||
// Ensure that this parameter is a number
|
||||
$search_level_to = (int) $search_level_to;
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range';
|
||||
}
|
||||
// If no parameters are set, dont search for anything
|
||||
else
|
||||
{
|
||||
$sortwhere = '0 as is_in_range';
|
||||
}
|
||||
|
||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||
dol_syslog('prospects::prospects_prospect_level',LOG_DEBUG);
|
||||
$sql = "SELECT code, label, sortorder, ".$sortwhere;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql.= " WHERE active > 0";
|
||||
$sql.= " ORDER BY sortorder";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$tab_level = array();
|
||||
$search_levels = array();
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
// Compute level text
|
||||
$level=$langs->trans($obj->code);
|
||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||
|
||||
// Put it in the array sorted by sortorder
|
||||
$tab_level[$obj->sortorder] = $level;
|
||||
|
||||
// If this potentiel fit in parameters, add its code to the $search_levels array
|
||||
if ($obj->is_in_range == 1)
|
||||
{
|
||||
$search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
|
||||
// If no paramters was set, $search_levels will be empty
|
||||
$search_levels = implode(',', $search_levels);
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
// Load sale and categ filters
|
||||
$search_sale = GETPOST('search_sale','int');
|
||||
$search_categ = GETPOST('search_categ','int');
|
||||
// If the internal user must only see his prospect, force searching by him
|
||||
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
|
||||
|
||||
// List of available states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
|
||||
$sts = array(-1,0,1,2,3);
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='prospectlist';
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$socname="";
|
||||
$stcomm="";
|
||||
$search_stcomm="";
|
||||
$search_nom="";
|
||||
$search_zipcode="";
|
||||
$search_town="";
|
||||
$search_state="";
|
||||
$search_datec="";
|
||||
$search_categ="";
|
||||
$search_status="";
|
||||
$search_country="";
|
||||
$search_type_thirdparty="";
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display active customer first
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'setstcomm')
|
||||
{
|
||||
$object = new Client($db);
|
||||
$result=$object->fetch($socid);
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
|
||||
$action=''; $socid=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$formother=new FormOther($db);
|
||||
$form=new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$prospectstatic=new Client($db);
|
||||
$prospectstatic->client=2;
|
||||
$prospectstatic->loadCacheOfProspStatus();
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
|
||||
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
|
||||
$sql.= " st.libelle as stcomm_label,";
|
||||
$sql.= " d.nom as departement";
|
||||
$sql.= " ,s.fk_pays";
|
||||
$sql.= " ,typent.code as typent_code";
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
// Add fields for extrafields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
|
||||
$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) ";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.client IN (2, 3)";
|
||||
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
|
||||
if ($socid) $sql.= " AND s.rowid = " .$socid;
|
||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
||||
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom);
|
||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_state) $sql .= natural_search('d.nom', $search_state);
|
||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
||||
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
|
||||
// Insert levels filters
|
||||
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num == 1 && $socname)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
header("Location: card.php?socid=".$obj->socid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
}
|
||||
|
||||
$param='&search_stcomm='.$search_stcomm;
|
||||
$param.='&search_nom='.urlencode($search_nom);
|
||||
$param.='&search_zipcode='.urlencode($search_zipcode);
|
||||
$param.='&search_town='.urlencode($search_town);
|
||||
// Store the status filter in the URL
|
||||
if (isSet($search_setstcomm))
|
||||
{
|
||||
foreach ($search_setstcomm as $key => $value)
|
||||
{
|
||||
if ($value == 'true')
|
||||
$param.='&search_setstcomm['.((int) $key).']=true';
|
||||
else
|
||||
$param.='&search_setstcomm['.((int) $key).']=false';
|
||||
}
|
||||
}
|
||||
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
||||
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
||||
if ($search_categ != '') $param.='&search_categ='.urlencode($search_categ);
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
if ($search_country != '') $param.='&search_country='.$search_country;
|
||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.$search_type_thirdparty;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
|
||||
|
||||
|
||||
// Print the search-by-sale and search-by-categ filters
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if (! empty($conf->categorie->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"s.fk_departement","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
|
||||
// Extrafields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||
{
|
||||
foreach($extrafields->attribute_list as $key => $val)
|
||||
{
|
||||
if ($val)
|
||||
{
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_nom" size="10" value="'.$search_nom.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_zipcode" size="6" value="'.$search_zipcode.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_town" size="8" value="'.$search_town.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input type="text" class="flat" name="search_state" size="8" value="'.$search_state.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
print '<td align="center" class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="6" name="search_datec" value="'.$search_datec.'">';
|
||||
print '</td>';
|
||||
|
||||
// Prospect level
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted
|
||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||
{
|
||||
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
|
||||
$options_from .= $langs->trans($tab_level_label);
|
||||
$options_from .= '</option>';
|
||||
}
|
||||
array_reverse($tab_level, true); // Reverse the list
|
||||
$options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order
|
||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||
{
|
||||
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
|
||||
$options_to .= $langs->trans($tab_level_label);
|
||||
$options_to .= '</option>';
|
||||
}
|
||||
|
||||
// Print these two select
|
||||
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
|
||||
print ' ';
|
||||
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Prospect status
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arraystcomm=array();
|
||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$arraystcomm[$val['id']]=$val['label'];
|
||||
}
|
||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Extrafields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||
{
|
||||
foreach($extrafields->attribute_list as $key => $val)
|
||||
{
|
||||
if ($val)
|
||||
{
|
||||
$crit=$search_array_options['search_options_'.$key];
|
||||
print '<td class="liste_titre">';
|
||||
print $extrafields->showInputField($key, $crit, '', '', 'search_', 4);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
|
||||
// Print the search button
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
$var=true;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
$prospectstatic->id=$obj->socid;
|
||||
$prospectstatic->name=$obj->name;
|
||||
$prospectstatic->status=$obj->status;
|
||||
$prospectstatic->code_client=$obj->code_client;
|
||||
$prospectstatic->client=$obj->client;
|
||||
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
||||
$prospectstatic->name_alias=$obj->name_alias;
|
||||
print $prospectstatic->getNomUrl(1,'prospect');
|
||||
print '</td>';
|
||||
print "<td>".$obj->zip."</td>";
|
||||
print "<td>".$obj->town."</td>";
|
||||
print '<td align="center">'.$obj->departement.'</td>';
|
||||
//Country
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
//Type ent
|
||||
print '<td align="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
// Creation date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datec)).'</td>';
|
||||
// Level
|
||||
print '<td align="center">';
|
||||
print $prospectstatic->getLibProspLevel();
|
||||
print "</td>";
|
||||
// Statut
|
||||
print '<td align="center" class="nowrap">';
|
||||
print $prospectstatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
|
||||
print "</td>";
|
||||
|
||||
print '<td align="center" class="nowrap">';
|
||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt='default';
|
||||
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
|
||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$obj->socid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Extrafields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||
{
|
||||
foreach($extrafields->attribute_list as $key => $val)
|
||||
{
|
||||
if ($val)
|
||||
{
|
||||
print '<td>';
|
||||
$paramkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$paramkey);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('obj' => $obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<td align="right">';
|
||||
print $prospectstatic->LibStatut($prospectstatic->status,5);
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($sep > 0) print ' '; // If we had at least one line in future
|
||||
else print $langs->trans("CurrentBalance");
|
||||
print ' '.$object->currency_code.'</td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total).'</b></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
@ -961,9 +961,9 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($sep > 0) print ' '; // If we had at least one line in future
|
||||
else print $langs->trans("Total");
|
||||
print ' '.$object->currency_code.'</td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_deb*-1, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_cred, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_cred-($total_deb*-1), 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_deb*-1).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_cred).'</b></td>';
|
||||
print '<td align="right" class="nowrap"><b>'.price($total_cred-($total_deb*-1)).'</b></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1283,7 +1283,8 @@ if (empty($reshook))
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
// Replaces $fk_unit with the product's
|
||||
if (! empty($idprod)) {
|
||||
if (! empty($idprod))
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
|
||||
@ -1304,8 +1305,11 @@ if (empty($reshook))
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -1318,26 +1322,30 @@ if (empty($reshook))
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
if (count($prodcustprice->lines) > 0) {
|
||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price)
|
||||
if (! empty($price_ht)) {
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price)
|
||||
if (! empty($price_ht))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx) {
|
||||
if ($price_base_type != 'HT') {
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
@ -1870,7 +1878,7 @@ if ($action == 'create')
|
||||
$objectsrc->fetch_lines();
|
||||
$objectsrc->fetch_thirdparty();
|
||||
|
||||
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
|
||||
|
||||
@ -2250,9 +2258,6 @@ if ($action == 'create')
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
|
||||
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
|
||||
@ -281,7 +281,7 @@ if ($resql)
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_status > 0) $param.='&search_status='.$search_status;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png');
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -417,6 +417,7 @@ $search_societe = GETPOST("search_societe");
|
||||
$search_paymentmode = GETPOST("search_paymentmode");
|
||||
$search_montant_ht = GETPOST("search_montant_ht");
|
||||
$search_montant_ttc = GETPOST("search_montant_ttc");
|
||||
$search_status = GETPOST("search_status");
|
||||
$late = GETPOST("late");
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
@ -428,6 +429,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_paymentmode='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_ttc='';
|
||||
$search_status='';
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -483,6 +485,7 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
|
||||
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
|
||||
if ($search_status) $sql .= " AND f.fk_statut = ".$search_status;
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0)
|
||||
@ -528,6 +531,7 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_status) $param.='&search_status='.urlencode($search_status);
|
||||
if ($late) $param.='&late='.urlencode($late);
|
||||
if ($mode) $param.='&mode='.urlencode($mode);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
@ -43,6 +44,7 @@ if ($user->societe_id > 0)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader();
|
||||
@ -58,28 +60,7 @@ if ($socid > 0)
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print "<table width=\"100%\">\n";
|
||||
print '<tr><td valign="top" width="50%">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->name.'</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($societe->prefix_comm?$societe->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</td></tr></table>\n";
|
||||
|
||||
print '</div>';
|
||||
dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
@ -87,6 +68,18 @@ if ($socid > 0)
|
||||
print load_fiche_titre($langs->trans("CustomerPreview"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Element").'</td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Author").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$TData = array();
|
||||
$TDataSort = array();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
|
||||
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
@ -95,7 +88,7 @@ if ($socid > 0)
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_user_valid = u.rowid";
|
||||
$sql.= " ORDER BY f.datef DESC";
|
||||
$sql.= " ORDER BY f.datef ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -103,23 +96,6 @@ if ($socid > 0)
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
if (! $num > 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
|
||||
$solde = 0;
|
||||
|
||||
// Boucle sur chaque facture
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
@ -133,29 +109,18 @@ if ($socid > 0)
|
||||
continue;
|
||||
}
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($fac->date,'day')."</td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id.'">'.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
|
||||
|
||||
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
|
||||
print '<td align="right">'.price($fac->total_ttc)."</td>\n";
|
||||
if (($fac->statut == Facture::STATUS_ABANDONED ) || ($fac->statut == Facture::STATUS_CLOSED && ! $fact->close_code) ) $solde = $solde = $solde + $totalpaye;
|
||||
else $solde = $solde + $fac->total_ttc;
|
||||
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Author
|
||||
|
||||
$userstatic->id=$objf->userid;
|
||||
$userstatic->login=$objf->login;
|
||||
print '<td class="nowrap" align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$TData[] = array(
|
||||
'date' => $fac->date,
|
||||
'link' => $fac->getNomUrl(1),
|
||||
'status' => $fac->getLibStatut(2,$totalpaye),
|
||||
'amount' => $fac->total_ttc,
|
||||
'author' => $userstatic->getLoginUrl(1)
|
||||
);
|
||||
$TDataSort[] = $fac->date;
|
||||
|
||||
// Paiements
|
||||
$sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
|
||||
@ -166,6 +131,7 @@ if ($socid > 0)
|
||||
$sql.= " WHERE pf.fk_paiement = p.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND pf.fk_facture = ".$fac->id;
|
||||
$sql.= " ORDER BY p.datep ASC";
|
||||
|
||||
$resqlp = $db->query($sql);
|
||||
if ($resqlp)
|
||||
@ -176,26 +142,21 @@ if ($socid > 0)
|
||||
while ($j < $nump)
|
||||
{
|
||||
$objp = $db->fetch_object($resqlp);
|
||||
//$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
print '<td>';
|
||||
print ' '; // Decalage
|
||||
print '<a href="paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "<td> </td>\n";
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
$solde = $solde - $objp->amount;
|
||||
print '<td align="right">'.price($solde)."</td>\n";
|
||||
|
||||
// Author
|
||||
|
||||
$paymentstatic = new Paiement($db);
|
||||
$paymentstatic->id = $objp->rowid;
|
||||
|
||||
$userstatic->id=$objp->userid;
|
||||
$userstatic->login=$objp->login;
|
||||
print '<td class="nowrap" align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$TData[] = array(
|
||||
'date' => $db->jdate($objp->dp),
|
||||
'link' => $langs->trans("Payment") .' '. $paymentstatic->getNomUrl(1),
|
||||
'status' => '',
|
||||
'amount' => -$objp->amount,
|
||||
'author' => $userstatic->getLoginUrl(1)
|
||||
);
|
||||
$TDataSort[] = $db->jdate($objp->dp);
|
||||
|
||||
$j++;
|
||||
}
|
||||
@ -212,9 +173,63 @@ if ($socid > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if(empty($TData)) {
|
||||
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
} else {
|
||||
|
||||
// Sort array by date
|
||||
asort($TDataSort);
|
||||
array_multisort($TData,$TDataSort);
|
||||
|
||||
// Balance calculation
|
||||
foreach($TData as &$data1) {
|
||||
$balance += $data1['amount'];
|
||||
$data1['balance'] += $balance;
|
||||
}
|
||||
|
||||
// Reverse array to have last elements on top
|
||||
$TData = array_reverse($TData);
|
||||
|
||||
$totalDebit = 0;
|
||||
$totalCredit = 0;
|
||||
|
||||
// Display array
|
||||
foreach($TData as $data) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($data['date'],'day')."</td>\n";
|
||||
print '<td>'.$data['link']."</td>\n";
|
||||
|
||||
print '<td aling="left">'.$data['status'].'</td>';
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
|
||||
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
|
||||
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
|
||||
print '<td align="right">'.price($data['balance'])."</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td class="nowrap" align="right">';
|
||||
print $data['author'];
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="3"> </td>';
|
||||
print '<td align="right">'.price($totalDebit).'</td>';
|
||||
print '<td align="right">'.price($totalCredit).'</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -908,7 +908,7 @@ class Contact extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||
@ -923,7 +923,14 @@ class Contact extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.= ' class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($option == 'xxx')
|
||||
|
||||
@ -246,7 +246,7 @@ if ($resql)
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
@ -292,9 +292,10 @@ if ($resql)
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->lastname=$val['lastname'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '<div class="float">'.$userstatic->getNomUrl(1);
|
||||
$j++;
|
||||
if ($j < $nbofsalesrepresentative) print '<br/>';
|
||||
if ($j < $nbofsalesrepresentative) print ', ';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else print $langs->trans("NoSalesRepresentativeAffected");
|
||||
|
||||
@ -63,8 +63,9 @@ class box_contacts extends ModeleBoxes
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
|
||||
$sql.= ", s.nom as socname";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
|
||||
$sql.= ", s.nom as socname, s.name_alias";
|
||||
$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -93,10 +94,21 @@ class box_contacts extends ModeleBoxes
|
||||
$contactstatic->firstname=$objp->firstname;
|
||||
$contactstatic->civility_id=$objp->civility_id;
|
||||
$contactstatic->statut=$objp->status;
|
||||
$societestatic->id = $objp->fk_soc;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$contactstatic->phone_pro = $objp->phone;
|
||||
$contactstatic->phone_perso = $objp->phone_perso;
|
||||
$contactstatic->phone_mobile = $objp->phone_mobile;
|
||||
$contactstatic->address = $objp->address;
|
||||
$contactstatic->zip = $objp->zip;
|
||||
$contactstatic->town = $objp->town;
|
||||
|
||||
$societestatic->id = $objp->fk_soc;
|
||||
$societestatic->name = $objp->socname;
|
||||
|
||||
$societestatic->name_alias = $objp->name_alias;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$societestatic->client = $objp->client;
|
||||
$societestatic->fournisseur = $objp->fournisseur;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $contactstatic->getNomUrl(1),
|
||||
|
||||
@ -388,11 +388,16 @@ abstract class CommonDocGenerator
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
|
||||
$vatformated=vatrate($line->tva_tx);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
|
||||
}
|
||||
|
||||
// Retrieve extrafields
|
||||
if (is_array($object->array_options) && count($object->array_options))
|
||||
{
|
||||
|
||||
@ -144,6 +144,21 @@ class HookManager
|
||||
'formBuilddocLineOptions',
|
||||
'moveUploadedFile',
|
||||
'pdf_writelinedesc',
|
||||
'pdf_getlinenum',
|
||||
'pdf_getlineref',
|
||||
'pdf_getlineref_supplier',
|
||||
'pdf_getlinevatrate',
|
||||
'pdf_getlineupexcltax',
|
||||
'pdf_getlineupwithtax',
|
||||
'pdf_getlineqty',
|
||||
'pdf_getlineqty_asked',
|
||||
'pdf_getlineqty_shipped',
|
||||
'pdf_getlineqty_keeptoship',
|
||||
'pdf_getlineunit',
|
||||
'pdf_getlineremisepercent',
|
||||
'pdf_getlineprogress',
|
||||
'pdf_getlinetotalexcltax',
|
||||
'pdf_getlinetotalwithtax',
|
||||
'paymentsupplierinvoices',
|
||||
'printAddress',
|
||||
'printSearchForm',
|
||||
|
||||
@ -5254,10 +5254,12 @@ class Form
|
||||
* @param int $height Height of photo (auto if 0)
|
||||
* @param int $caneditfield Add edit fields
|
||||
* @param string $cssclass CSS name to use on img for photo
|
||||
* @param int $genericifundef Use a generic image if no image avaiable
|
||||
* @param string $imagesize 'mini', 'small' or '' (original)
|
||||
* @param int $addlinktofullsize Add link to fullsize image
|
||||
* @param int $cache 1=Accept to use image in cache
|
||||
* @return string HTML code to output photo
|
||||
*/
|
||||
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $genericifundef=0)
|
||||
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -5271,47 +5273,73 @@ class Form
|
||||
$dir=$conf->societe->multidir_output[$entity];
|
||||
$smallfile=$object->logo;
|
||||
$smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
|
||||
if (! empty($object->logo)) $file=$id.'/logos/thumbs/'.$smallfile;
|
||||
if (! empty($object->logo))
|
||||
{
|
||||
if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini');
|
||||
else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small');
|
||||
else $file=$id.'/logos/thumbs/'.$smallfile;
|
||||
}
|
||||
}
|
||||
else if ($modulepart=='contact')
|
||||
{
|
||||
$dir=$conf->societe->multidir_output[$entity].'/contact';
|
||||
$file=$id.'/photos/'.$object->photo;
|
||||
if (! empty($object->photo))
|
||||
{
|
||||
if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini');
|
||||
else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small');
|
||||
else $file=$id.'/photos/'.$object->photo;
|
||||
}
|
||||
}
|
||||
else if ($modulepart=='userphoto')
|
||||
{
|
||||
$dir=$conf->user->dir_output;
|
||||
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
|
||||
if (! empty($object->photo))
|
||||
{
|
||||
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini');
|
||||
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small');
|
||||
else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||
$email=$object->email;
|
||||
}
|
||||
else if ($modulepart=='memberphoto')
|
||||
{
|
||||
$dir=$conf->adherent->dir_output;
|
||||
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
|
||||
if (! empty($object->photo))
|
||||
{
|
||||
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
|
||||
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
|
||||
else $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||
$email=$object->email;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir=$conf->$modulepart->dir_output;
|
||||
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
|
||||
if (! empty($object->photo))
|
||||
{
|
||||
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini');
|
||||
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small');
|
||||
else $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||
$email=$object->email;
|
||||
}
|
||||
|
||||
if ($dir)
|
||||
{
|
||||
$cache='0';
|
||||
if ($file && file_exists($dir."/".$file))
|
||||
{
|
||||
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||
$ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||
$ret.='</a>';
|
||||
if ($addlinktofullsize) $ret.='</a>';
|
||||
}
|
||||
else if ($altfile && file_exists($dir."/".$altfile))
|
||||
{
|
||||
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
|
||||
$ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
|
||||
$ret.='</a>';
|
||||
if ($addlinktofullsize) $ret.='</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -176,22 +176,24 @@ class FormFile
|
||||
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
$out .= '<table width="100%" class="nobordernopadding">';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td valign="middle" class="nowrap">';
|
||||
$out .= $langs->trans("URLToLink") . ': ';
|
||||
$out .= '<div>';
|
||||
$out .= '<div class="float" style="padding-right: 10px;">';
|
||||
$out .= '<label for="link">'.$langs->trans("URLToLink") . '</label>: ';
|
||||
$out .= '<input type="text" name="link" size="'.$maxlength.'" id="link">';
|
||||
$out .= ' ' . $langs->trans("Label") . ': ';
|
||||
$out .= '</div>';
|
||||
$out .= '<div class="float" style="padding-right: 10px;">';
|
||||
$out .= '<label for="label">'.$langs->trans("Label") . '</label>: ';
|
||||
$out .= '<input type="text" name="label" id="label">';
|
||||
$out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">';
|
||||
$out .= '<input type="hidden" name="objectid" value="' . $object->id . '">';
|
||||
$out .= ' ';
|
||||
$out .= '</div>';
|
||||
$out .= '<div class="float" style="padding-right: 10px;">';
|
||||
$out .= '<input type="submit" class="button" name="linkit" value="'.$langs->trans("ToLink").'"';
|
||||
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
|
||||
$out .= '>';
|
||||
$out .= '</td></tr>';
|
||||
$out .= '</table>';
|
||||
|
||||
$out .= '</div>';
|
||||
$out .= '</div>';
|
||||
$out .= '<div class="clearboth"></div>';
|
||||
$out .= '</form><br>';
|
||||
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
|
||||
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
|
||||
@ -492,7 +494,7 @@ class FormFile
|
||||
$out.= '<input type="hidden" name="action" value="builddoc">';
|
||||
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
$out.= '<div class="titre">'.$titletoshow.'</div>';
|
||||
$out.= load_fiche_titre($titletoshow, '', '');
|
||||
$out.= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
|
||||
|
||||
$out.= '<tr class="liste_titre">';
|
||||
|
||||
@ -302,7 +302,7 @@ class FormOther
|
||||
/**
|
||||
* Return select list for categories (to use in form search selectors)
|
||||
*
|
||||
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
|
||||
* @param int $type Type of categories (0=product, 1=supplier, 2=customer, 3=member, 4=contact)
|
||||
* @param integer $selected Preselected value
|
||||
* @param string $htmlname Name of combo list
|
||||
* @param int $nocateg Show also an entry "Not categorized"
|
||||
|
||||
@ -1053,7 +1053,7 @@ function complete_elementList_with_modules(&$elementList)
|
||||
* Show array with constants to edit
|
||||
*
|
||||
* @param array $tableau Array of constants
|
||||
* @param int $strictw3c Respect W3C (no form into table)
|
||||
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all
|
||||
* @return void
|
||||
*/
|
||||
function form_constantes($tableau,$strictw3c=0)
|
||||
@ -1062,7 +1062,7 @@ function form_constantes($tableau,$strictw3c=0)
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if (! empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -1199,7 +1199,7 @@ function form_constantes($tableau,$strictw3c=0)
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
if (! empty($strictw3c))
|
||||
if (! empty($strictw3c) && $strictw3c == 1)
|
||||
{
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
|
||||
print "</form>\n";
|
||||
|
||||
@ -91,6 +91,13 @@ function societe_prepare_head(Societe $object)
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
}
|
||||
if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) ))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Projects");
|
||||
$head[$h][2] = 'project';
|
||||
$h++;
|
||||
}
|
||||
//show categorie tab
|
||||
/*if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||
{
|
||||
@ -456,9 +463,10 @@ function getFormeJuridiqueLabel($code)
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Object $object Third party object
|
||||
* @param string $backtopage Url to go once contact is created
|
||||
* @param int $nocreatelink 1=Hide create project link
|
||||
* @return void
|
||||
*/
|
||||
function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0)
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
@ -470,7 +478,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
$langs->load("projects");
|
||||
|
||||
$buttoncreate='';
|
||||
if (! empty($conf->projet->enabled) && $user->rights->projet->creer)
|
||||
if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
|
||||
{
|
||||
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject");
|
||||
@ -864,13 +872,13 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
/**
|
||||
* Show html area with actions to do
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Adherent|Societe $object Object third party or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @return mixed Return html part or void if noprint is 1
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Adherent|Societe $object Object third party or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @return mixed Return html part or void if noprint is 1
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
|
||||
@ -5223,3 +5223,32 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filename of file to get the thumbs
|
||||
*
|
||||
* @param string $file Original filename
|
||||
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
|
||||
* @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image.
|
||||
* @return string New file name
|
||||
*/
|
||||
function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
{
|
||||
$dirName = dirname($file);
|
||||
if ($dirName == '.') $dirName='';
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
|
||||
$fileName = basename($fileName);
|
||||
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i',$file)?'.png':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':'');
|
||||
|
||||
if (! $extImgTarget) return $file;
|
||||
|
||||
$subdir='';
|
||||
if ($extName) $subdir = 'thumbs/';
|
||||
|
||||
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
|
||||
}
|
||||
|
||||
120
htdocs/core/lib/hrm.lib.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/hrm.lib.php
|
||||
* \ingroup HRM
|
||||
* \brief Library for hrm
|
||||
*/
|
||||
$langs->load('hrm');
|
||||
|
||||
/**
|
||||
* Return head table for employee tabs screen
|
||||
*
|
||||
* @param object $object contact
|
||||
* @return array head table of tabs
|
||||
*/
|
||||
function employee_prepare_head($object) {
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array ();
|
||||
|
||||
$head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/card.php?id=' . $object->id;
|
||||
$head [$h] [1] = $langs->trans("Card");
|
||||
$head [$h] [2] = 'card';
|
||||
$h ++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee');
|
||||
|
||||
$head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/info.php?id=' . $object->id;
|
||||
$head [$h] [1] = $langs->trans("Info");
|
||||
$head [$h] [2] = 'info';
|
||||
$h ++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return head table for establishment tabs screen
|
||||
*
|
||||
* @param Establishment $object Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function establishment_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @return array head
|
||||
*/
|
||||
function hrm_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php';
|
||||
$head[$h][1] = $langs->trans("Parameters");
|
||||
$head[$h][2] = 'parameters';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
|
||||
$head[$h][1] = $langs->trans("Establishments");
|
||||
$head[$h][2] = 'establishments';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
||||
break;
|
||||
case IMAGETYPE_JPEG: // 2
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||
$extImgTarget = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg');
|
||||
$extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'.jpg');
|
||||
$newquality=$quality;
|
||||
break;
|
||||
case IMAGETYPE_PNG: // 3
|
||||
@ -512,7 +512,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
|
||||
$fileName = basename($fileName);
|
||||
$imgThumbName = $dirthumb.'/'.$fileName.$extName.$extImgTarget; // Chemin complet du fichier de la vignette
|
||||
$imgThumbName = $dirthumb.'/'.getImageFileNameForSize($file, $extName, $extImgTarget); // Chemin complet du fichier de la vignette
|
||||
|
||||
// Check if permission are ok
|
||||
//$fp = fopen($imgThumbName, "w");
|
||||
|
||||
@ -1032,20 +1032,23 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
|
||||
* @param int $hideref Hide reference
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $issupplierline Is it a line for a supplier object ?
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
|
||||
{
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('pdf'=>$pdf,'i'=>$i,'outputlangs'=>$outputlangs,'w'=>$w,'h'=>$h,'posx'=>$posx,'posy'=>$posy,'hideref'=>$hideref,'hidedesc'=>$hidedesc,'issupplierline'=>$issupplierline,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -1054,6 +1057,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
|
||||
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true);
|
||||
return $labelproductservice;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1250,22 +1254,25 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return null|string
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->num);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -1276,22 +1283,25 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return null|string
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->product_ref);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1301,22 +1311,25 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return null|string
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->ref_supplier);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1332,7 +1345,9 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
@ -1340,13 +1355,13 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1365,7 +1380,9 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$sign=1;
|
||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
@ -1373,13 +1390,13 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1389,25 +1406,29 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines)
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
foreach($object->hooks as $modules)
|
||||
{
|
||||
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
|
||||
}
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1423,25 +1444,25 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($object->lines[$i]->special_code != 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
|
||||
}
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1457,24 +1478,24 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($object->lines[$i]->special_code != 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_asked;
|
||||
}
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_asked;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1490,24 +1511,24 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($object->lines[$i]->special_code != 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_shipped;
|
||||
}
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_shipped;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1517,30 +1538,30 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($object->lines[$i]->special_code != 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
|
||||
}
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1556,31 +1577,32 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false)
|
||||
{
|
||||
global $langs;
|
||||
if ($object->lines[$i]->special_code != 3) {
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) {
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (!empty($object->lines[$i]->fk_parent_line)) {
|
||||
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
}
|
||||
$parameters = array(
|
||||
'i' => $i,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails,
|
||||
'special_code' => $special_code
|
||||
);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object,
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
|
||||
} else {
|
||||
if (empty($hidedetails) || $hidedetails > 1) {
|
||||
return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
||||
}
|
||||
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (!empty($object->lines[$i]->fk_parent_line)) {
|
||||
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
}
|
||||
$parameters = array(
|
||||
'i' => $i,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails,
|
||||
'special_code' => $special_code
|
||||
);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -1599,24 +1621,24 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
if ($object->lines[$i]->special_code != 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
||||
}
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1627,24 +1649,28 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
if ($object->lines[$i]->special_code != 3) {
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) {
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
} else {
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
|
||||
}
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1663,27 +1689,25 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$sign=1;
|
||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code, 'sign'=>$sign);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
|
||||
}
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@ -1701,27 +1725,25 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
||||
if (! $passok)
|
||||
{
|
||||
if ((! $passcrypted || $passtyped)
|
||||
&& ($passtyped == $passclear))
|
||||
&& ($passclear && ($passtyped == $passclear)))
|
||||
{
|
||||
$passok=true;
|
||||
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");
|
||||
|
||||
@ -71,9 +71,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/list.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/list.php?leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
|
||||
-- Third parties - Contacts
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
|
||||
|
||||
@ -590,13 +590,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
|
||||
$newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
|
||||
/* no more required, there is a filter that can do more
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
|
||||
*/
|
||||
$newmenu->add("/societe/soc.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
|
||||
//$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
||||
@ -606,7 +606,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$newmenu->add("/comm/list.php?leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
|
||||
$newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
|
||||
|
||||
$newmenu->add("/societe/soc.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
|
||||
//$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
|
||||
|
||||
250
htdocs/core/modules/modHRM.class.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/modHRM.class.php
|
||||
* \ingroup HRM
|
||||
* \brief Description and activation file for module HRM
|
||||
*/
|
||||
include_once (DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php");
|
||||
|
||||
/**
|
||||
* Class to describe and activate the HRM module
|
||||
*/
|
||||
class modHRM extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
* Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->numero = 4000;
|
||||
$this->rights_class = 'hrm';
|
||||
|
||||
$this->family = "hr";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace ( '/^mod/i', '', get_class ( $this ) );
|
||||
$this->description = "Gestion des ressources humaines";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'development';
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_' . strtoupper ( $this->name );
|
||||
$this->special = 0;
|
||||
// $this->picto = '';
|
||||
|
||||
// define triggers
|
||||
$this->module_parts = array();
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array('admin_hrm.php@hrm');
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array();
|
||||
$this->requiredby = array(/*"
|
||||
modSalaries,
|
||||
modExpenseReport,
|
||||
modHoliday
|
||||
"*/);
|
||||
$this->conflictwith = array();
|
||||
$this->phpmin = array (
|
||||
5,
|
||||
3
|
||||
); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array (
|
||||
3,
|
||||
7
|
||||
); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array (
|
||||
"hrm"
|
||||
);
|
||||
|
||||
// Dictionnaries
|
||||
$this->dictionnaries=array(
|
||||
'langs'=>'hrm',
|
||||
'tabname'=>array(
|
||||
MAIN_DB_PREFIX."c_hrm_department",
|
||||
MAIN_DB_PREFIX."c_hrm_function"
|
||||
),
|
||||
'tablib'=>array(
|
||||
"DepartmentDict",
|
||||
"FunctionDict"
|
||||
),
|
||||
'tabsql'=>array(
|
||||
'SELECT rowid, pos, code, label, active FROM '.MAIN_DB_PREFIX.'c_hrm_department',
|
||||
'SELECT rowid, pos, code, label, c_level, active FROM '.MAIN_DB_PREFIX.'c_hrm_department'
|
||||
),
|
||||
'tabsqlsort'=>array(
|
||||
'rowid ASC',
|
||||
'rowid ASC'
|
||||
),
|
||||
'tabfield'=>array(
|
||||
"code,label",
|
||||
"code,label"
|
||||
),
|
||||
'tabfieldvalue'=>array(
|
||||
"code,label",
|
||||
"code,label"
|
||||
),
|
||||
'tabfieldinsert'=>array(
|
||||
"code,label",
|
||||
"code,label"
|
||||
),
|
||||
'tabrowid'=>array(
|
||||
"rowid",
|
||||
"rowid"
|
||||
),
|
||||
'tabcond'=>array(
|
||||
'$conf->hrm->enabled',
|
||||
'$conf->hrm->enabled'
|
||||
)
|
||||
);
|
||||
|
||||
// Constantes
|
||||
$this->const = array ();
|
||||
$r = 0;
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array ();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r = 0;
|
||||
|
||||
$this->rights[$r][0] = 4001;
|
||||
$this->rights[$r][1] = 'See employees';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'employee';
|
||||
$this->rights[$r][5] = 'read';
|
||||
$r ++;
|
||||
|
||||
$this->rights[$r][0] = 4002;
|
||||
$this->rights[$r][1] = 'Create employees';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'employee';
|
||||
$this->rights[$r][5] = 'write';
|
||||
$r ++;
|
||||
|
||||
$this->rights[$r][0] = 4003;
|
||||
$this->rights[$r][1] = 'Delete employees';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'employee';
|
||||
$this->rights[$r][5] = 'delete';
|
||||
$r ++;
|
||||
|
||||
$this->rights[$r][0] = 4004;
|
||||
$this->rights[$r][1] = 'Export employees';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'employee';
|
||||
$this->rights[$r][5] = 'export';
|
||||
$r ++;
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array (); // List of menus to add
|
||||
$r = 0;
|
||||
|
||||
$this->menu[$r] = array (
|
||||
'fk_menu' => 'fk_mainmenu=hrm',
|
||||
'type' => 'left',
|
||||
'titre' => 'Employees',
|
||||
'leftmenu' => 'employee',
|
||||
'mainmenu' => 'hrm',
|
||||
'url' => '/hrm/employee/index.php',
|
||||
'langs' => 'hrm',
|
||||
'position' => 100,
|
||||
'enabled' => '$user->rights->hrm->employee->read',
|
||||
'perms' => '$user->rights->hrm->employee->read',
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
);
|
||||
$r ++;
|
||||
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
|
||||
'type' => 'left',
|
||||
'titre' => 'NewEmployee',
|
||||
'mainmenu' => 'hrm',
|
||||
'url' => '/hrm/employee/card.php?action=create',
|
||||
'langs' => 'hrm',
|
||||
'position' => 101,
|
||||
'enabled' => '$user->rights->hrm->employee->write',
|
||||
'perms' => '$user->rights->hrm->employee->write',
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
);
|
||||
$r ++;
|
||||
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
|
||||
'type' => 'left',
|
||||
'titre' => 'List',
|
||||
'mainmenu' => 'hrm',
|
||||
'url' => '/hrm/employee/list.php',
|
||||
'langs' => 'hrm',
|
||||
'position' => 102,
|
||||
'enabled' => '$user->rights->hrm->employee->read',
|
||||
'perms' => '$user->rights->hrm->employee->read',
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
);
|
||||
$r ++;
|
||||
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
|
||||
'type' => 'left',
|
||||
'titre' => 'Statistics',
|
||||
'mainmenu' => 'hrm',
|
||||
'url' => '/hrm/employee/stats.php',
|
||||
'langs' => 'hrm',
|
||||
'position' => 103,
|
||||
'enabled' => '$user->rights->hrm->employee->read',
|
||||
'perms' => '$user->rights->hrm->employee->read',
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
);
|
||||
$r ++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus
|
||||
* (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Enabling module ('', 'noboxes')
|
||||
* @return int if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
}
|
||||
@ -520,7 +520,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%" class="fieldrequired">';
|
||||
@ -662,6 +662,8 @@ if ($action == 'create')
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
@ -1533,9 +1535,9 @@ else if ($id || $ref)
|
||||
*/
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->expedition->dir_output . "/sending/" .$objectref;
|
||||
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
@ -1552,14 +1554,14 @@ else if ($id || $ref)
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($object,'shipping',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -1534,7 +1534,7 @@ class ExpenseReport extends CommonObject
|
||||
$response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("ExpenseReportsToPay");
|
||||
$response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5';
|
||||
$response->img=img_object($langs->trans("ExpenseReports"),"user");
|
||||
$response->img=img_object($langs->trans("ExpenseReports"),"trip");
|
||||
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
|
||||
@ -1575,6 +1575,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]='ErrorWhenRunningTrigger';
|
||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
@ -1587,6 +1588,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1597,12 +1600,14 @@ class CommandeFournisseur extends CommonOrder
|
||||
if ($this->db->affected_rows($resql) < 1)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1612,6 +1617,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error='FailToDeleteExtraFields';
|
||||
$this->errors[]='FailToDeleteExtraFields';
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
@ -1619,7 +1626,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
// Delete linked object
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error++;
|
||||
if ($res < 0) {
|
||||
$this->error='FailToDeleteObjectLinked';
|
||||
$this->errors[]='FailToDeleteObjectLinked';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -1634,6 +1645,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||
{
|
||||
$this->error='ErrorFailToDeleteFile';
|
||||
$this->errors[]='ErrorFailToDeleteFile';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1643,6 +1655,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
$this->errors[]='ErrorFailToDeleteDir';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,9 +94,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_company="";
|
||||
$search_amount_no_tax="";
|
||||
$search_amount_all_tax="";
|
||||
$search_status="";
|
||||
$year="";
|
||||
$month="";
|
||||
$filter="";
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -162,15 +162,6 @@ if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if ($filter && $filter != -1) // GETPOST('filtre') may be a string
|
||||
{
|
||||
$filtrearr = explode(",", $filter);
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = explode(":", $fil);
|
||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||
}
|
||||
}
|
||||
if ($search_all)
|
||||
{
|
||||
$sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
@ -232,7 +223,7 @@ if ($search_amount_all_tax != '')
|
||||
|
||||
if ($search_status != '')
|
||||
{
|
||||
$sql.= " AND fac.fk_statut = '".$db->escape($search_status)."'";
|
||||
$sql.= " AND fac.fk_statut = ".$search_status;
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -268,6 +259,7 @@ if ($resql)
|
||||
if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
|
||||
if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -337,8 +329,8 @@ if ($resql)
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
$liststatus=array('fac.fk_statut:0'=>$langs->trans("Draft"),'fac.fk_statut:1,paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
|
||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||
$liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"));
|
||||
print $form->selectarray('filtre', $liststatus, $search_status, 1);
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
||||
126
htdocs/hrm/admin/admin_establishment.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/hrm/admin/admin_establishment.php
|
||||
* \ingroup HRM
|
||||
* \brief HRM Establishment module setup page
|
||||
*/
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load('hrm');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$object = new Establishment($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$page_name = "Establishments";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||
|
||||
// Configuration header
|
||||
$head = hrm_admin_prepare_head();
|
||||
dol_fiche_head($head, 'establishments', $langs->trans("HRM"), 0, "user");
|
||||
|
||||
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";
|
||||
$sql.= " WHERE e.entity = ".$conf->entity;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
// Load attribute_label
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Address").'</td>';
|
||||
print '<td>'.$langs->trans("Zipcode").'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$establishmentstatic=new Establishment($db);
|
||||
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$fiscalyearstatic->id=$obj->rowid;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="admin_establishment_card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEstablishment"),"building").' '.$obj->rowid.'</a></td>';
|
||||
print '<td align="left">'.$obj->name.'</td>';
|
||||
print '<td align="left">'.$obj->address.'</td>';
|
||||
print '<td align="left">'.$obj->zip.'</td>';
|
||||
print '<td align="left">'.$obj->town.'</td>';
|
||||
print '<td align="right">'.$establishmentstatic->LibStatut($obj->status,5).'</td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="../establishment/card.php?action=create">'.$langs->trans("NewEstablishment").'</a>';
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
58
htdocs/hrm/admin/admin_hrm.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/hrm/admin/admin_hrm.php
|
||||
* \ingroup HRM
|
||||
* \brief HRM module setup page
|
||||
*/
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load('hrm');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$page_name = "Parameters";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||
|
||||
// Configuration header
|
||||
$head = hrm_admin_prepare_head();
|
||||
dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user");
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
0
htdocs/hrm/admin/index.html
Normal file
324
htdocs/hrm/class/establishment.class.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/hrm/class/establishment.class.php
|
||||
* \ingroup HRM
|
||||
* \brief File of class to manage establishments
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
|
||||
/**
|
||||
* Class to manage establishments
|
||||
*/
|
||||
class Establishment extends CommonObject
|
||||
{
|
||||
public $element='establishment';
|
||||
public $table_element='establishment';
|
||||
public $table_element_line = '';
|
||||
public $fk_element = 'fk_establishment';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $rowid;
|
||||
|
||||
var $name;
|
||||
var $address;
|
||||
var $zip;
|
||||
var $town;
|
||||
var $status; // 0=open, 1=closed
|
||||
var $entity;
|
||||
|
||||
var $statuts=array();
|
||||
var $statuts_short=array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
|
||||
$this->statuts = array(0 => 'Opened', 1 => 'Closed');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object in database
|
||||
*
|
||||
* @param User $user User making creation
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."establishment (";
|
||||
$sql.= "name";
|
||||
$sql.= ", address";
|
||||
$sql.= ", zip";
|
||||
$sql.= ", town";
|
||||
$sql.= ", status";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->name."'";
|
||||
$sql.= ", '".$this->address."'";
|
||||
$sql.= ", '".$this->zip."'";
|
||||
$sql.= ", '".$this->town."'";
|
||||
$sql.= ", ".$this->status;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ". $user->id;
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "establishment");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ( $this->errors as $errmsg ) {
|
||||
dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param User $user User making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->name))
|
||||
{
|
||||
$this->error='ErrorBadParameter';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."establishment";
|
||||
$sql .= " SET name = '".$this->name."'";
|
||||
$sql .= ", address = '".$this->address."'";
|
||||
$sql .= ", zip = '".$this->zip."'";
|
||||
$sql .= ", town = '".$this->town."'";
|
||||
$sql .= ", status = '".$this->status."'";
|
||||
$sql .= ", fk_user_mod = " . $user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from database
|
||||
*
|
||||
* @param int $id Id of record to load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, name, address, zip, town, status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."establishment";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->name = $obj->name;
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
$this->status = $obj->status;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."establishment WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a label from a status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatus($mode=0)
|
||||
{
|
||||
return $this->LibStatus($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a label from a status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function LibStatus($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$status]);
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts[$status]);
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'status4');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'status8');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e';
|
||||
$sql.= ' WHERE e.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch info", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
if ($obj->fk_user_modif)
|
||||
{
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_mod);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
htdocs/hrm/class/index.html
Normal file
410
htdocs/hrm/establishment/card.php
Normal file
@ -0,0 +1,410 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/hrm/establishment/card.php
|
||||
* \brief Page to show an establishment
|
||||
*/
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("hrm");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// List of status
|
||||
static $tmpstatus2label=array(
|
||||
'0'=>'OpenEtablishment',
|
||||
'1'=>'CloseEtablishment'
|
||||
);
|
||||
$status2label=array('');
|
||||
foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
|
||||
|
||||
$object = new Establishment($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == "yes")
|
||||
{
|
||||
$result=$object->delete($id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: ../admin/admin_establishment.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'add')
|
||||
{
|
||||
if (! $cancel)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$object->name = GETPOST('name', 'alpha');
|
||||
if (empty($object->name))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($error))
|
||||
{
|
||||
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
|
||||
if (! empty($tmparray['id']))
|
||||
{
|
||||
$object->country_id =$tmparray['id'];
|
||||
$object->country_code =$tmparray['code'];
|
||||
$object->country_label=$tmparray['label'];
|
||||
}
|
||||
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->fk_pays = $object->country_id;
|
||||
$object->status = GETPOST('status','int');
|
||||
$object->fk_user_author = $user->id;
|
||||
$object->datec = dol_now();
|
||||
|
||||
$id = $object->create($user);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ../admin/admin_establishment.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
else if ($action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (! $cancel) {
|
||||
|
||||
$name = GETPOST('name', 'alpha');
|
||||
if (empty($name)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('NameProperty')), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
$typeid = GETPOST('typeid', 'int');
|
||||
if (empty($typeid)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('TypeProperty')), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$object->name = GETPOST('name', 'alpha');
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->fk_pays = GETPOST('country_id', 'int');
|
||||
$object->rowid = GETPOST('id');
|
||||
$object->fk_user_mod = $user->id;
|
||||
|
||||
$id = $object->update();
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header("Location: card.php?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
/*
|
||||
* Action create
|
||||
*/
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewEstablishment"));
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Name
|
||||
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("Name").'</label></td><td><input name="name" id="name" size="32" value="' . GETPOST("name") . '"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td><label for="address">' . $langs->trans("Address") . '</label></td>';
|
||||
print '<td>';
|
||||
print '<input name="address" id="address" size="32" value="' . $object->address . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Zipcode
|
||||
print '<tr>';
|
||||
print '<td><label for="zipcode">' . $langs->trans('Zip') . '</label></td>';
|
||||
print '<td>';
|
||||
print $formcompany->select_ziptown(GETPOST('zipcode', 'alpha'), 'zipcode', array (
|
||||
'town',
|
||||
'selectcountry_id'
|
||||
), 6);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Town
|
||||
print '<tr>';
|
||||
print '<td><label for="town">' . $langs->trans('Town') . '</label></td>';
|
||||
print '<td>';
|
||||
print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array (
|
||||
'zipcode',
|
||||
'selectcountry_id'
|
||||
));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr>';
|
||||
print '<td><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_country($mysoc->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired"><label for="status">'.$langs->trans("Status").'</label></td>';
|
||||
print '<td>';
|
||||
print $form->selectarray('status',$status2label,GETPOST('status'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else if ($id)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$head = establishment_prepare_head($object);
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building');
|
||||
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print "<tr>";
|
||||
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $object->rowid;
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("Name").'</label></td><td>';
|
||||
print '<input name="name" id="name" class="flat" size="32" value="'.$object->name.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td><label for="address">' . $langs->trans("Address") . '</label></td>';
|
||||
print '<td>';
|
||||
print '<input name="address" id="address" size="32" value="' . $object->address . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Zipcode / Town
|
||||
print '<tr><td><label for="zipcode">' . $langs->trans('Zip') . '</label></td><td>';
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array (
|
||||
'town',
|
||||
'selectcountry_id'
|
||||
), 6) . '</tr>';
|
||||
print '<tr><td><label for="town">' . $langs->trans('Town') . '</label></td><td>';
|
||||
print $formcompany->select_ziptown($object->town, 'town', array (
|
||||
'zipcode',
|
||||
'selectcountry_id'
|
||||
)) . '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr>';
|
||||
print '<td><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->select_country($object->fk_pays,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td><label for="status">'.$langs->trans("Status").'</label></td><td>';
|
||||
print $form->selectarray('status',$status2label,$object->status);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Confirm delete
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteEstablishment"),$langs->trans("ConfirmDeleteEstablishment"),"confirm_delete");
|
||||
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="../admin/admin_establishment.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
|
||||
print $object->rowid;
|
||||
print '</td><td width="25%">';
|
||||
print $linkback;
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td colspan="2">'.$object->name.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Address").'</td>';
|
||||
print '<td colspan="2">'.$object->address.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Zipcode
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Zipcode").'</td>';
|
||||
print '<td colspan="2">'.$object->zip.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Town
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td colspan="2">'.$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="2">'.getCountry($object->fk_pays,1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatus(4).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
0
htdocs/hrm/establishment/index.html
Normal file
57
htdocs/hrm/establishment/info.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/hrm/establishment/info.php
|
||||
* \brief Page to show info of an establishment
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("hrm");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// View
|
||||
llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$object = new Establishment($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = establishment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Establishment"), 0, 'building');
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
0
htdocs/hrm/index.html
Normal file
@ -103,7 +103,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
* Informations area
|
||||
*/
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table summary="Login info" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th class="liste_titre" colspan="2">'.$langs->trans("Informations").'</th></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap">'.$langs->trans("User").'</td><td>'.$user->getNomUrl(0).'</td></tr>';
|
||||
@ -129,7 +129,7 @@ $langs->load("contracts");
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table summary="'.$langs->trans("DolibarrStateBoard").'" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre" colspan="2">'.$langs->trans("DolibarrStateBoard").'</th>';
|
||||
print '<th class="liste_titre" align="right"> </th>';
|
||||
@ -231,8 +231,9 @@ if (empty($user->societe_id))
|
||||
"SuppliersInvoices",
|
||||
"ExpenseReports");
|
||||
// Dashboard Link lines
|
||||
$links=array(DOL_URL_ROOT.'/comm/list.php',
|
||||
DOL_URL_ROOT.'/comm/prospect/list.php',
|
||||
$links=array(
|
||||
DOL_URL_ROOT.'/societe/list.php?type=c',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=p',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=f',
|
||||
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
||||
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
||||
|
||||
43
htdocs/install/mysql/data/llx_c_hrm_department.sql
Normal file
@ -0,0 +1,43 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(2, 10,'GESTION', 'Gestion', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(3, 15,'TRAINING', 'Training', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(4, 20,'IT', 'Inform. Technology (IT)', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(5, 25,'MARKETING', 'Marketing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(6, 30,'SALES', 'Sales', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(7, 35,'LEGAL', 'Legal', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(8, 40,'FINANCIAL', 'Financial accounting', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(9, 45,'HUMANRES', 'Human resources', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(10, 50,'PURCHASING', 'Purchasing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(11, 55,'SERVICES', 'Services', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(12, 60,'CUSTOMSERV', 'Customer service', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(13, 65,'CONSULTING', 'Consulting', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(14, 70,'LOGISTIC', 'Logistics', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(15, 75,'CONSTRUCT', 'Engineering/design', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(16, 80,'PRODUCTION', 'Manufacturing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(17, 85,'QUALITY', 'Quality assurance', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(18, 85,'MAINT', 'Plant assurance', 1);
|
||||
34
htdocs/install/mysql/data/llx_c_hrm_function.sql
Normal file
@ -0,0 +1,34 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5,'EXECBOARD', 'Executive board', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(2, 10, 'MANAGDIR', 'Managing director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 15, 'ACCOUNTMANAG', 'Account manager', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 20, 'ENGAGDIR', 'Engagement director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(4, 25, 'DIRECTOR', 'Director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(5, 30, 'PROJMANAG', 'Project manager', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(6, 35, 'DEPHEAD', 'Department head', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(7, 40, 'SECRETAR', 'Secretary', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(8, 45, 'EMPLOYEE', 'Department employee', 0, 1);
|
||||
@ -53,6 +53,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_M
|
||||
-- IHM
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_LISTE_LIMIT','25','chaine','Longueur maximum des listes',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0,0);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SHOW_WORKBOARD','1','yesno','Affichage tableau de bord de travail Dolibarr',0,0);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_STANDARD','eldy_menu.php','chaine','Menu manager for internal users',0);
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
|
||||
INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
|
||||
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0);
|
||||
|
||||
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
||||
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
||||
@ -100,3 +101,7 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (label, entity);
|
||||
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN onportal tinyint DEFAULT 0 after tobuy;
|
||||
|
||||
|
||||
ALTER TABLE llx_user ADD COLUMN employee tinyint DEFAULT 1;
|
||||
|
||||
|
||||
88
htdocs/install/mysql/migration/3.9.0-4.0.0.sql
Normal file
@ -0,0 +1,88 @@
|
||||
--
|
||||
-- Be carefull to requests order.
|
||||
-- This file must be loaded by calling /install/index.php page
|
||||
-- when current version is 3.9.0 or higher.
|
||||
--
|
||||
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
|
||||
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
|
||||
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
|
||||
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
|
||||
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
|
||||
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
|
||||
-- To restrict request to Mysql version x.y use -- VMYSQLx.y
|
||||
-- To restrict request to Pgsql version x.y use -- VPGSQLx.y
|
||||
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
|
||||
-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
|
||||
-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
|
||||
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_c_hrm_function
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
pos tinyint DEFAULT 0 NOT NULL,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(50),
|
||||
c_level tinyint DEFAULT 0 NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5,'EXECBOARD', 'Executive board', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(2, 10, 'MANAGDIR', 'Managing director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 15, 'ACCOUNTMANAG', 'Account manager', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 20, 'ENGAGDIR', 'Engagement director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(4, 25, 'DIRECTOR', 'Director', 1, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(5, 30, 'PROJMANAG', 'Project manager', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(6, 35, 'DEPHEAD', 'Department head', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(7, 40, 'SECRETAR', 'Secretary', 0, 1);
|
||||
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(8, 45, 'EMPLOYEE', 'Department employee', 0, 1);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_c_hrm_department
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
pos tinyint DEFAULT 0 NOT NULL,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(50),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(2, 10,'GESTION', 'Gestion', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(3, 15,'TRAINING', 'Training', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(4, 20,'IT', 'Inform. Technology (IT)', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(5, 25,'MARKETING', 'Marketing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(6, 30,'SALES', 'Sales', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(7, 35,'LEGAL', 'Legal', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(8, 40,'FINANCIAL', 'Financial accounting', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(9, 45,'HUMANRES', 'Human resources', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(10, 50,'PURCHASING', 'Purchasing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(11, 55,'SERVICES', 'Services', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(12, 60,'CUSTOMSERV', 'Customer service', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(13, 65,'CONSULTING', 'Consulting', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(14, 70,'LOGISTIC', 'Logistics', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(15, 75,'CONSTRUCT', 'Engineering/design', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(16, 80,'PRODUCTION', 'Manufacturing', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(17, 85,'QUALITY', 'Quality assurance', 1);
|
||||
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(18, 85,'MAINT', 'Plant assurance', 1);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_establishment (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
entity integer NOT NULL DEFAULT 1,
|
||||
name varchar(50),
|
||||
address varchar(255),
|
||||
zip varchar(25),
|
||||
town varchar(50),
|
||||
fk_state integer DEFAULT 0,
|
||||
fk_country integer DEFAULT 0,
|
||||
profid1 varchar(20),
|
||||
profid2 varchar(20),
|
||||
profid3 varchar(20),
|
||||
phone varchar(20),
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
datec datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
status tinyint DEFAULT 1
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
26
htdocs/install/mysql/tables/llx_c_hrm_department.sql
Normal file
@ -0,0 +1,26 @@
|
||||
--
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
create table llx_c_hrm_department
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
pos tinyint DEFAULT 0 NOT NULL,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(50),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
27
htdocs/install/mysql/tables/llx_c_hrm_function.sql
Normal file
@ -0,0 +1,27 @@
|
||||
--
|
||||
-- Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
-- Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
create table llx_c_hrm_function
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
pos tinyint DEFAULT 0 NOT NULL,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(50),
|
||||
c_level tinyint DEFAULT 0 NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
41
htdocs/install/mysql/tables/llx_establishment.sql
Normal file
@ -0,0 +1,41 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
--
|
||||
-- Structure de la table llx_establishment
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_establishment (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
entity integer NOT NULL DEFAULT 1,
|
||||
name varchar(50),
|
||||
address varchar(255),
|
||||
zip varchar(25),
|
||||
town varchar(50),
|
||||
fk_state integer DEFAULT 0,
|
||||
fk_country integer DEFAULT 0,
|
||||
profid1 varchar(20),
|
||||
profid2 varchar(20),
|
||||
profid3 varchar(20),
|
||||
phone varchar(20),
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
datec datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
status tinyint DEFAULT 1
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
@ -25,6 +25,8 @@ create table llx_user
|
||||
|
||||
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
|
||||
ref_int varchar(50), -- reference into an internal system (deprecated)
|
||||
|
||||
employee tinyint DEFAULT 1, -- 1 if user is an employee
|
||||
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
|
||||
@ -540,6 +540,8 @@ Module2900Name=GeoIPMaxmind
|
||||
Module2900Desc=GeoIP Maxmind conversions capabilities
|
||||
Module3100Name=Skype
|
||||
Module3100Desc=Add a Skype button into card of adherents / third parties / contacts
|
||||
Module4000Name=HRM
|
||||
Module4000Desc=Human resources management
|
||||
Module5000Name=Multi-company
|
||||
Module5000Desc=Allows you to manage multiple companies
|
||||
Module6000Name=Workflow
|
||||
|
||||
@ -216,8 +216,8 @@ DateEcheance=Due date limit
|
||||
DateInvoice=Invoice date
|
||||
NoInvoice=No invoice
|
||||
ClassifyBill=Classify invoice
|
||||
SupplierBillsToPay=Suppliers invoices to pay
|
||||
CustomerBillsUnpaid=Unpaid customers invoices
|
||||
SupplierBillsToPay=Unpaid supplier invoices
|
||||
CustomerBillsUnpaid=Unpaid customer invoices
|
||||
NonPercuRecuperable=Non-recoverable
|
||||
SetConditions=Set payment terms
|
||||
SetMode=Set payment mode
|
||||
|
||||
@ -305,7 +305,7 @@ ListOfCustomersContacts=List of customer contacts
|
||||
ListOfSuppliersContacts=List of supplier contacts
|
||||
ListOfCompanies=List of companies
|
||||
ListOfThirdParties=List of third parties
|
||||
ShowCompany=Show company
|
||||
ShowCompany=Show thirdparty
|
||||
ShowContact=Show contact
|
||||
ContactsAllShort=All (No filter)
|
||||
ContactType=Contact type
|
||||
|
||||
13
htdocs/langs/en_US/hrm.lang
Normal file
@ -0,0 +1,13 @@
|
||||
# Dolibarr language file - en_US - hrm
|
||||
CHARSET=UTF-8
|
||||
|
||||
Establishments=Establishments
|
||||
Establishment=Establishment
|
||||
NewEstablishment=New establishment
|
||||
DeleteEstablishment=Delete establishment
|
||||
ConfirmDeleteEstablishment=Are-you sure to delete this establishment ?
|
||||
OpenEtablishment=Open establishment
|
||||
CloseEtablishment=Close establishment
|
||||
Employees=Employees
|
||||
Employee=Employee
|
||||
NewEmployee=New employee
|
||||
@ -67,6 +67,8 @@ ProductStatusNotOnBuy=Not for purchase
|
||||
ProductStatusOnBuyShort=For purchase
|
||||
ProductStatusNotOnBuyShort=Not for purchase
|
||||
UpdatePrice=Update price
|
||||
UpdateVAT=Update vat
|
||||
UpdateDefaultPrice=Update default price
|
||||
AppliedPricesFrom=Applied prices from
|
||||
SellingPrice=Selling price
|
||||
SellingPriceHT=Selling price (net of tax)
|
||||
@ -105,6 +107,7 @@ AddPhoto=Add photo
|
||||
ListOfStockMovements=List of stock movements
|
||||
BuyingPrice=Buying price
|
||||
PriceForEachProduct=Products with specific prices
|
||||
NoPriceSpecificToCustomer=This customer has no specific prices. All standard prices for products/services will be used.
|
||||
SupplierCard=Supplier card
|
||||
CommercialCard=Commercial card
|
||||
AllWays=Path to find your product in stock
|
||||
@ -298,6 +301,6 @@ LastUpdated=Last updated
|
||||
CorrectlyUpdated=Correctly updated
|
||||
PropalMergePdfProductActualFile=Files use to add into PDF Azur are/is
|
||||
PropalMergePdfProductChooseFile=Select PDF files
|
||||
IncludingProductWithTag=Including product with tag
|
||||
IncludingProductWithTag=Including product/service with tag
|
||||
DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on customer
|
||||
WarningSelectOneDocument=Please select at least one document
|
||||
|
||||
@ -3,9 +3,9 @@ WorkflowSetup=Workflow module setup
|
||||
WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in.
|
||||
ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules.
|
||||
descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed
|
||||
descWORKFLOW_PROPAL_AUTOCREATE_INVOICEAutomatically create a customer invoice after a commercial proposal is signed
|
||||
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICEAutomatically create a customer invoice after a contract is validated
|
||||
descWORKFLOW_ORDER_AUTOCREATE_INVOICEAutomatically create a customer invoice after a customer order is closed
|
||||
descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed
|
||||
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated
|
||||
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a customer order is closed
|
||||
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated
|
||||
|
||||
@ -515,7 +515,7 @@ if (! defined('NOLOGIN'))
|
||||
exit;
|
||||
}
|
||||
|
||||
$resultFetchUser=$user->fetch('', $login, '', 0, ($entitytotest ? $entitytotest : -1);
|
||||
$resultFetchUser=$user->fetch('', $login, '', 0, ($entitytotest ? $entitytotest : -1));
|
||||
if ($resultFetchUser <= 0)
|
||||
{
|
||||
dol_syslog('User not found, connexion refused');
|
||||
@ -1485,14 +1485,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
||||
// Add login user link
|
||||
$toprightmenu.='<div class="login_block_user">';
|
||||
|
||||
// User photo
|
||||
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">';
|
||||
$toprightmenu.=$user->getPhotoUrl(0,0,'loginphoto');
|
||||
$toprightmenu.='</div></div>';
|
||||
|
||||
// Login name with tooltip
|
||||
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
|
||||
$toprightmenu.=$user->getNomurl(0, '', true, 0, 11, 0, ($user->firstname ? 'firstname' : -1),'atoplogin');
|
||||
// Login name with photo and tooltip
|
||||
$mode=-1;
|
||||
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
|
||||
$toprightmenu.=$user->getNomUrl($mode, '', true, 0, 11, 0, ($user->firstname ? 'firstname' : -1),'atoplogin');
|
||||
$toprightmenu.='</div></div>';
|
||||
|
||||
$toprightmenu.='</div>';
|
||||
@ -1610,6 +1606,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
|
||||
}
|
||||
|
||||
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
|
||||
{
|
||||
$langs->load("hrm");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user'));
|
||||
}
|
||||
|
||||
// Execute hook printSearchForm
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
@ -216,7 +216,7 @@ if ($object->id)
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
// Merge propal PDF docuemnt PDF files
|
||||
// Merge propal PDF document PDF files
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
@ -233,7 +233,8 @@ if ($object->id)
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||
|
||||
// For each file build select list with PDF extention
|
||||
if (count($filearray) > 0) {
|
||||
if (count($filearray) > 0)
|
||||
{
|
||||
print '<br>';
|
||||
// Actual file to merge is :
|
||||
if (count($filetomerge->lines) > 0) {
|
||||
@ -315,19 +316,23 @@ if ($object->id)
|
||||
$checked = '';
|
||||
$filename = $filetoadd['name'];
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines)) {
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines))
|
||||
{
|
||||
$filename = $filetoadd['name'] . ' - ' . $langs->trans('Language_' . $delauft_lang);
|
||||
$checked = ' checked ';
|
||||
}
|
||||
} else {
|
||||
if (array_key_exists($filetoadd['name'], $filetomerge->lines)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (array_key_exists($filetoadd['name'], $filetomerge->lines))
|
||||
{
|
||||
$checked = ' checked ';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="' . $style . '"><td>';
|
||||
|
||||
print '<input type="checkbox" ' . $checked . ' name="filetoadd[]" id="filetoadd" value="' . $filetoadd['name'] . '">' . $filename . '</input>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -84,8 +84,37 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'update_price' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$object->tva_tx = GETPOST('tva_tx');
|
||||
|
||||
$db->begin();
|
||||
|
||||
$resql = $object->update($object->id, $user);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
$action='';
|
||||
}
|
||||
|
||||
if (($action == 'update_price') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$maxpricesupplier = $object->min_recommended_price();
|
||||
$object->fk_price_expression = empty($eid) ? 0 : $eid; //0 discards expression
|
||||
|
||||
@ -399,6 +428,11 @@ if ($isphoto) {
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="2">';
|
||||
print $object->getLibStatut(2, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
// MultiPrix
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
@ -433,14 +467,32 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
print price($object->multiprices_min["$soc->price_level"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$soc->price_level"])?'HT':$object->multiprices_base_type["$soc->price_level"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx["$soc->price_level"], true) . '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx["$soc->price_level"], true) . '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// We show only vat for level 1
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// We show only vat for level 1
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre"><td style="text-align: center">'.$langs->trans("PriceLevel").'</td><td style="text-align: center">'.$langs->trans("SellingPrice").'</td><td style="text-align: center">'.$langs->trans("MinPrice").'</td></tr>';
|
||||
|
||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
@ -551,7 +603,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
|
||||
@ -649,11 +703,6 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
}
|
||||
}
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="2">';
|
||||
print $object->getLibStatut(2, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
@ -669,16 +718,69 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
|
||||
{
|
||||
print "\n" . '<div class="tabsAction">' . "\n";
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdatePrice") . '</a></div>';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Edition du prix
|
||||
* Edit price area
|
||||
*/
|
||||
|
||||
if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("UpdateVAT"), '');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update_vat">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// VAT
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '<br></form><br>';
|
||||
}
|
||||
|
||||
if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewPrice"), '');
|
||||
@ -785,26 +887,31 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
||||
}
|
||||
else
|
||||
{
|
||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
dol_fiche_head('');
|
||||
|
||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
{
|
||||
if ($i > 1) print '<br>';
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" 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="update_price">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL))
|
||||
{
|
||||
print '<input type="hidden" name="tva_tx_' . $i . '" value="' . $object->tva_tx . '">';
|
||||
}
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// VAT
|
||||
if ($i == 1) {
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||
print $form->load_tva("tva_tx_" . $i, $object->multiprices_tva_tx ["$i"], $mysoc, '', $object->id);
|
||||
print $form->load_tva("tva_tx_" . $i, $object->multiprices_tva_tx["$i"], $mysoc, '', $object->id);
|
||||
print '</td></tr>';
|
||||
} else { // We always use the vat rate of price level 1 (A vat rate does not depends on customer)
|
||||
print '<input type="hidden" name="tva_tx_' . $i . '" value="' . $object->multiprices_tva_tx [1] . '">';
|
||||
}
|
||||
|
||||
|
||||
// Selling price
|
||||
print '<tr><td width="20%">';
|
||||
$text = $langs->trans('SellingPrice') . ' ' . $i;
|
||||
@ -839,10 +946,10 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
}
|
||||
|
||||
@ -886,14 +993,14 @@ if ($result)
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
print '<td align="center">' . $langs->trans("MultiPriceLevelsName") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("PriceLevel") . '</td>';
|
||||
}
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
print '<td align="center">' . $langs->trans("Type") . '</td>';
|
||||
}
|
||||
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VAT") . '</td>';
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
if (! empty($conf->dynamicprices->enabled)) {
|
||||
@ -928,7 +1035,7 @@ if ($result)
|
||||
}
|
||||
|
||||
print '<td align="center">' . $langs->trans($objp->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($objp->tva_tx, true, $objp->recuperableonly) . "</td>";
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) print '<td align="right">' . vatrate($objp->tva_tx, true, $objp->recuperableonly) . "</td>";
|
||||
|
||||
//Price
|
||||
if (! empty($objp->fk_price_expression) && ! empty($conf->dynamicprices->enabled))
|
||||
@ -942,14 +1049,14 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">' . price($objp->price) . "</td>";
|
||||
print '<td align="right">' . price($objp->price_ttc) . "</td>";
|
||||
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price) : ''). "</td>";
|
||||
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : '') . "</td>";
|
||||
if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled
|
||||
print '<td align="right"></td>';
|
||||
}
|
||||
}
|
||||
print '<td align="right">' . price($objp->price_min) . '</td>';
|
||||
print '<td align="right">' . price($objp->price_min_ttc) . '</td>';
|
||||
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '</td>';
|
||||
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '</td>';
|
||||
|
||||
// User
|
||||
print '<td align="right"><a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $objp->user_id . '">' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '</a></td>';
|
||||
@ -1202,7 +1309,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<td>' . $langs->trans("ThirdParty") . '</td>';
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VAT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||
@ -1275,7 +1382,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<td>' . $langs->trans("ThirdParty") . '</td>';
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VAT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||
@ -1355,19 +1462,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print "\n" . '<div class="tabsAction">' . "\n";
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
}
|
||||
print "\n</div><br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -624,7 +624,7 @@ else
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input size="40" name="title" value="'.$object->title.'"></td></tr>';
|
||||
|
||||
// Customer
|
||||
// Thirdparty
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filteronlist='';
|
||||
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
||||
@ -713,7 +713,7 @@ else
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1);
|
||||
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -121,17 +121,34 @@ if ($socid)
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
$objthirdparty=$object;
|
||||
$objcon=new stdClass();
|
||||
|
||||
$out='';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
||||
{
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id;
|
||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1';
|
||||
//$out.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
//$out.="</a>";
|
||||
}
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -143,25 +160,11 @@ if ($socid)
|
||||
|
||||
print '<br>';
|
||||
|
||||
$objthirdparty=$object;
|
||||
$objcon=new stdClass();
|
||||
|
||||
$out='';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id;
|
||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1">';
|
||||
$out.=$langs->trans("AddAnAction").' ';
|
||||
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
$out.="</a>";
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,'');
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
show_actions_todo($conf,$langs,$db,$object,null,0,1);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
|
||||
@ -1747,12 +1747,12 @@ class Societe extends CommonObject
|
||||
* Return a link on thirdparty (with picto)
|
||||
*
|
||||
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
|
||||
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
|
||||
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project')
|
||||
* @param int $maxlen Max length of name
|
||||
* @param integer $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0)
|
||||
function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -1795,6 +1795,16 @@ class Societe extends CommonObject
|
||||
$label.= '<u>' . $langs->trans("ShowSupplier") . '</u>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'agenda')
|
||||
{
|
||||
$label.= '<u>' . $langs->trans("ShowAgenda") . '</u>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'project')
|
||||
{
|
||||
$label.= '<u>' . $langs->trans("ShowProject") . '</u>';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'category')
|
||||
{
|
||||
$label.= '<u>' . $langs->trans("ShowCategory") . '</u>';
|
||||
@ -1814,10 +1824,13 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
if (! empty($this->name))
|
||||
{
|
||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> '. $this->name;
|
||||
if (! empty($this->code_client))
|
||||
if (! empty($this->name_alias)) $label.=' ('.$this->name_alias.')';
|
||||
}
|
||||
if (! empty($this->code_client) && $this->client)
|
||||
$label.= '<br><b>' . $langs->trans('CustomerCode') . ':</b> '. $this->code_client;
|
||||
if (! empty($this->code_fournisseur))
|
||||
if (! empty($this->code_fournisseur) && $this->fournisseur)
|
||||
$label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur;
|
||||
|
||||
if (! empty($this->logo))
|
||||
@ -1831,7 +1844,16 @@ class Societe extends CommonObject
|
||||
|
||||
// Add type of canvas
|
||||
$link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
|
||||
$link.=($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip"');
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowCompany");
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.=' class="classfortooltip"';
|
||||
}
|
||||
$link.='>';
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
@ -143,13 +143,13 @@ else
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS))
|
||||
{
|
||||
$statstring = "<tr ".$bc[0].">";
|
||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/comm/prospect/list.php">'.$langs->trans("Prospects").'</a></td><td align="right">'.round($third['prospect']).'</td>';
|
||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td align="right">'.round($third['prospect']).'</td>';
|
||||
$statstring.= "</tr>";
|
||||
}
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS))
|
||||
{
|
||||
$statstring.= "<tr ".$bc[1].">";
|
||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/comm/list.php">'.$langs->trans("Customers").'</a></td><td align="right">'.round($third['customer']).'</td>';
|
||||
$statstring.= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td align="right">'.round($third['customer']).'</td>';
|
||||
$statstring.= "</tr>";
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS))
|
||||
|
||||
@ -31,10 +31,12 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("customers");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -64,10 +66,14 @@ $search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_type=GETPOST('search_type','alpha');
|
||||
$search_status=GETPOST("search_status",'int');
|
||||
$search_level_from = GETPOST("search_level_from","alpha");
|
||||
$search_level_to = GETPOST("search_level_to","alpha");
|
||||
$search_stcomm=GETPOST('search_stcomm','int');
|
||||
|
||||
$type=GETPOST('type');
|
||||
$optioncss=GETPOST('optioncss','alpha');
|
||||
$mode=GETPOST("mode");
|
||||
$action=GETPOST('action');
|
||||
|
||||
$sortfield=GETPOST("sortfield",'alpha');
|
||||
$sortorder=GETPOST("sortorder",'alpha');
|
||||
@ -116,6 +122,7 @@ if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp !=
|
||||
if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -126,6 +133,20 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'setstcomm')
|
||||
{
|
||||
$object = new Client($db);
|
||||
$result=$object->fetch(GETPOST('stcommsocid'));
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
// special search
|
||||
/*if ($mode == 'search')
|
||||
{
|
||||
@ -176,20 +197,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$companystatic=new Societe($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@ -212,14 +219,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_country='';
|
||||
$search_type_thirdparty='';
|
||||
$search_status='';
|
||||
$search_stcomm='';
|
||||
$search_level_from='';
|
||||
$search_level_to='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display active thirdparty first
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Mode List
|
||||
* View
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -230,15 +241,105 @@ if ($search_status=='') $search_status=1; // always display active thirdparty fi
|
||||
External user socid=x + 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);
|
||||
$formother=new FormOther($db);
|
||||
$companystatic=new Societe($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$prospectstatic=new Client($db);
|
||||
$prospectstatic->client=2;
|
||||
$prospectstatic->loadCacheOfProspStatus();
|
||||
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
|
||||
|
||||
$title=$langs->trans("ListOfThirdParties");
|
||||
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 == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers");
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, ";
|
||||
$sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
||||
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4,";
|
||||
$sql.= " s.fk_pays, s.tms as date_update, s.datec as date_creation,";
|
||||
// If both parameters are set, search for everything BETWEEN them
|
||||
if ($search_level_from != '' && $search_level_to != '')
|
||||
{
|
||||
// Ensure that these parameters are numbers
|
||||
$search_level_from = (int) $search_level_from;
|
||||
$search_level_to = (int) $search_level_to;
|
||||
|
||||
// If from is greater than to, reverse orders
|
||||
if ($search_level_from > $search_level_to)
|
||||
{
|
||||
$tmp = $search_level_to;
|
||||
$search_level_to = $search_level_from;
|
||||
$search_level_from = $tmp;
|
||||
}
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range';
|
||||
}
|
||||
// If only "from" parameter is set, search for everything GREATER THAN it
|
||||
else if ($search_level_from != '')
|
||||
{
|
||||
// Ensure that this parameter is a number
|
||||
$search_level_from = (int) $search_level_from;
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range';
|
||||
}
|
||||
// If only "to" parameter is set, search for everything LOWER THAN it
|
||||
else if ($search_level_to != '')
|
||||
{
|
||||
// Ensure that this parameter is a number
|
||||
$search_level_to = (int) $search_level_to;
|
||||
|
||||
// Generate the SQL request
|
||||
$sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range';
|
||||
}
|
||||
// If no parameters are set, dont search for anything
|
||||
else
|
||||
{
|
||||
$sortwhere = '0 as is_in_range';
|
||||
}
|
||||
|
||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||
dol_syslog('societe/list.php',LOG_DEBUG);
|
||||
$sql = "SELECT code, label, sortorder, ".$sortwhere;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql.= " WHERE active > 0";
|
||||
$sql.= " ORDER BY sortorder";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$tab_level = array();
|
||||
$search_levels = array();
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
// Compute level text
|
||||
$level=$langs->trans($obj->code);
|
||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||
|
||||
// Put it in the array sorted by sortorder
|
||||
$tab_level[$obj->sortorder] = $level;
|
||||
|
||||
// If this potentiel fit in parameters, add its code to the $search_levels array
|
||||
if ($obj->is_in_range == 1)
|
||||
{
|
||||
$search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
|
||||
// If no paramters was set, $search_levels will be empty
|
||||
$search_levels = implode(',', $search_levels);
|
||||
}
|
||||
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, ";
|
||||
$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.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,";
|
||||
$sql.= " s.tms as date_update, s.datec as date_creation,";
|
||||
$sql.= " typent.code as typent_code";
|
||||
// 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";
|
||||
@ -291,6 +392,8 @@ if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
|
||||
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
|
||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
@ -348,6 +451,9 @@ if ($resql)
|
||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm;
|
||||
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
||||
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
||||
if ($type != '') $param.='&type='.urlencode($type);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
@ -400,7 +506,7 @@ if ($resql)
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
|
||||
$moreforfilter.=$formother->select_categories('customer',$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
@ -419,7 +525,7 @@ if ($resql)
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1);
|
||||
$moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
}
|
||||
@ -436,16 +542,21 @@ if ($resql)
|
||||
// Define list of fields to show into list
|
||||
$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
|
||||
$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
||||
$checkedcustomeraccountcode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0);
|
||||
$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0);
|
||||
$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0);
|
||||
$checkedtypetiers=1;
|
||||
$checkedprofid1=0;
|
||||
$checkedprofid2=0;
|
||||
$checkedprofid3=0;
|
||||
$checkedprofid4=0;
|
||||
$checkedprofid5=0;
|
||||
$checkedprofid6=0;
|
||||
//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||
//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||
//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
|
||||
$arrayfields=array(
|
||||
$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||
$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0);
|
||||
$arrayfields=array(
|
||||
's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
||||
's.code_client'=>array('label'=>$langs->trans("CustomerCodeShort"), 'checked'=>$checkedcustomercode),
|
||||
@ -456,16 +567,18 @@ if ($resql)
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1),
|
||||
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>1),
|
||||
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1),
|
||||
's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1),
|
||||
's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2),
|
||||
's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>$checkedprofid3),
|
||||
's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4),
|
||||
's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5),
|
||||
's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6),
|
||||
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200),
|
||||
's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel),
|
||||
's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm),
|
||||
's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
);
|
||||
's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
@ -488,7 +601,9 @@ if ($resql)
|
||||
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
|
||||
print_liste_field_titre(''); // type of customer
|
||||
// Extra fields
|
||||
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||
{
|
||||
foreach($extrafields->attribute_list as $key => $val)
|
||||
@ -503,9 +618,9 @@ if ($resql)
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -623,6 +738,7 @@ if ($resql)
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Type (customer/prospect/supplier)
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
print '<select class="flat" name="search_type">';
|
||||
@ -633,29 +749,71 @@ if ($resql)
|
||||
print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
|
||||
print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
|
||||
print '</select></td>';
|
||||
|
||||
if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
|
||||
{
|
||||
// Prospect level
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted
|
||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||
{
|
||||
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
|
||||
$options_from .= $langs->trans($tab_level_label);
|
||||
$options_from .= '</option>';
|
||||
}
|
||||
array_reverse($tab_level, true); // Reverse the list
|
||||
$options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order
|
||||
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
|
||||
{
|
||||
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
|
||||
$options_to .= $langs->trans($tab_level_label);
|
||||
$options_to .= '</option>';
|
||||
}
|
||||
|
||||
// Print these two select
|
||||
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
|
||||
print ' ';
|
||||
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['s.fk_stcomm']['checked']))
|
||||
{
|
||||
// Prospect status
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arraystcomm=array();
|
||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$arraystcomm[$val['id']]=$val['label'];
|
||||
}
|
||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['s.status']['checked']))
|
||||
{
|
||||
// Status
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
}
|
||||
// Date creation
|
||||
if (! empty($arrayfields['s.datec']['checked']))
|
||||
{
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['s.tms']['checked']))
|
||||
{
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['s.status']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
@ -671,18 +829,22 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->status=$obj->status;
|
||||
$companystatic->fournisseur=$obj->fournisseur;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
||||
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
|
||||
$companystatic->name_alias=$obj->name_alias;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->status=$obj->status;
|
||||
$companystatic->fournisseur=$obj->fournisseur;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->code_fournisseur=$obj->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1,'',100);
|
||||
print "</td>\n";
|
||||
}
|
||||
@ -761,6 +923,7 @@ if ($resql)
|
||||
{
|
||||
print "<td>".$obj->idprof6."</td>\n";
|
||||
}
|
||||
// Type
|
||||
print '<td align="center">';
|
||||
$s='';
|
||||
if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
@ -782,28 +945,50 @@ if ($resql)
|
||||
}
|
||||
print $s;
|
||||
print '</td>';
|
||||
if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
|
||||
{
|
||||
// Prospect level
|
||||
print '<td align="center">';
|
||||
print $companystatic->getLibProspLevel();
|
||||
print "</td>";
|
||||
}
|
||||
if (! empty($arrayfields['s.fk_stcomm']['checked']))
|
||||
{
|
||||
// Prospect status
|
||||
print '<td align="center" class="nowrap"><div class="nowrap">';
|
||||
print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
|
||||
print '</div> - <div class="inline-block">';
|
||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt='default';
|
||||
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
|
||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
|
||||
}
|
||||
print '</div></div></td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Status
|
||||
if (! empty($arrayfields['s.status']['checked']))
|
||||
// Date creation
|
||||
if (! empty($arrayfields['s.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$companystatic->getLibStatut(3).'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.datec']['checked']))
|
||||
{
|
||||
// Date creation
|
||||
print '<td align="center">';
|
||||
print dol_print_date($obj->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['s.tms']['checked']))
|
||||
{
|
||||
// Date modification
|
||||
print '<td align="center">';
|
||||
print dol_print_date($obj->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['s.status']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$companystatic->getLibStatut(3).'</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
|
||||
@ -195,6 +195,8 @@ if ($result > 0)
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Add notification form
|
||||
print load_fiche_titre($langs->trans("AddNewNotification"),'','');
|
||||
|
||||
|
||||
@ -172,6 +172,8 @@ print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
@ -429,105 +431,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// View mode
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
}
|
||||
|
||||
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessage($prodcustprice->error, 'errors');
|
||||
}
|
||||
|
||||
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
|
||||
|
||||
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
|
||||
|
||||
if (count($prodcustprice->lines) > 0) {
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans("Product") . '</td>';
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VAT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" class="flat" name="search_soc" value="' . $search_soc . '" size="20"></td>';
|
||||
print '<td colspan="8"> </td>';
|
||||
// Print the search button
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="liste_titre" name="button_search" type="image" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = False;
|
||||
|
||||
foreach($prodcustprice->lines as $line)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
$staticprod = new Product($db);
|
||||
$staticprod->fetch($line->fk_product);
|
||||
|
||||
print "<td>" . $staticprod->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($line->tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||
|
||||
// User
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($line->fk_user);
|
||||
print '<td align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Todo Edit or delete button
|
||||
// Action
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<td align="right">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&socid=' . $object->id . '&prodid=' . $line->fk_product . '">';
|
||||
print img_info();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_edit('default', 0, 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_delete('default', 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
} else {
|
||||
print $langs->trans('None');
|
||||
}
|
||||
// View mode
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
@ -540,7 +444,112 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&socid=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
}
|
||||
print "\n</div><br>\n";
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
}
|
||||
|
||||
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($prodcustprice->error, 'errors');
|
||||
}
|
||||
|
||||
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
|
||||
|
||||
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans("Product") . '</td>';
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("VAT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
{
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" class="flat" name="search_soc" value="' . $search_soc . '" size="20"></td>';
|
||||
print '<td colspan="8"> </td>';
|
||||
// Print the search button
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="liste_titre" name="button_search" type="image" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = False;
|
||||
|
||||
foreach ($prodcustprice->lines as $line)
|
||||
{
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
|
||||
$staticprod = new Product($db);
|
||||
$staticprod->fetch($line->fk_product);
|
||||
|
||||
print "<td>" . $staticprod->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($line->tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||
|
||||
// User
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($line->fk_user);
|
||||
print '<td align="right">';
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Todo Edit or delete button
|
||||
// Action
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&socid=' . $object->id . '&prodid=' . $line->fk_product . '">';
|
||||
print img_info();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_edit('default', 0, 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_delete('default', 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
} else
|
||||
{
|
||||
print '<tr ' . $bc[false] . '><td colspan="10">' . $langs->trans('NoPriceSpecificToCustomer') . '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
156
htdocs/societe/project.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/project.php
|
||||
* \ingroup societe
|
||||
* \brief Page of third party projects
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('projectthirdparty'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
$object = new Societe($db);
|
||||
$result = $object->fetch($socid);
|
||||
|
||||
$title=$langs->trans("Agenda");
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
llxHeader('',$title);
|
||||
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'project', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Alias names (commercial, trademark or alias names)
|
||||
print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
|
||||
print $object->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
||||
print $object->code_client;
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $object->code_fournisseur;
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
if (! empty($conf->projet->enabled) && ! empty($user->rights->projet->creer))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Projects list
|
||||
$result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1);
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1908,7 +1908,17 @@ else
|
||||
print $object->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
// Prefix
|
||||
// Prospect/Customer
|
||||
print '<tr><td>'.$langs->trans('ProspectCustomer').'</td><td>';
|
||||
print $object->getLibCustProspStatut();
|
||||
print '</td></tr>';
|
||||
|
||||
// Prospect/Customer
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td>';
|
||||
print yn($object->fournsseur);
|
||||
print '</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td>'.$object->prefix_comm.'</td>';
|
||||
@ -2481,9 +2491,6 @@ else
|
||||
{
|
||||
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
// Projects list
|
||||
$result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
htdocs/theme/eldy/img/object_building.png
Normal file
|
After Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 912 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 581 B |
@ -699,7 +699,7 @@ div#tmenu_tooltip {
|
||||
<?php if (GETPOST("optioncss") == 'print') { ?>
|
||||
display:none;
|
||||
<?php } else { ?>
|
||||
padding-<?php echo $right; ?>: <? echo ($maxwidthloginblock - 10); ?>px;
|
||||
padding-<?php echo $right; ?>: <?php echo ($maxwidthloginblock - 10); ?>px;
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
@ -888,7 +888,6 @@ div.mainmenu.members {
|
||||
|
||||
div.mainmenu.products {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>);
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
div.mainmenu.project {
|
||||
@ -3877,7 +3876,22 @@ border-top-right-radius: 6px;
|
||||
}
|
||||
@media only screen and (max-width: 570px)
|
||||
{
|
||||
div.mainmenu {
|
||||
/* Reduce login top right info */
|
||||
.usertextatoplogin {
|
||||
display: none;
|
||||
}
|
||||
div#tmenu_tooltip {
|
||||
<?php if (GETPOST("optioncss") == 'print') { ?>
|
||||
display:none;
|
||||
<?php } else { ?>
|
||||
padding-<?php echo $right; ?>: 78px;
|
||||
<?php } ?>
|
||||
}
|
||||
div.login_block {
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
div.mainmenu {
|
||||
min-width: 20px;
|
||||
}
|
||||
.topmenuimage {
|
||||
@ -3887,9 +3901,8 @@ border-top-right-radius: 6px;
|
||||
#tooltip {
|
||||
position: absolute;
|
||||
width: <?php print dol_size(300,'width'); ?>px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
if (is_object($db)) $db->close();
|
||||
|
||||
BIN
htdocs/theme/md/img/object_building.png
Normal file
|
After Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 912 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 581 B |
@ -499,7 +499,7 @@ div.confirmmessage {
|
||||
.maxwidth100 { max-width: 100px; }
|
||||
.maxwidth200 { max-width: 200px; }
|
||||
.maxwidth300 { max-width: 300px; }
|
||||
.titlefield { width: 25%; }
|
||||
.titlefield { width: 30%; }
|
||||
<?php if (! empty($dol_optimize_smallscreen)) { ?>
|
||||
.hideonsmartphone { display: none; }
|
||||
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
|
||||
@ -731,7 +731,7 @@ div#tmenu_tooltip {
|
||||
<?php if (GETPOST("optioncss") == 'print') { ?>
|
||||
display:none;
|
||||
<?php } else { ?>
|
||||
/* padding-<?php echo $right; ?>: <? echo ($maxwidthloginblock - 10); ?>px; */
|
||||
/* padding-<?php echo $right; ?>: <?php echo ($maxwidthloginblock - 10); ?>px; */
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
@ -913,7 +913,6 @@ div.mainmenu.members {
|
||||
|
||||
div.mainmenu.products {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>);
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
div.mainmenu.project {
|
||||
@ -3715,7 +3714,22 @@ border-top-right-radius: 6px;
|
||||
}
|
||||
@media only screen and (max-width: 570px)
|
||||
{
|
||||
div.mainmenu {
|
||||
/* Reduce login top right info */
|
||||
.usertextatoplogin {
|
||||
display: none;
|
||||
}
|
||||
div#tmenu_tooltip {
|
||||
<?php if (GETPOST("optioncss") == 'print') { ?>
|
||||
display:none;
|
||||
<?php } else { ?>
|
||||
/* padding-<?php echo $right; ?>: 78px; */
|
||||
<?php } ?>
|
||||
}
|
||||
div.login_block {
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
div.mainmenu {
|
||||
min-width: 20px;
|
||||
}
|
||||
.topmenuimage {
|
||||
|
||||
@ -722,6 +722,12 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
{
|
||||
print '<input size="30" type="text" name="firstname" value="'.GETPOST('firstname').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Employee','employee',0).'</td><td>';
|
||||
print $form->selectyesno("employee",(isset($_POST['employee'])?GETPOST('employee'):0),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Position/Job
|
||||
@ -1205,6 +1211,11 @@ else
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Employee
|
||||
print '<tr><td>'.$langs->trans("Employee").'</td><td colspan="2">';
|
||||
print yn($object->employee);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>'.$object->job.'</td>';
|
||||
@ -1728,6 +1739,12 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Employee','employee',0).'</td><td>';
|
||||
print $form->selectyesno("employee",$object->employee,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -46,6 +46,7 @@ class User extends CommonObject
|
||||
var $id=0;
|
||||
var $ldap_sid;
|
||||
var $search_sid;
|
||||
var $employee;
|
||||
var $gender;
|
||||
var $email;
|
||||
var $skype;
|
||||
@ -125,13 +126,17 @@ class User extends CommonObject
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// Preference utilisateur
|
||||
// User preference
|
||||
$this->liste_limit = 0;
|
||||
$this->clicktodial_loaded = 0;
|
||||
|
||||
// For cache usage
|
||||
$this->all_permissions_are_loaded = 0;
|
||||
$this->admin=0;
|
||||
|
||||
|
||||
// Force some default values
|
||||
$this->admin = 0;
|
||||
$this->employee = 1;
|
||||
|
||||
$this->conf = new stdClass();
|
||||
$this->rights = new stdClass();
|
||||
$this->rights->user = new stdClass();
|
||||
@ -157,7 +162,7 @@ class User extends CommonObject
|
||||
$login=trim($login);
|
||||
|
||||
// Get user
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
|
||||
$sql.= " u.admin, u.login, u.note,";
|
||||
$sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,";
|
||||
$sql.= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,";
|
||||
@ -223,6 +228,8 @@ class User extends CommonObject
|
||||
$this->ldap_sid = $obj->ldap_sid;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->firstname = $obj->firstname;
|
||||
|
||||
$this->employee = $obj->employee;
|
||||
|
||||
$this->login = $obj->login;
|
||||
$this->gender = $obj->gender;
|
||||
@ -1153,6 +1160,7 @@ class User extends CommonObject
|
||||
// Clean parameters
|
||||
$this->lastname = trim($this->lastname);
|
||||
$this->firstname = trim($this->firstname);
|
||||
$this->employee = $this->employee?$this->employee:0;
|
||||
$this->login = trim($this->login);
|
||||
$this->gender = trim($this->gender);
|
||||
$this->pass = trim($this->pass);
|
||||
@ -1193,6 +1201,7 @@ class User extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||
$sql.= " lastname = '".$this->db->escape($this->lastname)."'";
|
||||
$sql.= ", firstname = '".$this->db->escape($this->firstname)."'";
|
||||
$sql.= ", employee = ".$this->employee;
|
||||
$sql.= ", login = '".$this->db->escape($this->login)."'";
|
||||
$sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
|
||||
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
@ -1816,14 +1825,15 @@ class User extends CommonObject
|
||||
* @param int $width Width of image
|
||||
* @param int $height Height of image
|
||||
* @param string $cssclass Force a css class
|
||||
* @param string $imagesize 'mini', 'small' or '' (original)
|
||||
* @return string String with URL link
|
||||
*/
|
||||
function getPhotoUrl($width, $height, $cssclass='')
|
||||
function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
|
||||
{
|
||||
$result='';
|
||||
|
||||
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
|
||||
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass);
|
||||
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
||||
$result.='</a>';
|
||||
|
||||
return $result;
|
||||
@ -1833,25 +1843,27 @@ class User extends CommonObject
|
||||
* Return a link to the user card (with optionaly the picto)
|
||||
* Use this->id,this->lastname, this->firstname
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo)
|
||||
* @param string $option On what the link point to
|
||||
* @param integer $infologin Add connection info to the tooltip
|
||||
* @param integer $notooltip 1=Disable tooltip
|
||||
* @param integer $infologin Add complete info tooltip
|
||||
* @param integer $notooltip 1=Disable tooltip on picto and name
|
||||
* @param int $maxlen Max length of visible user name
|
||||
* @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
|
||||
* @param string $mode 'firstname'=Show only firstname
|
||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
|
||||
* @param string $morecss Add more css on link
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
|
||||
function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
|
||||
{
|
||||
global $langs, $conf, $db;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
$link = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("User") . '</u>';
|
||||
$label.= '<div width="100%">';
|
||||
@ -1874,7 +1886,7 @@ class User extends CommonObject
|
||||
if (! empty($this->photo))
|
||||
{
|
||||
$label.= '<div class="photointooltip">';
|
||||
$label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip');
|
||||
$label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1);
|
||||
$label.= '</div><div style="clear: both;"></div>';
|
||||
}
|
||||
|
||||
@ -1899,18 +1911,41 @@ class User extends CommonObject
|
||||
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
|
||||
}
|
||||
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
|
||||
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||
$link.= '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$langs->load("users");
|
||||
$label=$langs->trans("ShowUser");
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
$link.= '>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
//if ($withpictoimg == -1) $result.='<div class="nowrap">';
|
||||
$result.=$link;
|
||||
if ($withpictoimg)
|
||||
{
|
||||
$result.=($link.img_object(($notooltip?'':$label), 'user', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
$paddafterimage='';
|
||||
if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"';
|
||||
if ($withpictoimg > 0) $picto='<div class="inline-block valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'</div>';
|
||||
else $picto='<div class="inline-block valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'</div>';
|
||||
$result.=$picto;
|
||||
}
|
||||
$result.= $link . $this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen) . $linkend . $companylink;
|
||||
if (abs($withpictoimg) != 2)
|
||||
{
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block valignmiddle'.($morecss?' usertext'.$morecss:'').'">';
|
||||
if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen);
|
||||
else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen);
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>';
|
||||
}
|
||||
$result.=$linkend;
|
||||
//if ($withpictoimg == -1) $result.='</div>';
|
||||
$result.=$companylink;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2365,7 +2400,7 @@ class User extends CommonObject
|
||||
$this->load_parentof();
|
||||
|
||||
// Init $this->users array
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.entity"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity))))
|
||||
{
|
||||
@ -2396,6 +2431,7 @@ class User extends CommonObject
|
||||
$this->users[$obj->rowid]['email'] = $obj->email;
|
||||
$this->users[$obj->rowid]['gender'] = $obj->gender;
|
||||
$this->users[$obj->rowid]['admin'] = $obj->admin;
|
||||
$this->users[$obj->rowid]['photo'] = $obj->photo;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],"g.entity",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"nb",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
|
||||
@ -82,6 +82,7 @@ foreach($fulltree as $key => $val)
|
||||
{
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->ref=$val['label'];
|
||||
$userstatic->login=$val['login'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
$userstatic->lastname=$val['lastname'];
|
||||
$userstatic->statut=$val['statut'];
|
||||
@ -90,6 +91,7 @@ foreach($fulltree as $key => $val)
|
||||
$userstatic->societe_id=$val['fk_soc'];
|
||||
$userstatic->admin=$val['admin'];
|
||||
$userstatic->entity=$val['entity'];
|
||||
$userstatic->photo=$val['photo'];
|
||||
|
||||
$entity=$val['entity'];
|
||||
$entitystring='';
|
||||
@ -111,7 +113,7 @@ foreach($fulltree as $key => $val)
|
||||
}
|
||||
}
|
||||
|
||||
$li=$userstatic->getNomUrl(1,'',0,1);
|
||||
$li=$userstatic->getNomUrl(-1,'',0,1);
|
||||
if (! empty($conf->multicompany->enabled) && $userstatic->admin && ! $userstatic->entity)
|
||||
{
|
||||
$li.=img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||
@ -121,12 +123,12 @@ foreach($fulltree as $key => $val)
|
||||
$li.=img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
$li.=' ('.$val['login'].($entitystring?' - '.$entitystring:'').')';
|
||||
|
||||
|
||||
$data[] = array(
|
||||
'rowid'=>$val['rowid'],
|
||||
'fk_menu'=>$val['fk_user'],
|
||||
'statut'=>$val['statut'],
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$li.'</td><td align="right" class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$userstatic->getLibStatut(5).'</td></tr></table>'
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$li.'</td><td align="right" class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$userstatic->getLibStatut(3).'</td></tr></table>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,8 @@ $search_lastname=GETPOST('search_lastname','alpha');
|
||||
$search_firstname=GETPOST('search_firstname','alpha');
|
||||
$search_statut=GETPOST('search_statut','alpha');
|
||||
$search_thirdparty=GETPOST('search_thirdparty','alpha');
|
||||
$search_supervisor=GETPOST('search_supervisor','alpha');
|
||||
$search_previousconn=GETPOST('search_previousconn','alpha');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
if ($search_statut == '') $search_statut='1';
|
||||
@ -62,6 +64,14 @@ $limit = $conf->liste_limit;
|
||||
if (! $sortfield) $sortfield="u.login";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('userlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('user');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
$userstatic=new User($db);
|
||||
$companystatic = new Societe($db);
|
||||
$form = new Form($db);
|
||||
@ -74,8 +84,35 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_firstname="";
|
||||
$search_statut="";
|
||||
$search_thirdparty="";
|
||||
$search_supervisor="";
|
||||
$search_datelastlogin="";
|
||||
$search_datepreviouslogin="";
|
||||
$search_date_creation="";
|
||||
$search_date_update="";
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'u.login'=>"Login",
|
||||
'u.firstname'=>"Firstname",
|
||||
'u.lastname'=>"Lastname",
|
||||
'u.accountancy_code'=>"AccountancyCode",
|
||||
'u.email'=>"EMail",
|
||||
'u.note'=>"Note"
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -87,13 +124,18 @@ $buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($sear
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfUsers"), $buttonviewhierarchy);
|
||||
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.gender,";
|
||||
$sql.= " u.datec,";
|
||||
$sql.= " u.tms as datem,";
|
||||
$sql.= " u.datelastlogin,";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.gender, u.photo,";
|
||||
$sql.= " u.datelastlogin, u.datepreviouslogin,";
|
||||
$sql.= " u.ldap_sid, u.statut, u.entity,";
|
||||
$sql.= " u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2,";
|
||||
$sql.= " u.tms as date_update, u.datec as date_creation,";
|
||||
$sql.= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2,";
|
||||
$sql.= " s.nom as name, s.canvas";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
|
||||
@ -106,14 +148,33 @@ else
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
|
||||
}
|
||||
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
|
||||
if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
|
||||
if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
|
||||
if ($search_supervisor > 0) $sql.= " AND u.fk_user = ".$search_supervisor;
|
||||
if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_thirdparty);
|
||||
if ($search_login != '') $sql.= natural_search("u.login", $search_login);
|
||||
if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname);
|
||||
if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname);
|
||||
if ($search_login != '') $sql.= natural_search("u.login", $search_login);
|
||||
if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname);
|
||||
if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname);
|
||||
if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")";
|
||||
if ($sall) $sql.= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $sall);
|
||||
if ($sall) $sql.= natural_search($fieldstosearchall, $sall);
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
//$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -121,54 +182,153 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if ($sall != '') $param.='&sall='.urlencode($sall);
|
||||
if ($search_user != '') $param.="&search_user=".$search_user;
|
||||
if ($search_login != '') $param.="&search_login=".$search_login;
|
||||
if ($search_lastname != '') $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_firstname != '') $param.="&search_firstname=".$search_firstname;
|
||||
if ($search_supervisor > 0) $param.="&search_supervisor=".$search_supervisor;
|
||||
if ($search_statut != '') $param.="&search_statut=".$search_statut;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
$param="search_user=".$search_user."&sall=".$sall;
|
||||
$param.="&search_statut=".$search_statut;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
$arrayfields=array(
|
||||
'u.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'u.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'u.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
|
||||
'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1),
|
||||
'u.datelastlogin'=>array('label'=>$langs->trans("LastConnexion"), 'checked'=>1, 'position'=>100),
|
||||
'u.datepreviouslogin'=>array('label'=>$langs->trans("PreviousConnexion"), 'checked'=>0, 'position'=>110),
|
||||
'u.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'u.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'u.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER['PHP_SELF'],"u.datec",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"u.statut",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u.fk_user",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
|
||||
{
|
||||
foreach($extrafields->attribute_list as $key => $val)
|
||||
{
|
||||
if ($val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['u.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"u.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Search bar
|
||||
$colspan=3;
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) $colspan++;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_login" size="6" value="'.$search_login.'"></td>';
|
||||
print '<td><input type="text" name="search_lastname" size="6" value="'.$search_lastname.'"></td>';
|
||||
print '<td><input type="text" name="search_firstname" size="6" value="'.$search_firstname.'"></td>';
|
||||
print '<td><input type="text" name="search_thirdparty" size="6" value="'.$search_thirdparty.'"></td>';
|
||||
print '<td colspan="'.$colspan.'"> </td>';
|
||||
|
||||
// Status
|
||||
print '<td align="right">';
|
||||
print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td><input type="text" name="search_login" size="6" value="'.$search_login.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.lastname']['checked']))
|
||||
{
|
||||
print '<td><input type="text" name="search_lastname" size="6" value="'.$search_lastname.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.firstname']['checked']))
|
||||
{
|
||||
print '<td><input type="text" name="search_firstname" size="6" value="'.$search_firstname.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.fk_soc']['checked']))
|
||||
{
|
||||
print '<td><input type="text" name="search_thirdparty" size="6" value="'.$search_thirdparty.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.entity']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.fk_user']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.datelastlogin']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.datepreviouslogin']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['u.datec']['checked']))
|
||||
{
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.tms']['checked']))
|
||||
{
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.statut']['checked']))
|
||||
{
|
||||
// Status
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$user2=new User($db);
|
||||
|
||||
$var=True;
|
||||
//while ($i < min($num,$conf->liste_limit))
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -181,89 +341,152 @@ if ($result)
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->gender=$obj->gender;
|
||||
$userstatic->societe_id=$obj->fk_soc;
|
||||
$userstatic->firstname='';
|
||||
$userstatic->lastname=$obj->login;
|
||||
|
||||
$li=$userstatic->getNomUrl(1,'',0,0,24,1);
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->photo=$obj->photo;
|
||||
|
||||
$li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login');
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
print $li;
|
||||
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||
}
|
||||
else if ($obj->admin)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.ucfirst($obj->lastname).'</td>';
|
||||
print '<td>'.ucfirst($obj->firstname).'</td>';
|
||||
print "<td>";
|
||||
if ($obj->fk_soc)
|
||||
{
|
||||
$companystatic->id=$obj->fk_soc;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else if ($obj->ldap_sid)
|
||||
{
|
||||
print $langs->trans("DomainUser");
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("InternalUser");
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $li;
|
||||
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||
}
|
||||
else if ($obj->admin)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.lastname']['checked']))
|
||||
{
|
||||
print '<td>'.ucfirst($obj->lastname).'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.firstname']['checked']))
|
||||
{
|
||||
print '<td>'.ucfirst($obj->firstname).'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.fk_soc']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
if ($obj->fk_soc)
|
||||
{
|
||||
$companystatic->id=$obj->fk_soc;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
else if ($obj->ldap_sid)
|
||||
{
|
||||
print $langs->trans("DomainUser");
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("InternalUser");
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Multicompany enabled
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))
|
||||
{
|
||||
print '<td>';
|
||||
if (! $obj->entity)
|
||||
{
|
||||
print $langs->trans("AllEntities");
|
||||
}
|
||||
else
|
||||
{
|
||||
// $mc is defined in conf.class.php if multicompany enabled.
|
||||
if (is_object($mc))
|
||||
{
|
||||
$mc->getInfo($obj->entity);
|
||||
print $mc->label;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (! empty($arrayfields['u.entity']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if (! $obj->entity)
|
||||
{
|
||||
print $langs->trans("AllEntities");
|
||||
}
|
||||
else
|
||||
{
|
||||
// $mc is defined in conf.class.php if multicompany enabled.
|
||||
if (is_object($mc))
|
||||
{
|
||||
$mc->getInfo($obj->entity);
|
||||
print $mc->label;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Date creation
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datec),"dayhour").'</td>';
|
||||
|
||||
// Supervisor
|
||||
if (! empty($arrayfields['u.fk_user']['checked']))
|
||||
{
|
||||
// Resp
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->login2)
|
||||
{
|
||||
$user2->id=$obj->id2;
|
||||
$user2->login=$obj->login2;
|
||||
$user2->lastname=$obj->lastname2;
|
||||
$user2->firstname=$obj->firstname2;
|
||||
$user2->gender=$obj->gender2;
|
||||
$user2->photo=$obj->photo2;
|
||||
$user2->admin=$obj->admin2;
|
||||
$user2->email=$obj->email2;
|
||||
$user2->societe_id=$obj->fk_soc2;
|
||||
print $user2->getNomUrl(-1,'',0,0,24,0,'');
|
||||
if (! empty($conf->multicompany->enabled) && $obj->admin2 && ! $obj->entity2)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||
}
|
||||
else if ($obj->admin2)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Date last login
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datelastlogin),"dayhour").'</td>';
|
||||
|
||||
// Resp
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($obj->login2)
|
||||
if (! empty($arrayfields['u.datelastlogin']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datelastlogin),"dayhour").'</td>';
|
||||
}
|
||||
// Date previous login
|
||||
if (! empty($arrayfields['u.datepreviouslogin']['checked']))
|
||||
{
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").'</td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['u.datec']['checked']))
|
||||
{
|
||||
$user2->login=$obj->login2;
|
||||
//$user2->lastname=$obj->lastname2;
|
||||
//$user2->firstname=$obj->firstname2;
|
||||
$user2->lastname=$user2->login;
|
||||
$user2->firstname='';
|
||||
print $user2->getNomUrl(1);
|
||||
print '<td align="center">';
|
||||
print dol_print_date($obj->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
// Date modification
|
||||
if (! empty($arrayfields['u.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($obj->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['u.statut']['checked']))
|
||||
{
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
|
||||
// Statut
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td align="right">'.$userstatic->getLibStatut(5).'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print "</form>\n";
|
||||
$db->free($result);
|
||||
|
||||