Merge branch 'develop' of git://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
philippe grand 2015-11-21 04:52:19 +01:00
commit 928c44b04f
47 changed files with 587 additions and 648 deletions

View File

@ -365,7 +365,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);

View File

@ -376,7 +376,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);

View File

@ -112,7 +112,7 @@ class Commande extends CommonOrder
var $nbtodolate;
/**
* ERR Not engouch stock
* ERR Not enough stock
*/
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
@ -3315,7 +3315,7 @@ class Commande extends CommonOrder
/**
* Class to mange order lines
* Class to manage order lines
*/
class OrderLine extends CommonOrderLine
{

View File

@ -312,13 +312,14 @@ if ($resql)
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($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>';
}

View File

@ -2212,7 +2212,7 @@ class Facture extends CommonInvoice
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();

View File

@ -327,14 +327,15 @@ if ($resql)
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
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>';
}

View File

@ -200,13 +200,14 @@ if ($resql)
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($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>';
}

View File

@ -4105,7 +4105,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key,$value);
break;
case "edit":
$out .= $extrafields->showInputField($key,$value,'',$keyprefix);
$out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id);
break;
}

View File

@ -636,10 +636,11 @@ class ExtraFields
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param int $showsize Value for size attribute
* @param int $showsize Value for size attributed
* @param int $objectid Current object id
* @return string
*/
function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0)
function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0, $objectid=0)
{
global $conf,$langs;
@ -805,6 +806,17 @@ class ExtraFields
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
if (!empty($InfoFieldList[4]))
{
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
}
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
} else {
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
}
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra')!==false)
{
@ -820,7 +832,11 @@ class ExtraFields
{
$sqlwhere.= ' WHERE 1';
}
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0],array('tablewithentity')))
{
$sqlwhere.= ' AND entity = '.$conf->entity;
}
$sql.=$sqlwhere;
//print $sql;
@ -978,6 +994,19 @@ class ExtraFields
$sql = 'SELECT ' . $keyList;
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
if (! empty($InfoFieldList[4])) {
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
}
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
} else {
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
}
// We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
@ -988,12 +1017,14 @@ class ExtraFields
} else {
$sqlwhere .= ' WHERE 1';
}
if (in_array($InfoFieldList[0], array (
'tablewithentity'
)))
$sqlwhere .= ' AND entity = ' . $conf->entity; // Some tables may have field, some other not. For the moment we disable it.
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql;
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array ('tablewithentity')))
{
$sqlwhere .= ' AND entity = ' . $conf->entity;
}
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql;
$sql .= $sqlwhere;
dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -22,35 +22,6 @@
*/
$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
*

View File

@ -135,6 +135,12 @@ function product_prepare_head($object)
complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove');
// Log
$head[$h][0] = DOL_URL_ROOT.'/product/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
return $head;
}

View File

@ -17,7 +17,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
-- Home - Setup
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__);
@ -299,6 +299,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Members - Category member
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->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->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->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- HRM - Employee
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->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/index.php?&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->hrm->employee->read', '', 0, 1, __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->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?&action=create', 'NewEmployee', 1, 'hrm', '$user->rights->hrm->employee->write', '', 0, 1, __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->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/index.php?$leftmenu=hrm&mode=employee', 'List', 1, 'hrm', '$user->rights->hrm->employee->read', '', 0, 2, __ENTITY__);
-- HRM - Holiday
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->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __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->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);

View File

@ -196,9 +196,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
}
// HRM
$tmpentry=array('enabled'=>(! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)),
'perms'=>(! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)),
'module'=>'holiday|deplacement|expensereport');
$tmpentry=array('enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)),
'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)),
'module'=>'hrm|holiday|deplacement|expensereport');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
@ -720,7 +720,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire);
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire);
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire);
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("StatusOrderBilled"), 2, $user->rights->fournisseur->commande->lire);
$newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&amp;mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
}
@ -1229,6 +1230,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
*/
if ($mainmenu == 'hrm')
{
// HRM module
if (! empty($conf->hrm->enabled))
{
$langs->load("hrm");
$newmenu->add("/user/index.php?&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
$newmenu->add("/user/card.php?&action=create", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write);
$newmenu->add("/user/index.php?&leftmenu=hrm&mode=employee", $langs->trans("List"), 1,$user->rights->hrm->employee->read);
}
// Leave/Holiday/Vacation module
if (! empty($conf->holiday->enabled))
{

View File

@ -77,7 +77,7 @@ class modHRM extends DolibarrModules
); // Minimum version of PHP required by module
$this->need_dolibarr_version = array (
3,
7
8
); // Minimum version of Dolibarr required by module
$this->langfiles = array (
"hrm"
@ -91,8 +91,8 @@ class modHRM extends DolibarrModules
MAIN_DB_PREFIX."c_hrm_function"
),
'tablib'=>array(
"DepartmentDict",
"FunctionDict"
"DictionaryDepartment",
"DictionaryFunction"
),
'tabsql'=>array(
'SELECT rowid, pos, code, label, active FROM '.MAIN_DB_PREFIX.'c_hrm_department',
@ -166,67 +166,6 @@ class modHRM extends DolibarrModules
// 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 ++;
}
/**

View File

@ -81,7 +81,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print $extrafields->showInputField($key, $value,'','','',0,$object->id);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';

View File

@ -101,6 +101,7 @@ class InterfaceDemo extends DolibarrTriggers
case 'PRODUCT_DELETE':
case 'PRODUCT_PRICE_MODIFY':
case 'PRODUCT_SET_MULTILANGS':
case 'PRODUCT_DEL_MULTILANGS':
//Stock mouvement
case 'STOCK_MOVEMENT':

View File

@ -366,8 +366,10 @@ if ($object->id > 0)
$sql2.= ' AND s.rowid = '.$object->id;
// Show orders with status validated, shipping started and delivered (well any order we can bill)
$sql2.= " AND c.fk_statut IN (5)";
$sql2.= " AND c.billed = 0";
// Find order that are not already invoiced
$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
// just need to check received status because we have the billed status now
//$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
$resql2=$db->query($sql2);
if ($resql2) {
$orders2invoice = $db->num_rows($resql2);

View File

@ -140,6 +140,7 @@ class CommandeFournisseur extends CommonOrder
$this->statuts[5] = 'StatusOrderReceivedAll';
$this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled
$this->statuts[7] = 'StatusOrderCanceled'; // Process running->canceled
$this->statuts[8] = 'StatusOrderBilled'; // Everything is finish, order received totally and bill received
$this->statuts[9] = 'StatusOrderRefused';
}
@ -164,7 +165,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,";
$sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
$sql.= " c.fk_account,";
$sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,";
$sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,";
$sql.= " cm.libelle as methode_commande,";
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle";
@ -197,6 +198,7 @@ class CommandeFournisseur extends CommonOrder
$this->socid = $obj->fk_soc;
$this->fourn_id = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->billed = $obj->billed;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_approve_id = $obj->fk_user_approve;
@ -217,7 +219,6 @@ class CommandeFournisseur extends CommonOrder
$this->methode_commande = $obj->methode_commande;
$this->source = $obj->source;
//$this->facturee = $obj->facture;
$this->fk_project = $obj->fk_project;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
@ -250,6 +251,7 @@ class CommandeFournisseur extends CommonOrder
if ($this->statut == 0) $this->brouillon = 1;
$this->fetchObjectLinked();
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,";
$sql.= " l.qty,";
@ -510,6 +512,8 @@ class CommandeFournisseur extends CommonOrder
global $langs;
$langs->load('orders');
if($statut==5 && $this->billed == 1) $statut = 8;
// List of language codes for status
$statutshort[0] = 'StatusOrderDraftShort';
$statutshort[1] = 'StatusOrderValidatedShort';
@ -519,6 +523,7 @@ class CommandeFournisseur extends CommonOrder
$statutshort[5] = 'StatusOrderReceivedAllShort';
$statutshort[6] = 'StatusOrderCanceledShort';
$statutshort[7] = 'StatusOrderCanceledShort';
$statutshort[8] = 'StatusOrderBilledShort';
$statutshort[9] = 'StatusOrderRefusedShort';
if ($mode == 0)
@ -542,6 +547,7 @@ class CommandeFournisseur extends CommonOrder
if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3');
if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6');
if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5');
if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6');
if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5');
}
if ($mode == 4)
@ -553,6 +559,7 @@ class CommandeFournisseur extends CommonOrder
if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]);
if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 5)
@ -564,6 +571,7 @@ class CommandeFournisseur extends CommonOrder
if ($statut==4) return '<span class="hideonsmartphone">'.$langs->trans($statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut3');
if ($statut==5) return '<span class="hideonsmartphone">'.$langs->trans($statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut6');
if ($statut==6 || $statut==7) return '<span class="hideonsmartphone">'.$langs->trans($statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut5');
if ($statut==8) return '<span class="hideonsmartphone">'.$langs->trans($statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut6');
if ($statut==9) return '<span class="hideonsmartphone">'.$langs->trans($statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut5');
}
}
@ -660,6 +668,26 @@ class CommandeFournisseur extends CommonOrder
return -2;
}
}
/**
* Class invoiced the supplier order
*
* @return int <0 si ko, >0 si ok
*/
function classifyBilled()
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ';
if ($this->db->query($sql) )
{
$this->billed=1;
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Approve a supplier order

View File

@ -234,6 +234,17 @@ if (empty($reshook))
}
}
/*
* Classify supplier order as billed
*/
if ($action == 'classifybilled' && $user->rights->fournisseur->commande->creer)
{
$ret=$object->classifyBilled();
if ($ret < 0) {
setEventMessage($object->error, 'errors');
}
}
/*
* Add a line into product
*/
@ -2725,18 +2736,19 @@ elseif (! empty($object->id))
// Create bill
if (! empty($conf->facture->enabled))
{
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 9)) // 2 means accepted
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // 2 means accepted
{
if ($user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
//if ($user->rights->fournisseur->commande->creer && $object->statut > 2)
//{
// print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
//}
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
}
}
// Create a remote order using WebService only if module is activated

View File

@ -167,6 +167,12 @@ if (GETPOST('statut', 'alpha') !== '')
{
$sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")";
}
if (GETPOST('billed', 'int') !== '')
{
$sql .= " AND cf.billed IN (".GETPOST('billed', 'int').")";
}
if ($search_refsupp)
{
$sql.= " AND (cf.ref_supplier LIKE '%".$db->escape($search_refsupp)."%')";

View File

@ -236,9 +236,32 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
// End of object creation, we show it
if ($id > 0 && ! $error) {
$db->commit();
header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id);
exit();
foreach($orders_id as $fk_supplier_order) {
$supplier_order = new CommandeFournisseur($db);
if($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5) {
if($supplier_order->classifyBilled()<0) {
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"];
$mesgs[] = '<div class="error">' . $object->error . '</div>';
$error++;
break;
}
}
}
if(!$error) {
$db->commit();
header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id);
exit();
}
} else {
$db->rollback();
$action = 'create';
@ -406,9 +429,11 @@ if (($action != 'create' && $action != 'add') && !$error) {
// Show orders with status validated, shipping started and delivered (well any order we can bill)
$sql .= " AND c.fk_statut IN (5)";
$sql .= " AND c.billed = 0";
// Find order that are not already invoiced
$sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
//No need due to the billed status
//$sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
if ($socid)
$sql .= ' AND s.rowid = ' . $socid;

View File

@ -226,13 +226,12 @@ $formother = new FormOther($db);
if ($id > 0)
{
$head = user_prepare_head($fuser);
$title = $langs->trans("User");
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
$head = user_prepare_head($fuser);
dol_fiche_head($head, 'paidholidays', $title, 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin);

View File

@ -22,7 +22,6 @@
*/
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");

View File

@ -25,22 +25,43 @@ 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');
$langs->load("hrm");
if (! $user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
// Other parameters HRM_*
$list = array (
'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example
);
/*
* Actions
*/
if ($action == 'update') {
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$page_name = "Parameters";
llxHeader('', $langs->trans($page_name));
llxHeader('', $langs->trans('Parameters'));
$form = new Form($db);
@ -52,7 +73,40 @@ print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
// Configuration header
$head = hrm_admin_prepare_head();
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user");
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('Journaux') . '</td>';
print "</tr>\n";
foreach ( $list as $key ) {
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
$label = $langs->trans($key);
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td></tr>';
}
print "</table>\n";
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
print '</form>';
llxFooter();
$db->close();

View File

@ -1,241 +0,0 @@
<?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/employee.class.php
* \ingroup HRM
* \brief File of class to manage employees
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* Class to manage establishments
*/
class Employee extends CommonObject
{
public $element='employee';
public $table_element='user';
public $table_element_line = '';
public $fk_element = 'fk_user';
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;
}
/**
* Load an object from database
*
* @param int $id Id of record to load
* @return int <0 if KO, >0 if OK
*/
function fetch($id='')
{
global $conf, $user;
$sql = "SELECT e.rowid, e.firstname, e.lastname, e.gender, e.email, e.statut, e.entity, e.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."user as e";
$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);
if ($obj)
{
$this->id = $obj->rowid;
$this->lastname = $obj->lastname;
$this->firstname = $obj->firstname;
$this->gender = $obj->gender;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->statut = $obj->statut;
$this->photo = $obj->photo;
$this->db->free($result);
}
else
{
$this->error="EMPLOYEENOTFOUND";
dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG);
$this->db->free($result);
return 0;
}
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Return a link to the employee card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
* @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 $notooltip 1=Disable tooltip on picto and name
* @param int $maxlen Max length of visible employee name
* @param int $hidethirdpartylogo Hide logo of thirdparty
* @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($withpictoimg=0, $option='', $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
{
global $langs, $conf;
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
$result = '';
$companylink = '';
$link = '';
$label = '<u>' . $langs->trans("Employee") . '</u>';
$label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
$label.= '<br><b>' . $langs->trans("EMail").':</b> '.$this->email;
$label.='</div>';
if (! empty($this->photo))
{
$label.= '<div class="photointooltip">';
$label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1);
$label.= '</div><div style="clear: both;"></div>';
}
$link.= '<a href="'.DOL_URL_ROOT.'/hrm/employee/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 ($withpictoimg == -1) $result.='<div class="nowrap">';
$result.=$link;
if ($withpictoimg)
{
$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;
}
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;
}
/**
* Return status label of an employee
*
* @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 of status
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Return label of given status
*
* @param int $statut Id statut
* @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 of status
*/
function LibStatut($statut,$mode=0)
{
global $langs;
$langs->load('users');
if ($mode == 0)
{
$prefix='';
if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled');
}
if ($mode == 1)
{
if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled');
}
if ($mode == 2)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
}
if ($mode == 3)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
}
if ($mode == 4)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
}
if ($mode == 5)
{
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
}
}
}

View File

@ -1,222 +0,0 @@
<?php
/* Copyright (C) 2002-2005 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) 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/employee/list.php
* \ingroup core
* \brief Page of users
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/hrm/class/employee.class.php';
if (! $user->rights->hrm->employee->read)
accessforbidden();
$langs->load("users");
$langs->load("companies");
$langs->load("hrm");
// Security check (for external users)
$socid=0;
if ($user->societe_id > 0)
$socid = $user->societe_id;
$sall=GETPOST('sall','alpha');
$search_user=GETPOST('search_user','alpha');
$search_login=GETPOST('search_login','alpha');
$search_lastname=GETPOST('search_lastname','alpha');
$search_firstname=GETPOST('search_firstname','alpha');
$search_statut=GETPOST('search_statut','alpha');
$search_thirdparty=GETPOST('search_thirdparty','alpha');
$optioncss = GETPOST('optioncss','alpha');
if ($search_statut == '') $search_statut='1';
$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;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="u.login";
if (! $sortorder) $sortorder="ASC";
$employeestatic = new Employee($db);
$companystatic = new Societe($db);
$form = new Form($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))
{
$search_user="";
$search_login="";
$search_lastname="";
$search_firstname="";
$search_statut="";
$search_thirdparty="";
}
/*
* View
*/
llxHeader('',$langs->trans("ListOfEmployees"));
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/hrm/employee/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
print load_fiche_titre($langs->trans("ListOfEmployees"), $buttonviewhierarchy);
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email, u.gender,";
$sql.= " u.datec,";
$sql.= " u.tms as datem,";
$sql.= " u.ldap_sid, u.statut, u.entity,";
$sql.= " u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2,";
$sql.= " s.nom as name, s.canvas";
$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";
$sql.= " WHERE u.employee >= '1'";
$sql.= " AND 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_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_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);
$sql.=$db->order($sortfield,$sortorder);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
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 '<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);
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("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="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Search bar
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>&nbsp;</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")).'">';
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";
$employee2=new Employee($db);
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
$employeestatic->id=$obj->rowid;
$employeestatic->ref=$obj->label;
$employeestatic->login=$obj->login;
$employeestatic->statut=$obj->statut;
$employeestatic->email=$obj->email;
$employeestatic->gender=$obj->gender;
$employeestatic->societe_id=$obj->fk_soc;
$employeestatic->firstname=$obj->firstname;
$employeestatic->lastname=$obj->lastname;
$li=$employeestatic->getNomUrl(1,'',0,0,24,1);
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>';
// Resp
print '<td class="nowrap" align="center">';
if ($obj->login2)
{
$employee2->login=$obj->login2;
//$employee2->lastname=$obj->lastname2;
//$employee2->firstname=$obj->firstname2;
$employee2->lastname=$employee2->login;
$employee2->firstname='';
print $employee2->getNomUrl(1);
}
print '</td>';
// Statut
print '<td align="center">'.$employeestatic->getLibStatut(5).'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
print "</table>";
print "</form>\n";
$db->free($result);
}
else
{
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -432,14 +432,17 @@ foreach($dashboardlines as $tmp)
}
$rowspan = count($valid_dashboardlines);
// We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop
foreach($valid_dashboardlines as $board)
{
if ($board->nbtodolate > 0) {
$totallate += $board->nbtodolate;
}
}
// Show dashboard
// Show dashboard
foreach($valid_dashboardlines as $board)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="16">'.$board->img.'</td><td>'.$board->label.'</td>';
print '<td align="right"><a href="'.$board->url.'">'.$board->nbtodo.'</a></td>';

View File

@ -9,8 +9,10 @@
-- 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 drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum 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;
@ -77,7 +79,8 @@ ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL DEFAULT '' AFTER ro
ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL DEFAULT '';
UPDATE llx_user_param SET param='ToDelete' WHERE param IS NULL;
ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL;
ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL;
ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14);
@ -91,6 +94,9 @@ ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method;
ALTER TABLE llx_commande_fournisseur ADD COLUMN billed smallint DEFAULT 0 AFTER fk_statut;
ALTER TABLE llx_commande_fournisseur ADD INDEX billed (billed);
ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750);
ALTER TABLE llx_ecm_directories DROP INDEX idx_ecm_directories;
ALTER TABLE llx_ecm_directories ADD UNIQUE INDEX uk_ecm_directories (label, fk_parent, entity);
@ -318,7 +324,8 @@ ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_fk_project
ALTER TABLE llx_c_tva ADD COLUMN code varchar(10) DEFAULT '' after fk_pays;
DROP INDEX uk_c_tva_id ON llx_c_tva;
-- VMYSQL4.0 DROP INDEX uk_c_tva_id ON llx_c_tva;
-- VPGSQL8.0 DROP INDEX uk_c_tva_id;
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, taux, recuperableonly);
-- Regions Bolivia (id country=52)

View File

@ -25,3 +25,4 @@ ALTER TABLE llx_commande_fournisseur ADD UNIQUE INDEX uk_commande_fournisseur_re
ALTER TABLE llx_commande_fournisseur ADD INDEX idx_commande_fournisseur_fk_soc (fk_soc);
ALTER TABLE llx_commande_fournisseur ADD CONSTRAINT fk_commande_fournisseur_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_commande_fournisseur ADD INDEX billed (billed);

View File

@ -45,6 +45,7 @@ create table llx_commande_fournisseur
fk_user_approve2 integer, -- user approving 2 (when double approving is accivated)
source smallint NOT NULL, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
fk_statut smallint default 0,
billed smallint default 0,
amount_ht real default 0,
remise_percent real default 0,
remise real default 0,

View File

@ -58,11 +58,11 @@ create table llx_product
duration varchar(6),
seuil_stock_alerte integer DEFAULT 0,
url varchar(255),
barcode varchar(255) DEFAULT NULL,
fk_barcode_type integer DEFAULT NULL,
barcode varchar(255) DEFAULT NULL, -- barcode
fk_barcode_type integer DEFAULT NULL, -- barcode type
accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_buy varchar(32), -- Buying accountancy code
partnumber varchar(32), -- Not used. Used by external modules.
partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode.
weight float DEFAULT NULL,
weight_units tinyint DEFAULT NULL,
length float DEFAULT NULL,

View File

@ -397,8 +397,8 @@ ExtrafieldLink=Link to an object
ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another :<br>1,value1|parent_list_code:parent_key<br>2,value2|parent_list_code:parent_key
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php
LibraryToBuildPDF=Library used to build PDF
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>

View File

@ -1,6 +1,7 @@
# Dolibarr language file - en_US - hrm
CHARSET=UTF-8
# Admin
HRM_EMAIL_EXTERNAL_SERVICE=Email to prevent HRM external service
Establishments=Establishments
Establishment=Establishment
NewEstablishment=New establishment
@ -8,7 +9,12 @@ DeleteEstablishment=Delete establishment
ConfirmDeleteEstablishment=Are-you sure to delete this establishment ?
OpenEtablishment=Open establishment
CloseEtablishment=Close establishment
# Dictionary
DictionaryDepartment=HRM - Department list
DictionaryFunction=HRM - Function list
# Module
ListOfEmployees=List of employees
Employees=Employees
Employee=Employee
NewEmployee=New employee
EmployeeCard=Employee card

View File

@ -35,6 +35,7 @@ StatusOrderToBillShort=Delivered
StatusOrderToBill2Short=To bill
StatusOrderApprovedShort=Approved
StatusOrderRefusedShort=Refused
StatusOrderBilledShort=Billed
StatusOrderToProcessShort=To process
StatusOrderReceivedPartiallyShort=Partially received
StatusOrderReceivedAllShort=Everything received
@ -48,6 +49,7 @@ StatusOrderToBill=Delivered
StatusOrderToBill2=To bill
StatusOrderApproved=Approved
StatusOrderRefused=Refused
StatusOrderBilled=Billed
StatusOrderReceivedPartially=Partially received
StatusOrderReceivedAll=Everything received
ShippingExist=A shipment exists

View File

@ -1011,8 +1011,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
else print "<title>".dol_htmlentities($appli)."</title>";
print "\n";
$ext='';
if (! empty($conf->dol_use_jmobile)) $ext='version='.urlencode(DOL_VERSION);
//$ext='';
//if (! empty($conf->dol_use_jmobile)) $ext='version='.urlencode(DOL_VERSION);
$ext='version='.urlencode(DOL_VERSION);
if (GETPOST('version')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js
if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
@ -1268,7 +1269,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// Global js function
print '<!-- Includes JS of Dolibarr -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js?version='.urlencode(DOL_VERSION).($ext?'&amp;'.$ext:'').'"></script>'."\n";
// Add datepicker default options
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/datepicker.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n";

View File

@ -1305,7 +1305,7 @@ else
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'card', $titre, 0, $picto);
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
dol_banner_tab($object, 'id', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';

View File

@ -726,6 +726,7 @@ class Product extends CommonObject
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);
$sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL');
$sql.= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
$sql.= " WHERE rowid = " . $id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -1067,9 +1068,11 @@ class Product extends CommonObject
* Delete a language for this product
*
* @param string $langtodelete Language code to delete
* @param User $user Object user making delete
*
* @return int <0 if KO, >0 if OK
*/
function delMultiLangs($langtodelete)
function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang";
$sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
@ -1078,6 +1081,14 @@ class Product extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
// Call trigger
$result = $this->call_trigger('PRODUCT_DEL_MULTILANGS',$user);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
// End call triggers
return 1;
}
else
@ -4113,4 +4124,52 @@ class Product extends CommonObject
return $user->rights->service;
}
}
/**
* Load information for tab info
*
* @param int $id Id of thirdparty to load
* @return void
*/
function info($id)
{
$sql = "SELECT p.rowid, p.ref, p.datec as date_creation, p.tms as date_modification,";
$sql.= " p.fk_user_author, p.fk_user_modif";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p";
$sql.= " WHERE p.rowid = ".$id;
$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_modif);
$this->user_modification = $muser;
}
$this->ref = $obj->ref;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
}
$this->db->free($result);
}
else
{
dol_print_error($this->db);
}
}
}

108
htdocs/product/info.php Normal file
View File

@ -0,0 +1,108 @@
<?php
/* Copyright (C) 2015 Maxime Kohlhaas <maxime@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/product/info.php
* \ingroup product
* \brief Information page for product
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$langs->load("product");
$langs->load("other");
if (! empty($conf->notification->enabled)) $langs->load("mails");
// Security check
$id = GETPOST('id','int');
$ref = GETPOST('ref','alpha');
$result=restrictedArea($user,'produit|service',$id,'product&product');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('infoproduct'));
$object = new Product($db);
/*
* Actions
*/
$parameters=array('id'=>$id);
$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
*/
$form=new Form($b);
$title=$langs->trans("Product");
$helpurl='';
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
llxHeader('',$title,$help_url);
if ($id > 0 || $ref)
{
$result = $object->fetch($id,$ref);
if (! $result)
{
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
llxFooter();
$db->close();
exit;
}
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'info', $titre, 0, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
$object->info($object->id);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
dol_fiche_end();
}
llxFooter();
$db->close();

View File

@ -60,7 +60,7 @@ if ($action == 'delete' && GETPOST('langtodelete','alpha'))
{
$object = new Product($db);
$object->fetch($id);
$object->delMultiLangs(GETPOST('langtodelete','alpha'));
$object->delMultiLangs(GETPOST('langtodelete','alpha'), $user);
}
// Add translation
@ -144,7 +144,7 @@ $cancel != $langs->trans("Cancel") &&
$langtodelete=GETPOST('langdel','alpha');
if ( $object->delMultiLangs($langtodelete) > 0 )
if ( $object->delMultiLangs($langtodelete, $user) > 0 )
{
$action = '';
}

View File

@ -305,7 +305,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
$contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):'');
$form->select_dolusers($user->id,'userid',0,'',0,'',$contactsofproject);
if (count($contactsofproject))
{
print $form->select_dolusers($user->id,'userid',0,'',0,'',$contactsofproject);
}
else
{
print $langs->trans("NoUserAssignedToTheProject");
}
print '</td></tr>';
// Date start

View File

@ -78,15 +78,13 @@ if ($socid > 0)
exit;
}
$object->info($socid);
$head = societe_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
$object->info($socid);
print '<div class="fichecenter">';

View File

@ -1157,7 +1157,7 @@ div.vmenu, td.vmenu {
}
.menu_contenu {
padding-top: 3px;
padding-top: 5px;
padding-bottom: 2px;
}
#menu_contenu_logo { padding-right: 4px; }

View File

@ -80,7 +80,7 @@ $dol_use_jmobile=$conf->dol_use_jmobile;
//var_dump($user->conf->THEME_ELDY_RGB);
// Colors
$colorbackhmenu1='140,150,180'; // topmenu
$colorbackhmenu1='0,0,0'; // topmenu
$colorbackvmenu1='255,255,255'; // vmenu
$colorbacktitle1='230,230,230'; // title of array
$colorbacktabcard1='255,255,255'; // card
@ -102,7 +102,7 @@ $useboldtitle=1;
// Case of option always editable
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY='255,255,255';
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#37474F')); // topmenu (140,160,185)
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#000000')); // topmenu (140,160,185)
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1='140,150,180'; // title of arrays TO MATCH ELDY (140,160,185)
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=='238,246,252';
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK='0,0,120';
@ -126,7 +126,6 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
}
//var_dump($conf->global->THEME_ELDY_BACKBODY);
//var_dump($user->conf->THEME_ELDY_BACKTITLE1);
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1);
@ -723,7 +722,7 @@ $heightmenu=48; /* height of top menu, part with image */
$heightmenu2=48; /* height of top menu, ârt with login */
$disableimages = 0;
$maxwidthloginblock = 110;
if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; }
if (! empty($conf->global->THEME_MD_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; }
?>
div#tmenu_tooltip {
@ -820,11 +819,14 @@ li.tmenu, li.tmenusel {
vertical-align: bottom;
<?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?>
float: <?php print $left; ?>;
<?php if (! $disableimages) { ?>
height: <?php print $heightmenu; ?>px;
<?php } ?>
padding: 0px 0px 2px 0px;
<?php } else { ?>
padding: 0px 0px 0px 0px;
<?php } } ?>
position:relative;
display: block;
padding: 0px 0px 2px 0px;
margin: 0px 0px 0px 0px;
font-weight: normal;
}
@ -845,13 +847,15 @@ div.tmenuleft
margin-top: 0px;
<?php if (empty($conf->dol_optimize_smallscreen)) { ?>
width: 5px;
<?php if (! $disableimages) { ?>
height: <?php print $heightmenu+4; ?>px;
<?php } ?>
/* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat; */
<?php } ?>
}
div.tmenucenter
{
padding-top: 2px;
padding-top: <?php echo $disableimages?'10':'2'; ?>px;
padding-left: 0px;
padding-right: 0px;
height: <?php print $heightmenu; ?>px;

View File

@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -45,6 +46,7 @@ if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha');
$confirm = GETPOST('confirm','alpha');
$subaction = GETPOST('subaction','alpha');
$group = GETPOST("group","int",3);
@ -183,6 +185,11 @@ if (empty($reshook)) {
$object->api_key = GETPOST("api_key", 'alpha');
$object->gender = GETPOST("gender", 'alpha');
$object->admin = GETPOST("admin", 'alpha');
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->country_id = GETPOST('country_id', 'int');
$object->state_id = GETPOST('state_id', 'int');
$object->office_phone = GETPOST("office_phone", 'alpha');
$object->office_fax = GETPOST("office_fax", 'alpha');
$object->user_mobile = GETPOST("user_mobile");
@ -315,7 +322,12 @@ if (empty($reshook)) {
$object->pass = GETPOST("password");
$object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key;
$object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin
$object->office_phone = GETPOST("office_phone", 'alpha');
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->country_id = GETPOST('country_id', 'int');
$object->state_id = GETPOST('state_id', 'int');
$object->office_phone = GETPOST("office_phone", 'alpha');
$object->office_fax = GETPOST("office_fax", 'alpha');
$object->user_mobile = GETPOST("user_mobile");
$object->skype = GETPOST("skype");
@ -578,6 +590,7 @@ if (empty($reshook)) {
$form = new Form($db);
$formother=new FormOther($db);
$formcompany = new FormCompany($db);
llxHeader('',$langs->trans("UserCard"));
@ -865,6 +878,36 @@ if (($action == 'create') || ($action == 'adduserldap'))
print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2);
print '</td></tr>';
// Address
print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
print '<td><textarea name="address" id="address" cols="80" rows="3" wrap="soft">';
print $object->address;
print '</textarea></td></tr>';
// Zip
print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
print '</td></tr>';
// Town
print '<tr><td>'.fieldLabel('Town','town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
print '</td></tr>';
// Country
print '<tr><td>'.fieldLabel('Country','selectcountry_id').'</td><td class="maxwidthonsmartphone">';
print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id));
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>';
// State
if (empty($conf->global->USER_DISABLE_STATE))
{
print '<tr><td>'.fieldLabel('State','state_id').'</td><td class="maxwidthonsmartphone">';
print $formcompany->select_state($object->state_id,$object->country_code, 'state_id');
print '</td></tr>';
}
// Tel
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>';
@ -1108,8 +1151,18 @@ else
}
// Show tabs
if ($mode == 'employee') // For HRM module development
{
$title = $langs->trans("Employee");
$linkback = '<a href="'.DOL_URL_ROOT.'/hrm/employee/list.php">'.$langs->trans("BackToList").'</a>';
}
else
{
$title = $langs->trans("User");
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
}
$head = user_prepare_head($object);
$title = $langs->trans("User");
/*
* Confirmation reinitialisation mot de passe
@ -1158,9 +1211,7 @@ else
{
dol_fiche_head($head, 'user', $title, 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
@ -1919,6 +1970,36 @@ else
}
print '</td></tr>';
// Address
print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
print '<td><textarea name="address" id="address" cols="80" rows="3" wrap="soft">';
print $object->address;
print '</textarea></td></tr>';
// Zip
print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print '</td></tr>';
// Town
print '<tr><td>'.fieldLabel('Town','town').'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>';
// Country
print '<tr><td>'.fieldLabel('Country','selectcounty_id').'</td><td>';
print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>';
// State
if (empty($conf->global->USER_DISABLE_STATE))
{
print '<tr><td>'.fieldLabel('State','state_id').'</td><td>';
print $formcompany->select_state($object->state_id,$object->country_code, 'state_id');
print '</td></tr>';
}
// Tel pro
print "<tr>".'<td>'.$langs->trans("PhonePro").'</td>';
print '<td>';

View File

@ -52,6 +52,12 @@ class User extends CommonObject
var $skype;
var $job;
var $signature;
var $address;
var $zip;
var $town;
var $state_id;
var $state_code;
var $state;
var $office_phone;
var $office_fax;
var $user_mobile;
@ -156,13 +162,14 @@ class User extends CommonObject
*/
function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1)
{
global $conf, $user;
global $langs, $conf, $user;
// Clean parameters
$login=trim($login);
// Get user
$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.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,";
$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,";
@ -180,8 +187,12 @@ class User extends CommonObject
$sql.= " u.salaryextra,";
$sql.= " u.weeklyhours,";
$sql.= " u.color,";
$sql.= " u.ref_int, u.ref_ext";
$sql.= " u.ref_int, u.ref_ext,";
$sql.= " c.code as country_code, c.label as country,";
$sql.= " d.code_departement as state_code, d.nom as state";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
if ($entity < 0)
{
@ -238,6 +249,19 @@ class User extends CommonObject
$this->pass = $obj->pass;
$this->pass_temp = $obj->pass_temp;
$this->api_key = $obj->api_key;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_id?$obj->country_code:'';
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
$this->state = ($obj->state!='-'?$obj->state:'');
$this->office_phone = $obj->office_phone;
$this->office_fax = $obj->office_fax;
$this->user_mobile = $obj->user_mobile;
@ -960,7 +984,7 @@ class User extends CommonObject
$error=0;
// Positionne parametres
// Define parameters
$this->admin = 0;
$this->lastname = $contact->lastname;
$this->firstname = $contact->firstname;
@ -1165,6 +1189,11 @@ class User extends CommonObject
$this->gender = trim($this->gender);
$this->pass = trim($this->pass);
$this->api_key = trim($this->api_key);
$this->address = $this->address?trim($this->address):trim($this->address);
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
$this->town = $this->town?trim($this->town):trim($this->town);
$this->state_id = trim($this->state_id);
$this->country_id = ($this->country_id > 0)?$this->country_id:0;
$this->office_phone = trim($this->office_phone);
$this->office_fax = trim($this->office_fax);
$this->user_mobile = trim($this->user_mobile);

View File

@ -40,6 +40,9 @@ $socid=0;
if ($user->societe_id > 0)
$socid = $user->societe_id;
// Load mode employee
$mode = GETPOST("mode", 'alpha');
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
@ -188,6 +191,7 @@ else
{
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
}
if ($mode = "employee") $sql.= " AND u.employee = 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_supervisor > 0) $sql.= " AND u.fk_user = ".$search_supervisor;