Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
8710b8d5d5
@ -203,7 +203,7 @@ $var=true;
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
||||
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
@ -232,11 +232,18 @@ if ($resql)
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->lastname=$obj->lastname;
|
||||
$staticmember->firstname=$obj->firstname;
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$staticmember->socid = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name=$staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name=$obj->company;
|
||||
}
|
||||
$staticmember->ref=$staticmember->getFullName($langs);
|
||||
$statictype->id=$obj->typeid;
|
||||
$statictype->libelle=$obj->libelle;
|
||||
print '<td>'.$staticmember->getNomUrl(1,24).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1,16).'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
|
||||
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
print '</tr>';
|
||||
@ -256,7 +263,7 @@ else
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " datefin as date_end_subscription,";
|
||||
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
@ -287,9 +294,16 @@ if ($resql)
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->lastname=$obj->lastname;
|
||||
$staticmember->firstname=$obj->firstname;
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$staticmember->socid = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name=$staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name=$obj->company;
|
||||
}
|
||||
$staticmember->ref=$staticmember->getFullName($langs);
|
||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,24,'subscription').'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
|
||||
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
|
||||
print '<td align="right">'.price($obj->cotisation).'</td>';
|
||||
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
@ -320,7 +334,7 @@ foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
|
||||
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
||||
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
|
||||
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
|
||||
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
|
||||
|
||||
@ -84,7 +84,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, ";
|
||||
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,";
|
||||
$sql.= " d.datefin,";
|
||||
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
|
||||
$sql.= " t.libelle as type, t.cotisation";
|
||||
@ -238,7 +238,7 @@ if ($resql)
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
$listetype=$membertypestatic->liste_array();
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -268,6 +268,14 @@ if ($resql)
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$companyname=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$companyname=$objp->company;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
@ -277,14 +285,11 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
|
||||
// Lastname
|
||||
if ($objp->societe != '')
|
||||
{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))."</a></td>\n";
|
||||
}
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">";
|
||||
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
|
||||
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
|
||||
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
|
||||
print "</a></td>\n";
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
@ -293,7 +298,7 @@ if ($resql)
|
||||
$membertypestatic->id=$objp->type_id;
|
||||
$membertypestatic->libelle=$objp->type;
|
||||
print '<td nowrap="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,12);
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
|
||||
// Moral/Physique
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -136,7 +137,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.deductible, p.code as pays_code, p.libelle as pays, a.fk_pays as pays_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1";
|
||||
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$tabsql[9] = "SELECT code_iso as code, label as libelle, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
|
||||
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c";
|
||||
@ -188,7 +189,7 @@ $tabfield[6] = "code,libelle,type,position";
|
||||
$tabfield[7] = "code,libelle,pays_id,pays,deductible";
|
||||
$tabfield[8] = "code,libelle";
|
||||
$tabfield[9] = "code,libelle,unicode";
|
||||
$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
|
||||
$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[11]= "element,source,code,libelle";
|
||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfield[13]= "code,libelle,type";
|
||||
@ -214,7 +215,7 @@ $tabfieldvalue[6] = "code,libelle,type,position";
|
||||
$tabfieldvalue[7] = "code,libelle,pays,deductible";
|
||||
$tabfieldvalue[8] = "code,libelle";
|
||||
$tabfieldvalue[9] = "code,libelle,unicode";
|
||||
$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
|
||||
$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[11]= "element,source,code,libelle";
|
||||
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfieldvalue[13]= "code,libelle,type";
|
||||
@ -240,7 +241,7 @@ $tabfieldinsert[6] = "code,libelle,type,position";
|
||||
$tabfieldinsert[7] = "code,libelle,fk_pays,deductible";
|
||||
$tabfieldinsert[8] = "code,libelle";
|
||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
|
||||
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[11]= "element,source,code,libelle";
|
||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
|
||||
$tabfieldinsert[13]= "code,libelle,type";
|
||||
@ -344,45 +345,45 @@ $elementList = array();
|
||||
$sourceList=array();
|
||||
if ($id == 11)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$langs->load("contracts");
|
||||
$langs->load("projects");
|
||||
$langs->load("propal");
|
||||
$langs->load("bills");
|
||||
$langs->load("interventions");
|
||||
$elementList = array(
|
||||
'commande' => $langs->trans('Order'),
|
||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
||||
'contrat' => $langs->trans('Contract'),
|
||||
'project' => $langs->trans('Project'),
|
||||
'project_task' => $langs->trans('Task'),
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
||||
$sourceList = array(
|
||||
'internal' => $langs->trans('Internal'),
|
||||
'external' => $langs->trans('External')
|
||||
);
|
||||
$langs->load("orders");
|
||||
$langs->load("contracts");
|
||||
$langs->load("projects");
|
||||
$langs->load("propal");
|
||||
$langs->load("bills");
|
||||
$langs->load("interventions");
|
||||
$elementList = array(
|
||||
'commande' => $langs->trans('Order'),
|
||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
||||
'contrat' => $langs->trans('Contract'),
|
||||
'project' => $langs->trans('Project'),
|
||||
'project_task' => $langs->trans('Task'),
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
||||
$sourceList = array(
|
||||
'internal' => $langs->trans('Internal'),
|
||||
'external' => $langs->trans('External')
|
||||
);
|
||||
}
|
||||
|
||||
// Define localtax_typeList (used for dictionnary "c_tva")
|
||||
$localtax_typeList = array();
|
||||
if (GETPOST("id") == 10)
|
||||
{
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
|
||||
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
|
||||
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
|
||||
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
|
||||
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
|
||||
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)", //$langs->trans("%ageOnServiceBeforeVAT"),
|
||||
"7" => $langs->trans("Yes").' ('.$langs->trans("Type")." 7)" //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype
|
||||
);
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
|
||||
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
|
||||
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
|
||||
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
|
||||
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
|
||||
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)", //$langs->trans("%ageOnServiceBeforeVAT"),
|
||||
"7" => $langs->trans("Yes").' ('.$langs->trans("Type")." 7)" //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype
|
||||
);
|
||||
}
|
||||
$msg='';
|
||||
|
||||
@ -404,7 +405,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
// && (! in_array($listfield[$f], array('decalage','module','accountancy_code','localtax1','localtax2'))) // Fields that are not mandatory
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code'))) // Fields that are not mandatory
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
|
||||
)
|
||||
{
|
||||
$ok=0;
|
||||
@ -464,14 +465,14 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] &&
|
||||
! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $tabrowid[$id].",";
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
// List of values
|
||||
if ($tabrowid[$id] &&
|
||||
! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $newid.",";
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
@ -516,7 +517,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id],$listfieldmodify))
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
@ -633,7 +634,7 @@ $linkback='';
|
||||
if ($id)
|
||||
{
|
||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("BackToDictionnaryList").'</a>';
|
||||
$linkback='<a href="'.$_SERVER['PHP_SELF'].'">'.$langs->trans("BackToDictionnaryList").'</a>';
|
||||
}
|
||||
print_fiche_titre($titre,$linkback,'setup');
|
||||
|
||||
@ -685,7 +686,7 @@ if ($id)
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -710,9 +711,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); }
|
||||
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="right"; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";}
|
||||
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="right"; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";}
|
||||
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
@ -731,7 +732,8 @@ if ($id)
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='account_number') { $valuetoshow=$langs->trans("Account"); }
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); }
|
||||
@ -776,13 +778,14 @@ if ($id)
|
||||
print '<td colspan="3" align="right"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
|
||||
print "</tr>";
|
||||
|
||||
if ($alabelisused) // Si un des champs est un libelle
|
||||
if (! empty($alabelisused)) // Si un des champs est un libelle
|
||||
{
|
||||
print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||
}
|
||||
print '<tr><td colspan="'.(count($fieldlist)+2).'"> </td></tr>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
// List of available values in database
|
||||
dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG);
|
||||
@ -825,9 +828,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); }
|
||||
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="right"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="right"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
@ -843,7 +846,8 @@ if ($id)
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='account_number') { $valuetoshow=$langs->trans("Accounts"); }
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
|
||||
@ -869,9 +873,8 @@ if ($id)
|
||||
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
print '<form action="dict.php" method="post">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
@ -886,7 +889,7 @@ if ($id)
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
@ -919,7 +922,7 @@ if ($id)
|
||||
else
|
||||
{
|
||||
$key=$langs->trans("Country".strtoupper($obj->pays_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->pays;
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->pays_code)?$obj->pays_code." - ".$key:$obj->pays);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
||||
@ -932,55 +935,55 @@ if ($id)
|
||||
else if ($fieldlist[$field]=='libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=nl2br($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_pays') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->load("propal");
|
||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_currencies') {
|
||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_typent') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_civilite') {
|
||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_input_reason') {
|
||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_input_method') {
|
||||
$langs->load("orders");
|
||||
@ -990,18 +993,18 @@ if ($id)
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$_GET['id']]==MAIN_DB_PREFIX.'c_paper_format')
|
||||
{
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && ($key != 'PaperFormat'.strtoupper($obj->code))) ? $key : $obj->$fieldlist[$field];
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$_GET['id']] == MAIN_DB_PREFIX.'c_type_fees')
|
||||
{
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && ($key != strtoupper($obj->code))) ? $key : $obj->$fieldlist[$field];
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') {
|
||||
$showfield=0;
|
||||
@ -1013,7 +1016,7 @@ if ($id)
|
||||
else if (($fieldlist[$field] == 'unit') && ($tabname[$_GET['id']] == MAIN_DB_PREFIX.'c_paper_format'))
|
||||
{
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$valuetoshow = ($obj->code && ($key != 'SizeUnit'.strtolower($obj->unit))) ? $key : $obj->$fieldlist[$field];
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
|
||||
else if ($fieldlist[$field]=='localtax1_type') {
|
||||
@ -1167,108 +1170,110 @@ $db->close();
|
||||
*/
|
||||
function fieldList($fieldlist,$obj='',$tabname='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $conf,$langs,$db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'pays') {
|
||||
if (in_array('region_id',$fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
||||
print '<td>';
|
||||
print $form->select_country((! empty($obj->pays_code)?$obj->pays_code:(! empty($obj->pays)?$obj->pays:'')),'pays');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'pays_id') {
|
||||
$pays_id = (! empty($obj->$fieldlist[$field])) ? $obj->$fieldlist[$field] : 0;
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$pays_id.'">';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region') {
|
||||
print '<td>';
|
||||
$formcompany->select_region($region_id,'region');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id') {
|
||||
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang') {
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de l'element (pour les type de contact).'
|
||||
elseif ($fieldlist[$field] == 'element')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
// La source de l'element (pour les type de contact).'
|
||||
elseif ($fieldlist[$field] == 'source')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
{
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$align="left";
|
||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right
|
||||
print '<td align="'.$align.'">';
|
||||
print '<input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'libelle_facture') {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
print $form->selectarray('unit', array(
|
||||
'mm' => $langs->trans('SizeUnitmm'),
|
||||
'cm' => $langs->trans('SizeUnitcm'),
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
), (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), 0, 0, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de taxe locale
|
||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList,$obj->$fieldlist[$field]);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='accountancy_code') $size='size="9" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'pays') {
|
||||
if (in_array('region_id',$fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
||||
print '<td>';
|
||||
print $form->select_country((! empty($obj->pays_code)?$obj->pays_code:(! empty($obj->pays)?$obj->pays:'')),'pays');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'pays_id') {
|
||||
$pays_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$pays_id.'">';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region') {
|
||||
print '<td>';
|
||||
$formcompany->select_region($region_id,'region');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id') {
|
||||
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang') {
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'element')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
// La source de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'source')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
{
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$align="left";
|
||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right
|
||||
print '<td align="'.$align.'">';
|
||||
print '<input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'libelle_facture') {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
$units = array(
|
||||
'mm' => $langs->trans('SizeUnitmm'),
|
||||
'cm' => $langs->trans('SizeUnitcm'),
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
);
|
||||
print $form->selectarray('unit', $units, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), 0, 0, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de taxe locale
|
||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList,$obj->$fieldlist[$field]);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="15" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="15" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -236,7 +236,7 @@ if ($action == 'edit') // Edit
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK))
|
||||
{
|
||||
// Show bugtrack link
|
||||
$var=!$var;
|
||||
@ -390,7 +390,7 @@ else // Show
|
||||
print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK))
|
||||
{
|
||||
// Show bugtrack link
|
||||
$var=!$var;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -95,7 +96,7 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||
$sql.= " ct.accountancy_code";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
@ -109,8 +110,8 @@ if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
// les variables
|
||||
$cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER))?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
$cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER)?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef"));
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
|
||||
$tabfac = array();
|
||||
$tabht = array();
|
||||
@ -123,14 +124,14 @@ if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
// contrôles
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur))?$obj->code_compta_fournisseur:$cptfour;
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur)?$obj->code_compta_fournisseur:$cptfour);
|
||||
$compta_prod = $obj->accountancy_code_buy;
|
||||
if (empty($compta_prod))
|
||||
{
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT)?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
}
|
||||
$compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -97,7 +98,7 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
$sql.= " ct.accountancy_code";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
||||
@ -134,7 +135,7 @@ if ($result)
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT)?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
}
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
$compta_tva = (! empty($obj->accountancy_code)?$obj->accountancy_code:$cpttva);
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
|
||||
//la ligne facture
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -133,14 +133,15 @@ if ($socid > 0)
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print "<td align=\"center\">".dol_print_date($fac->date)."</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";
|
||||
$solde = $solde + $fac->total_ttc;
|
||||
if (($fac->statut == 3 ) || ($fac->statut == 2 && ! $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";
|
||||
|
||||
@ -73,7 +73,8 @@ class box_members extends ModeleBoxes
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
|
||||
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql.= " t.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql.= " WHERE a.entity = ".$conf->entity;
|
||||
@ -97,6 +98,14 @@ class box_members extends ModeleBoxes
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$memberstatic->name=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$memberstatic->name=$objp->company;
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid);
|
||||
|
||||
@ -3152,7 +3152,7 @@ class Form
|
||||
* @param int $h 1=Show also hours
|
||||
* @param int $m 1=Show also minutes
|
||||
* @param int $empty 0=Fields required, 1=Empty input is allowed
|
||||
* @param string $form_name Form name. Used by popup dates.
|
||||
* @param string $form_name Not used
|
||||
* @param int $d 1=Show days, month, years
|
||||
* @param int $addnowbutton Add a button "Now"
|
||||
* @param int $nooutput Do not output html string but return it
|
||||
|
||||
@ -601,7 +601,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
|
||||
* Fonction retournant le nombre de jour feries samedis et dimanches entre 2 dates entrees en timestamp
|
||||
* Called by function num_open_day
|
||||
*
|
||||
* @param timestamp $timestampStart Timestamp de debut
|
||||
@ -733,11 +733,12 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
|
||||
|
||||
/**
|
||||
* Fonction retournant le nombre de jour entre deux dates
|
||||
* Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1
|
||||
*
|
||||
* @param timestamp $timestampStart Timestamp de debut
|
||||
* @param timestamp $timestampEnd Timestamp de fin
|
||||
* @param int $lastday On prend en compte le dernier jour, 0: non, 1:oui
|
||||
* @return int Nombre de jours
|
||||
* @param int $lastday Last day is included, 0: non, 1:oui
|
||||
* @return int Number of days
|
||||
*/
|
||||
function num_between_day($timestampStart, $timestampEnd, $lastday=0)
|
||||
{
|
||||
@ -751,8 +752,9 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
|
||||
{
|
||||
$bit = 1;
|
||||
}
|
||||
$nbjours = round(($timestampEnd - $timestampStart)/(60*60*24)-$bit);
|
||||
$nbjours = (int) floor(($timestampEnd - $timestampStart)/(60*60*24)) + 1 - $bit;
|
||||
}
|
||||
//print ($timestampEnd - $timestampStart) - $lastday;
|
||||
return $nbjours;
|
||||
}
|
||||
|
||||
@ -762,22 +764,29 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
|
||||
* @param timestamp $timestampStart Timestamp de debut
|
||||
* @param timestamp $timestampEnd Timestamp de fin
|
||||
* @param int $inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max)
|
||||
* @param int $lastday On prend en compte le dernier jour, 0: non, 1:oui
|
||||
* @param int $lastday We include last day, 0: non, 1:oui
|
||||
* @return int Nombre de jours ou d'heures
|
||||
*/
|
||||
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday);
|
||||
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
|
||||
if ($timestampStart < $timestampEnd)
|
||||
{
|
||||
$bit = 0;
|
||||
if ($lastday == 1) $bit = 1;
|
||||
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd);
|
||||
//print num_between_day($timestampStart, $timestampEnd, $lastday).' - '.num_public_holiday($timestampStart, $timestampEnd);
|
||||
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday);
|
||||
$nbOpenDay.= " ".$langs->trans("Days");
|
||||
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
|
||||
return $nbOpenDay;
|
||||
}
|
||||
elseif ($timestampStart == $timestampEnd)
|
||||
{
|
||||
$nbOpenDay=$lastday;
|
||||
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
|
||||
return $nbOpenDay=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $langs->trans("Error");
|
||||
|
||||
@ -531,6 +531,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
|
||||
// For debugging
|
||||
//include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||
//$mask='{yyyy}-{0000}';
|
||||
//$date=dol_mktime(12, 0, 0, 1, 1, 1900);
|
||||
//$date=dol_stringtotime('20121001');
|
||||
|
||||
// Extract value for mask counter, mask raz and mask offset
|
||||
@ -810,20 +812,18 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$numFinal = $mask;
|
||||
|
||||
// We replace special codes except refclient
|
||||
// FIXME: $yearoffset is 0 by default, this code is useless
|
||||
//if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // yearoffsettype is - or +, so we don't want current year
|
||||
//{
|
||||
if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // yearoffsettype is - or +, so we don't want current year
|
||||
{
|
||||
$numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date)+$yearoffset, $numFinal);
|
||||
$numFinal = preg_replace('/\{yy\}/i', date("y",$date)+$yearoffset, $numFinal);
|
||||
$numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1)+$yearoffset, $numFinal);
|
||||
//}
|
||||
/*
|
||||
}
|
||||
else // we want yyyy to be current year
|
||||
{
|
||||
$numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal);
|
||||
$numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal);
|
||||
$numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1), $numFinal);
|
||||
}*/
|
||||
}
|
||||
$numFinal = preg_replace('/\{mm\}/i', date("m",$date), $numFinal);
|
||||
$numFinal = preg_replace('/\{dd\}/i', date("d",$date), $numFinal);
|
||||
|
||||
|
||||
@ -132,6 +132,8 @@ function product_prepare_head($object, $user)
|
||||
}
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
@ -102,47 +102,54 @@ class InterfacePaypalWorkflow
|
||||
if ($action == 'PAYPAL_PAYMENT_OK')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref);
|
||||
|
||||
if ($object->source == 'membersubscription')
|
||||
|
||||
if (! empty($object->source))
|
||||
{
|
||||
//require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php';
|
||||
|
||||
// TODO add subscription treatment
|
||||
if ($object->source == 'membersubscription')
|
||||
{
|
||||
//require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php';
|
||||
|
||||
// TODO add subscription treatment
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $path = $filename = $object->source;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
|
||||
{
|
||||
$element = $path = $regs[1];
|
||||
$filename = $regs[2];
|
||||
}
|
||||
// For compatibility
|
||||
if ($element == 'order') {
|
||||
$path = $filename = 'commande';
|
||||
}
|
||||
if ($element == 'invoice') {
|
||||
$path = 'compta/facture'; $filename = 'facture';
|
||||
}
|
||||
|
||||
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
|
||||
|
||||
$classname = ucfirst($filename);
|
||||
$obj = new $classname($this->db);
|
||||
|
||||
$ret = $obj->fetch('',$object->ref);
|
||||
if ($ret < 0) return -1;
|
||||
|
||||
// Add payer id
|
||||
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
|
||||
|
||||
// Add transaction id
|
||||
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $path = $filename = $object->source;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
|
||||
{
|
||||
$element = $path = $regs[1];
|
||||
$filename = $regs[2];
|
||||
}
|
||||
// For compatibility
|
||||
if ($element == 'order') {
|
||||
$path = $filename = 'commande';
|
||||
}
|
||||
if ($element == 'invoice') {
|
||||
$path = 'compta/facture'; $filename = 'facture';
|
||||
}
|
||||
|
||||
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
|
||||
|
||||
$classname = ucfirst($filename);
|
||||
$obj = new $classname($this->db);
|
||||
|
||||
$ret = $obj->fetch('',$object->ref);
|
||||
if ($ret < 0) return -1;
|
||||
|
||||
// Add payer id
|
||||
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
|
||||
|
||||
// Add transaction id
|
||||
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
|
||||
// TODO add free tag treatment
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT. '/user/class/usergroup.class.php';
|
||||
|
||||
$action=GETPOST('action');
|
||||
$optName=GETPOST('optName');
|
||||
$optValue=GETPOST('optValue');
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("holiday");
|
||||
@ -155,7 +157,6 @@ if ($action == "add")
|
||||
$message.= '<br /><div class="warning">'.$langs->trans('AddCPforUsers').'</div>';
|
||||
}
|
||||
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
@ -163,45 +164,41 @@ if ($action == "add")
|
||||
}
|
||||
elseif ($action == 'create_event')
|
||||
{
|
||||
$error = false;
|
||||
$error = 0;
|
||||
|
||||
if (!empty($_POST['optName']))
|
||||
$optName = trim($optName);
|
||||
$optValue = price2num($optValue,2);
|
||||
|
||||
if (! $optName)
|
||||
{
|
||||
$optName = trim($_POST['optName']);
|
||||
} else {
|
||||
$error = true;
|
||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!empty($_POST['optValue']))
|
||||
if (! $optValue > 0)
|
||||
{
|
||||
$optValue = price2num($_POST['optValue'],2);
|
||||
} else {
|
||||
$error = true;
|
||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
$cp->optName = $optName;
|
||||
$cp->optValue = $optValue;
|
||||
|
||||
if($error)
|
||||
{
|
||||
$message = 'ErrorCreateEventCP';
|
||||
}
|
||||
else
|
||||
if (! $error)
|
||||
{
|
||||
$result = $cp->createEventCP($user);
|
||||
|
||||
if($result > 0)
|
||||
{
|
||||
$message = 'OkCreateEventCP';
|
||||
$optName='';
|
||||
$optValue='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = 'ErrorCreateEventCP';
|
||||
$message = '<div class="error">'.$cp->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
}
|
||||
elseif($action == 'event' && isset($_POST['update_event']))
|
||||
{
|
||||
@ -210,10 +207,10 @@ elseif($action == 'event' && isset($_POST['update_event']))
|
||||
$eventId = array_keys($_POST['update_event']);
|
||||
$eventId = $eventId[0];
|
||||
|
||||
$eventName = $_POST['optName'];
|
||||
$eventName = $optName;
|
||||
$eventName = $eventName[$eventId];
|
||||
|
||||
$eventValue = $_POST['optValue'];
|
||||
$eventValue = $optValue;
|
||||
$eventValue = $eventValue[$eventId];
|
||||
|
||||
if(!empty($eventName)) {
|
||||
@ -242,7 +239,6 @@ elseif($action == 'event' && isset($_POST['update_event']))
|
||||
}
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
}
|
||||
elseif($action && isset($_POST['delete_event']))
|
||||
{
|
||||
@ -353,16 +349,14 @@ if($cp_events == 1) {
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?leftmenu=setup" name="event_update">'."\n";
|
||||
print '<input type="hidden" name="action" value="event" />'."\n";
|
||||
|
||||
print '<h5>'.$langs->trans('TitleUpdateEventCP').'</h5>'."\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tbody>'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
|
||||
print '<td class="liste_titre" width="40%">'.$langs->trans('NameEventCP').'</td>'."\n";
|
||||
print '<td class="liste_titre">'.$langs->trans('ValueOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre">'.$langs->trans('UpdateEventOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans('DeleteEventOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre" width="20%">'.$langs->trans('ValueOptionCP').'</td>'."\n";
|
||||
print '<td class="liste_titre"> </td>'."\n";
|
||||
print '<td class="liste_titre"> </td>'."\n";
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -373,7 +367,7 @@ if($cp_events == 1) {
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td><input class="flat" type="text" size="40" name="optName['.$infos_event['rowid'].']" value="'.$infos_event['name'].'" /></td>'."\n";
|
||||
print '<td><input class="flat" type="text" size="2" name="optValue['.$infos_event['rowid'].']" value="'.$infos_event['value'].'" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '<td><input type="submit" class="button" name="update_event['.$infos_event['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'"/></td>'."\n";
|
||||
print '<td><input type="submit" class="button" name="update_event['.$infos_event['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Save")).'"/></td>'."\n";
|
||||
print '<td width="20px" align="right"><input type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" name="delete_event['.$infos_event['rowid'].']" style="border:0;"/></td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
@ -388,6 +382,7 @@ if($cp_events == 1) {
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?leftmenu=setup" name="event_create">'."\n";
|
||||
print '<input type="hidden" name="action" value="create_event" />'."\n";
|
||||
|
||||
print $langs->trans('TitleCreateEventCP');
|
||||
|
||||
@ -398,16 +393,14 @@ print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre" width="40%">'.$langs->trans('NameEventCP').'</td>';
|
||||
print '<td class="liste_titre" width="20%">'.$langs->trans('ValueOptionCP').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('CreateEventCP').'</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<input type="hidden" name="action" value="create_event" />'."\n";
|
||||
|
||||
print '<tr class="pair">';
|
||||
print '<td><input class="flat" type="text" size="40" name="optName" value="" /></td>'."\n";
|
||||
print '<td><input class="flat" type="text" size="2" name="optValue" value="" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '<td><input type="submit" class="button" name="button" value="'.$langs->trans('ValidEventCP').'" /></td>'."\n";
|
||||
print '<td><input class="flat" type="text" size="40" name="optName" value="'.(is_array($optName)?'':$optName).'" /></td>'."\n";
|
||||
print '<td><input class="flat" type="text" size="2" name="optValue" value="'.(is_array($optValue)?'':$optValue).'" /> '.$langs->trans('Jours').'</td>'."\n";
|
||||
print '<td><input type="submit" class="button" name="button" value="'.$langs->trans('CreateEventCP').'" /></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '</tbody>';
|
||||
|
||||
@ -109,8 +109,8 @@ class Holiday extends CommonObject
|
||||
}
|
||||
$sql.= " NOW(),";
|
||||
$sql.= " '".addslashes($this->description)."',";
|
||||
$sql.= " '".$this->date_debut."',";
|
||||
$sql.= " '".$this->date_fin."',";
|
||||
$sql.= " '".$this->db->idate($this->date_debut)."',";
|
||||
$sql.= " '".$this->db->idate($this->date_fin)."',";
|
||||
$sql.= " '1',";
|
||||
if(is_numeric($this->fk_validator)) {
|
||||
$sql.= " '".$this->fk_validator."'";
|
||||
@ -196,17 +196,17 @@ class Holiday extends CommonObject
|
||||
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->date_create = $obj->date_create;
|
||||
$this->date_create = $this->db->jdate($obj->date_create);
|
||||
$this->description = $obj->description;
|
||||
$this->date_debut = $obj->date_debut;
|
||||
$this->date_fin = $obj->date_fin;
|
||||
$this->date_debut = $this->db->jdate($obj->date_debut);
|
||||
$this->date_fin = $this->db->jdate($obj->date_fin);
|
||||
$this->statut = $obj->statut;
|
||||
$this->fk_validator = $obj->fk_validator;
|
||||
$this->date_valid = $obj->date_valid;
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->fk_user_valid = $obj->fk_user_valid;
|
||||
$this->date_refuse = $obj->date_refuse;
|
||||
$this->date_refuse = $this->db->jdate($obj->date_refuse);
|
||||
$this->fk_user_refuse = $obj->fk_user_refuse;
|
||||
$this->date_cancel = $obj->date_cancel;
|
||||
$this->date_cancel = $this->db->jdate($obj->date_cancel);
|
||||
$this->fk_user_cancel = $obj->fk_user_cancel;
|
||||
$this->detail_refuse = $obj->detail_refuse;
|
||||
|
||||
@ -289,17 +289,17 @@ class Holiday extends CommonObject
|
||||
|
||||
$tab_result[$i]['rowid'] = $obj->rowid;
|
||||
$tab_result[$i]['fk_user'] = $obj->fk_user;
|
||||
$tab_result[$i]['date_create'] = $obj->date_create;
|
||||
$tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create);
|
||||
$tab_result[$i]['description'] = $obj->description;
|
||||
$tab_result[$i]['date_debut'] = $obj->date_debut;
|
||||
$tab_result[$i]['date_fin'] = $obj->date_fin;
|
||||
$tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut);
|
||||
$tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin);
|
||||
$tab_result[$i]['statut'] = $obj->statut;
|
||||
$tab_result[$i]['fk_validator'] = $obj->fk_validator;
|
||||
$tab_result[$i]['date_valid'] = $obj->date_valid;
|
||||
$tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid);
|
||||
$tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid;
|
||||
$tab_result[$i]['date_refuse'] = $obj->date_refuse;
|
||||
$tab_result[$i]['date_refuse'] = $this->db->jdate($obj->date_refuse);
|
||||
$tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse;
|
||||
$tab_result[$i]['date_cancel'] = $obj->date_cancel;
|
||||
$tab_result[$i]['date_cancel'] = $this->db->jdate($obj->date_cancel);
|
||||
$tab_result[$i]['fk_user_cancel'] = $obj->fk_user_cancel;
|
||||
$tab_result[$i]['detail_refuse'] = $obj->detail_refuse;
|
||||
|
||||
@ -430,12 +430,12 @@ class Holiday extends CommonObject
|
||||
$sql.= " description= '".addslashes($this->description)."',";
|
||||
|
||||
if(!empty($this->date_debut)) {
|
||||
$sql.= " date_debut = '".$this->date_debut."',";
|
||||
$sql.= " date_debut = '".$this->db->idate($this->date_debut)."',";
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if(!empty($this->date_fin)) {
|
||||
$sql.= " date_fin = '".$this->date_fin."',";
|
||||
$sql.= " date_fin = '".$this->db->idate($this->date_fin)."',";
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
@ -450,7 +450,7 @@ class Holiday extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
if(!empty($this->date_valid)) {
|
||||
$sql.= " date_valid = '".$this->date_valid."',";
|
||||
$sql.= " date_valid = '".$this->db->idate($this->date_valid)."',";
|
||||
} else {
|
||||
$sql.= " date_valid = NULL,";
|
||||
}
|
||||
@ -460,7 +460,7 @@ class Holiday extends CommonObject
|
||||
$sql.= " fk_user_valid = NULL,";
|
||||
}
|
||||
if(!empty($this->date_refuse)) {
|
||||
$sql.= " date_refuse = '".$this->date_refuse."',";
|
||||
$sql.= " date_refuse = '".$this->db->idate($this->date_refuse)."',";
|
||||
} else {
|
||||
$sql.= " date_refuse = NULL,";
|
||||
}
|
||||
@ -470,7 +470,7 @@ class Holiday extends CommonObject
|
||||
$sql.= " fk_user_refuse = NULL,";
|
||||
}
|
||||
if(!empty($this->date_cancel)) {
|
||||
$sql.= " date_cancel = '".$this->date_cancel."',";
|
||||
$sql.= " date_cancel = '".$this->db->idate($this->date_cancel)."',";
|
||||
} else {
|
||||
$sql.= " date_cancel = NULL,";
|
||||
}
|
||||
@ -1214,56 +1214,6 @@ class Holiday extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le nombre de jours ouvrés entre deux dates
|
||||
* Prise en compte des jours fériés en France
|
||||
*
|
||||
* @param date $date_start Start date
|
||||
* @param date $date_stop Stop date
|
||||
* @return int Nb of days
|
||||
*/
|
||||
|
||||
function getOpenDays($date_start, $date_stop) {
|
||||
|
||||
// Tableau des jours feriés
|
||||
$arr_bank_holidays = array();
|
||||
|
||||
// On boucle dans le cas où l'année de départ serait différente de l'année d'arrivée
|
||||
$diff_year = date('Y', $date_stop) - date('Y', $date_start);
|
||||
|
||||
for ($i = 0; $i <= $diff_year; $i++) {
|
||||
$year = (int) date('Y', $date_start) + $i;
|
||||
// Liste des jours feriés
|
||||
$arr_bank_holidays[] = '1_1_'.$year; // Jour de l'an
|
||||
$arr_bank_holidays[] = '1_5_'.$year; // Fete du travail
|
||||
$arr_bank_holidays[] = '8_5_'.$year; // Victoire 1945
|
||||
$arr_bank_holidays[] = '14_7_'.$year; // Fete nationale
|
||||
$arr_bank_holidays[] = '15_8_'.$year; // Assomption
|
||||
$arr_bank_holidays[] = '1_11_'.$year; // Toussaint
|
||||
$arr_bank_holidays[] = '11_11_'.$year; // Armistice 1918
|
||||
$arr_bank_holidays[] = '25_12_'.$year; // Noel
|
||||
// Récupération de paques. Permet ensuite d'obtenir le jour de l'ascension et celui de la pentecote
|
||||
$easter = easter_date($year);
|
||||
$arr_bank_holidays[] = date('j_n_'.$year, $easter + 86400); // Paques
|
||||
$arr_bank_holidays[] = date('j_n_'.$year, $easter + (86400*39)); // Ascension
|
||||
$arr_bank_holidays[] = date('j_n_'.$year, $easter + (86400*50)); // Pentecote
|
||||
}
|
||||
|
||||
$nb_days_open = 0;
|
||||
|
||||
while ($date_start <= $date_stop) {
|
||||
// Si le jour suivant n'est ni un dimanche (0) ou un samedi (6), ni un jour férié, on incrémente les jours ouvrés
|
||||
if (!in_array(date('w', $date_start), array(0, 6)) && !in_array(date('j_n_'.date('Y', $date_start), $date_start), $arr_bank_holidays)) {
|
||||
$nb_days_open++;
|
||||
}
|
||||
|
||||
$date_start = mktime(date('H', $date_start), date('i', $date_start), date('s', $date_start), date('m', $date_start), date('d', $date_start) + 1, date('Y', $date_start));
|
||||
}
|
||||
|
||||
// On retourne le nombre de jours ouvrés
|
||||
return $nb_days_open;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les évènements de congés payés enregistré
|
||||
*
|
||||
|
||||
@ -28,11 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
|
||||
// Get parameters
|
||||
$myparam = GETPOST("myparam");
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('id');
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
@ -46,7 +48,7 @@ $user_id = $user->id;
|
||||
********************************************************************/
|
||||
|
||||
// Si création de la demande
|
||||
if ($action == 'add')
|
||||
if ($action == 'create')
|
||||
{
|
||||
|
||||
// Si pas le droit de créer une demande
|
||||
@ -92,14 +94,15 @@ if ($action == 'add')
|
||||
$verifCP = $cp->verifDateHolidayCP($userID,$date_debut,$date_fin);
|
||||
|
||||
// On vérifie si il n'y a pas déjà des congés payés sur cette période
|
||||
if(!$verifCP)
|
||||
if (! $verifCP)
|
||||
{
|
||||
header('Location: fiche.php?action=request&error=alreadyCP');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Si aucun jours ouvrés dans la demande
|
||||
if($cp->getOpenDays($testDateDebut,$testDateFin) < 1)
|
||||
$nbopenedday=num_open_day($testDateDebut,$testDateFin,0,1);
|
||||
if($nbopenedday < 1)
|
||||
{
|
||||
header('Location: fiche.php?action=request&error=DureeHoliday');
|
||||
exit;
|
||||
@ -137,6 +140,8 @@ if ($action == 'add')
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$date_debut = dol_mktime(0, 0, 0, $_POST['date_debut_month'], $_POST['date_debut_day'], $_POST['date_debut_year']);
|
||||
$date_fin = dol_mktime(0, 0, 0, $_POST['date_fin_month'], $_POST['date_fin_day'], $_POST['date_fin_year']);
|
||||
|
||||
// Si pas le droit de modifier une demande
|
||||
if(!$user->rights->holiday->write)
|
||||
@ -151,12 +156,9 @@ if ($action == 'update')
|
||||
// Si en attente de validation
|
||||
if ($cp->statut == 1)
|
||||
{
|
||||
|
||||
// Si c'est le créateur ou qu'il a le droit de tout lire / modifier
|
||||
if ($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
||||
{
|
||||
$date_debut = $_POST['date_debut_year'].'-'.str_pad($_POST['date_debut_month'],2,"0",STR_PAD_LEFT).'-'.str_pad($_POST['date_debut_day'],2,"0",STR_PAD_LEFT);
|
||||
$date_fin = $_POST['date_fin_year'].'-'.str_pad($_POST['date_fin_month'],2,"0",STR_PAD_LEFT).'-'.str_pad($_POST['date_fin_day'],2,"0",STR_PAD_LEFT);
|
||||
$valideur = $_POST['valideur'];
|
||||
$description = trim($_POST['description']);
|
||||
|
||||
@ -172,8 +174,8 @@ if ($action == 'update')
|
||||
exit;
|
||||
}
|
||||
|
||||
$testDateDebut = strtotime($date_debut);
|
||||
$testDateFin = strtotime($date_fin);
|
||||
$testDateDebut = $date_debut;
|
||||
$testDateFin = $date_fin;
|
||||
|
||||
// Si date de début après la date de fin
|
||||
if ($testDateDebut > $testDateFin) {
|
||||
@ -188,7 +190,9 @@ if ($action == 'update')
|
||||
}
|
||||
|
||||
// Si pas de jours ouvrés dans la demande
|
||||
if ($cp->getOpenDays($testDateDebut,$testDateFin) < 1) {
|
||||
$nbopenedday=num_open_day($testDateDebut,$testDateFin,0,1);
|
||||
if ($nbopenedday < 1)
|
||||
{
|
||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
|
||||
exit;
|
||||
}
|
||||
@ -284,9 +288,10 @@ if ($action == 'confirm_send')
|
||||
$message.= "Veuillez trouver ci-dessous une demande de congés payés à valider.\n";
|
||||
|
||||
$delayForRequest = $cp->getConfCP('delayForRequest');
|
||||
$delayForRequest = $delayForRequest * (60*60*24);
|
||||
//$delayForRequest = $delayForRequest * (60*60*24);
|
||||
|
||||
$nextMonth = date('Y-m-d', time()+$delayForRequest);
|
||||
$now=dol_now();
|
||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
// Si l'option pour avertir le valideur en cas de délai trop court
|
||||
if($cp->getConfCP('AlertValidatorDelay')) {
|
||||
@ -299,7 +304,9 @@ if ($action == 'confirm_send')
|
||||
|
||||
// Si l'option pour avertir le valideur en cas de solde inférieur à la demande
|
||||
if($cp->getConfCP('AlertValidatorSolde')) {
|
||||
if($cp->getOpenDays(strtotime($cp->date_debut),strtotime($cp->date_fin)) > $cp->getCPforUser($cp->fk_user)) {
|
||||
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1);
|
||||
if ($nbopenedday > $cp->getCPforUser($cp->fk_user))
|
||||
{
|
||||
$message.= "\n";
|
||||
$message.= "L'utilisateur ayant fait cette demande de congés payés n'a pas le solde requis.\n";
|
||||
}
|
||||
@ -331,10 +338,10 @@ if ($action == 'confirm_send')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Si Validation de la demande
|
||||
if($action == 'confirm_valid')
|
||||
{
|
||||
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($_GET['id']);
|
||||
|
||||
@ -344,7 +351,7 @@ if($action == 'confirm_valid')
|
||||
if($cp->statut == 2 && $userID == $cp->fk_validator)
|
||||
{
|
||||
|
||||
$cp->date_valid = date('Y-m-d H:i:s', time());
|
||||
$cp->date_valid = dol_now();
|
||||
$cp->fk_user_valid = $user->id;
|
||||
$cp->statut = 3;
|
||||
|
||||
@ -354,7 +361,7 @@ if($action == 'confirm_valid')
|
||||
if($verif > 0) {
|
||||
|
||||
// Retrait du nombre de jours prit
|
||||
$nbJour = $cp->getOpenDays(strtotime($cp->date_debut),strtotime($cp->date_fin));
|
||||
$nbJour = $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1);
|
||||
|
||||
$soldeActuel = $cp->getCpforUser($cp->fk_user);
|
||||
$newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
|
||||
@ -570,7 +577,7 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
if ($action == 'request')
|
||||
if (empty($id) || $action == 'add' || $action == 'request')
|
||||
{
|
||||
// Si l'utilisateur n'a pas le droit de faire une demande
|
||||
if(!$user->rights->holiday->write)
|
||||
@ -619,9 +626,9 @@ if ($action == 'request')
|
||||
$cp = new Holiday($db);
|
||||
|
||||
$delayForRequest = $cp->getConfCP('delayForRequest');
|
||||
$delayForRequest = $delayForRequest * (60*60*24);
|
||||
//$delayForRequest = $delayForRequest * (60*60*24);
|
||||
|
||||
$nextMonth = date('Y-m-d', time()+$delayForRequest);
|
||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
print '<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
@ -635,19 +642,19 @@ if ($action == 'request')
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
alert("'.$langs->transnoentities('InvalidValidatorCP').'");
|
||||
alert("'.dol_escape_js($langs->transnoentities('InvalidValidatorCP')).'");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
alert("'.$langs->trans('NoDateFin').'");
|
||||
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
alert("'.$langs->trans('NoDateDebut').'");
|
||||
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -657,7 +664,7 @@ if ($action == 'request')
|
||||
|
||||
// Formulaire de demande
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
||||
print '<input type="hidden" name="action" value="add" />'."\n";
|
||||
print '<input type="hidden" name="action" value="create" />'."\n";
|
||||
print '<input type="hidden" name="userID" value="'.$user_id.'" />'."\n";
|
||||
print '<div class="tabBar">';
|
||||
print '<span>'.$langs->trans('DelayToRequestCP',$cp->getConfCP('delayForRequest')).'</span><br /><br />';
|
||||
@ -668,11 +675,11 @@ if ($action == 'request')
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateDebCP").'</td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateDebCP").' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||
print '<td>';
|
||||
// Si la demande ne vient pas de l'agenda
|
||||
if(!isset($_GET['datep'])) {
|
||||
$html->select_date($nextMonth,'date_debut_');
|
||||
$html->select_date(-1,'date_debut_');
|
||||
} else {
|
||||
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datepmonth'), GETPOST('datepday'), GETPOST('datepyear'));
|
||||
$html->select_date($tmpdate,'date_debut_');
|
||||
@ -680,11 +687,11 @@ if ($action == 'request')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateFinCP").'</td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateFinCP").' ('.$langs->trans("LastDayOfHoliday").')</td>';
|
||||
print '<td>';
|
||||
// Si la demande ne vient pas de l'agenda
|
||||
if(!isset($_GET['datep'])) {
|
||||
$html->select_date($nextMonth,'date_fin_');
|
||||
$html->select_date(-1,'date_fin_');
|
||||
} else {
|
||||
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datefmonth'), GETPOST('datefday'), GETPOST('datefyear'));
|
||||
$html->select_date($tmpdate,'date_fin_');
|
||||
@ -706,7 +713,7 @@ if ($action == 'request')
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DescCP").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="description" class="flat" rows="2" cols="70"></textarea>';
|
||||
print '<textarea name="description" class="flat" rows="'.ROWS_3.'" cols="70"></textarea>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tbody>';
|
||||
@ -723,7 +730,7 @@ if ($action == 'request')
|
||||
}
|
||||
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
else
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
@ -735,10 +742,10 @@ elseif(isset($_GET['id']))
|
||||
else
|
||||
{
|
||||
// Affichage de la fiche d'une demande de congés payés
|
||||
if ($_GET['id'] > 0)
|
||||
if ($id > 0)
|
||||
{
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($_GET['id']);
|
||||
$cp->fetch($id);
|
||||
|
||||
$valideur = new User($db);
|
||||
$valideur->fetch($cp->fk_validator);
|
||||
@ -887,7 +894,7 @@ elseif(isset($_GET['id']))
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('NbUseDaysCP').'</td>';
|
||||
print '<td>'.$cp->getOpenDays(strtotime($cp->date_debut),strtotime($cp->date_fin)).'</td>';
|
||||
print '<td>'.num_open_day($cp->date_debut,$cp->date_fin,0,1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
@ -911,7 +918,7 @@ elseif(isset($_GET['id']))
|
||||
} else {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DescCP').'</td>';
|
||||
print '<td><textarea name="description" class="flat" rows="2" cols="70">'.$cp->description.'</textarea></td>';
|
||||
print '<td><textarea name="description" class="flat" rows="'.ROWS_3.'" cols="70">'.$cp->description.'</textarea></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</tbody>';
|
||||
@ -953,24 +960,24 @@ elseif(isset($_GET['id']))
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateCreateCP').'</td>';
|
||||
print '<td>'.$cp->date_create.'</td>';
|
||||
print '<td>'.dol_print_date($cp->date_create,'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
if($cp->statut == 3) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateValidCP').'</td>';
|
||||
print '<td>'.$cp->date_valid.'</td>';
|
||||
print '<td>'.dol_print_date($cp->date_valid,'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if($cp->statut == 4) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateCancelCP').'</td>';
|
||||
print '<td>'.$cp->date_cancel.'</td>';
|
||||
print '<td>'.dol_print_date($cp->date_cancel,'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if($cp->statut == 5) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateRefusCP').'</td>';
|
||||
print '<td>'.$cp->date_refuse.'</td>';
|
||||
print '<td>'.dol_print_date($cp->date_refuse,'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</tbody>';
|
||||
|
||||
@ -292,7 +292,9 @@ if (! empty($holiday->holiday))
|
||||
print '<td>'.$validator->getNomUrl('1').'</td>';
|
||||
print '<td style="text-align: center;">'.$infos_CP['date_debut'].'</td>';
|
||||
print '<td style="text-align: center;">'.$infos_CP['date_fin'].'</td>';
|
||||
print '<td>'.$holiday->getOpenDays(strtotime($infos_CP['date_debut']),strtotime($infos_CP['date_fin'])).' '.$langs->trans('Jours').'</td>';
|
||||
print '<td>';
|
||||
$nbopenedday=num_open_day($infos_CP['date_debut'],$infos_CP['date_fin'],0,1);
|
||||
print $nbopenedday.' '.$langs->trans('Jours');
|
||||
print '<td align="center"><a href="./fiche.php?id='.$infos_CP['rowid'].'">'.$statut.'</a></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@ if(!$user->rights->holiday->month_report) accessforbidden();
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
$cp = new Holiday($db);
|
||||
@ -53,10 +52,10 @@ $month = GETPOST('month_start');
|
||||
$year = GETPOST('year_start');
|
||||
|
||||
if(empty($month)) {
|
||||
$month = date('m');
|
||||
$month = date('m');
|
||||
}
|
||||
if(empty($year)) {
|
||||
$year = date('Y');
|
||||
$year = date('Y');
|
||||
}
|
||||
|
||||
$sql = "SELECT cp.fk_user, cp.date_debut, cp.date_fin";
|
||||
@ -65,7 +64,7 @@ $sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
|
||||
$sql.= " WHERE cp.rowid > '0'";
|
||||
$sql.= " AND cp.statut = 3";
|
||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '$year-$month'
|
||||
OR date_format(cp.date_fin, '%Y-%m') = '$year-$month')";
|
||||
OR date_format(cp.date_fin, '%Y-%m') = '$year-$month')";
|
||||
$sql.= " ORDER BY u.name,cp.date_debut";
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -78,7 +77,7 @@ print '<div class="tabBar">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
print 'Choix mois : <input class="flat" type="text" size="1" maxlength="2"
|
||||
name="month_start" value="'.$month.'"> ';
|
||||
name="month_start" value="'.$month.'"> ';
|
||||
$htmlother->select_year($year,'year_start',1,10,3);
|
||||
|
||||
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
||||
@ -90,47 +89,50 @@ print '<br />';
|
||||
$var=true;
|
||||
print '<table class="noborder" width="40%;">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Employee').'</td>';
|
||||
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
||||
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
||||
print '<td>'.$langs->trans('nbJours').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Employee').'</td>';
|
||||
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
||||
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
||||
print '<td>'.$langs->trans('nbJours').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if($num == '0') {
|
||||
if($num == '0') {
|
||||
|
||||
print '<tr class="pair">';
|
||||
print '<td colspan="4" style="text-align: center; padding: 3px;">'.$langs->trans('NoCPforMonth').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td colspan="4" style="text-align: center; padding: 3px;">'.$langs->trans('NoCPforMonth').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
while($holiday = $db->fetch_array($result)){
|
||||
$user = new User($db);
|
||||
$user->fetch($holiday['fk_user']);
|
||||
$var=!$var;
|
||||
while($holiday = $db->fetch_array($result)){
|
||||
$user = new User($db);
|
||||
$user->fetch($holiday['fk_user']);
|
||||
$var=!$var;
|
||||
|
||||
if(substr($holiday['date_debut'],5,2)==$month-1){
|
||||
$holiday['date_debut'] = date('Y-'.$month.'-01');
|
||||
}
|
||||
if(substr($holiday['date_debut'],5,2)==$month-1){
|
||||
$holiday['date_debut'] = date('Y-'.$month.'-01');
|
||||
}
|
||||
|
||||
if(substr($holiday['date_fin'],5,2)==$month+1){
|
||||
$holiday['date_fin'] = date('Y-'.$month.'-t');
|
||||
}
|
||||
if(substr($holiday['date_fin'],5,2)==$month+1){
|
||||
$holiday['date_fin'] = date('Y-'.$month.'-t');
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$user->nom.' '.$user->prenom.'</td>';
|
||||
print '<td>'.$holiday['date_debut'].'</td>';
|
||||
print '<td>'.$holiday['date_fin'].'</td>';
|
||||
print '<td>'.$cp->getOpenDays(strtotime($holiday['date_debut']),strtotime($holiday['date_fin'])).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$user->nom.' '.$user->prenom.'</td>';
|
||||
print '<td>'.$holiday['date_debut'].'</td>';
|
||||
print '<td>'.$holiday['date_fin'].'</td>';
|
||||
print '<td>';
|
||||
$nbopenedday=num_open_day($holiday['date_debut'],$holiday['date_fin'],0,1);
|
||||
print $nbopenedday;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -92,7 +92,7 @@ ALTER TABLE llx_commandedet ADD COLUMN label varchar(255) DEFAULT NULL AFTER fk_
|
||||
ALTER TABLE llx_facturedet ADD COLUMN label varchar(255) DEFAULT NULL AFTER fk_product;
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN label varchar(255) DEFAULT NULL AFTER product_type;
|
||||
|
||||
ALTER TABLE llx_accountingaccount ADD COLUMN active tinyint DEFAULT 1 NOT NULL AFTER label;
|
||||
ALTER TABLE llx_accountingaccount ADD COLUMN active tinyint DEFAULT 1 NOT NULL AFTER label;
|
||||
|
||||
ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32);
|
||||
|
||||
@ -122,59 +122,66 @@ ALTER TABLE llx_element_tag ADD UNIQUE INDEX uk_element_tag (entity, lang, tag,
|
||||
|
||||
CREATE TABLE llx_holiday_config
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR( 255 ) NOT NULL UNIQUE,
|
||||
value TEXT NULL
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name varchar(255) NOT NULL UNIQUE,
|
||||
value text NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday_events
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT ,
|
||||
name VARCHAR( 255 ) NOT NULL ,
|
||||
value TEXT NOT NULL
|
||||
rowid integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
value text NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
ALTER TABLE llx_holiday_events ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||
ALTER TABLE llx_holiday_events ADD UNIQUE INDEX uk_holiday_name (name, entity);
|
||||
|
||||
CREATE TABLE llx_holiday_logs
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
date_action DATETIME NOT NULL ,
|
||||
fk_user_action INT( 11 ) NOT NULL ,
|
||||
fk_user_update INT( 11 ) NOT NULL ,
|
||||
type_action VARCHAR( 255 ) NOT NULL ,
|
||||
prev_solde VARCHAR( 255 ) NOT NULL ,
|
||||
new_solde VARCHAR( 255 ) NOT NULL
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
date_action datetime NOT NULL ,
|
||||
fk_user_action integer NOT NULL ,
|
||||
fk_user_update integer NOT NULL ,
|
||||
type_action varchar(255) NOT NULL ,
|
||||
prev_solde varchar(255) NOT NULL ,
|
||||
new_solde varchar(255) NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE llx_holiday_users
|
||||
(
|
||||
fk_user INT( 11 ) NOT NULL PRIMARY KEY,
|
||||
nb_holiday FLOAT( 5 ) NOT NULL DEFAULT '0'
|
||||
fk_user integer NOT NULL PRIMARY KEY,
|
||||
nb_holiday real NOT NULL DEFAULT '0'
|
||||
)
|
||||
ENGINE=innodb;
|
||||
ALTER TABLE llx_holiday_users MODIFY COLUMN nb_holiday real NOT NULL DEFAULT '0';
|
||||
|
||||
CREATE TABLE llx_holiday
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user INT( 11 ) NOT NULL ,
|
||||
date_create DATETIME NOT NULL ,
|
||||
description VARCHAR( 255 ) NOT NULL ,
|
||||
date_debut DATE NOT NULL ,
|
||||
date_fin DATE NOT NULL ,
|
||||
statut INT( 11 ) NOT NULL DEFAULT '1',
|
||||
fk_validator INT( 11 ) NOT NULL ,
|
||||
date_valid DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_valid INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_refuse DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_refuse INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_cancel DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_cancel INT( 11 ) NULL DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) NULL DEFAULT NULL
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user integer NOT NULL ,
|
||||
date_create datetime NOT NULL ,
|
||||
description varchar(255) NOT NULL ,
|
||||
date_debut date NOT NULL ,
|
||||
date_fin date NOT NULL ,
|
||||
statut integer NOT NULL DEFAULT '1',
|
||||
fk_validator integer NOT NULL ,
|
||||
date_valid datetime DEFAULT NULL ,
|
||||
fk_user_valid integer DEFAULT NULL ,
|
||||
date_refuse datetime DEFAULT NULL ,
|
||||
fk_user_refuse integer DEFAULT NULL ,
|
||||
date_cancel datetime DEFAULT NULL ,
|
||||
fk_user_cancel integer DEFAULT NULL,
|
||||
detail_refuse varchar(250) DEFAULT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user (fk_user);
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut);
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_fin (date_fin);
|
||||
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'userGroup', NULL);
|
||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'lastUpdate', NULL);
|
||||
@ -259,3 +266,9 @@ UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, local
|
||||
UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 105 and fk_pays= 10 AND localtax1_type='0';
|
||||
UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 106 and fk_pays= 10 AND localtax1_type='0';
|
||||
UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 107 and fk_pays= 10 AND localtax1_type='0';
|
||||
|
||||
-- Modify table for accountancy
|
||||
ALTER TABLE llx_c_tva DROP COLUMN accountancy_code;
|
||||
ALTER TABLE llx_c_tva ADD COLUMN accountancy_code_sell varchar(15) DEFAULT NULL AFTER active;
|
||||
ALTER TABLE llx_c_tva ADD COLUMN accountancy_code_buy varchar(15) DEFAULT NULL AFTER accountancy_code_sell;
|
||||
ALTER TABLE llx_c_chargessociales ADD COLUMN accountancy_code varchar(15) DEFAULT NULL AFTER code;
|
||||
|
||||
@ -24,6 +24,7 @@ create table llx_c_chargesociales
|
||||
deductible smallint DEFAULT 0 NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
code varchar(12) NOT NULL,
|
||||
accountancy_code varchar(15) DEFAULT NULL,
|
||||
fk_pays integer DEFAULT 1 NOT NULL,
|
||||
module varchar(32) NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -29,7 +30,7 @@ create table llx_c_tva
|
||||
recuperableonly integer NOT NULL DEFAULT 0,
|
||||
note varchar(128),
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
accountancy_code varchar(15) DEFAULT NULL
|
||||
|
||||
accountancy_code_sell varchar(15) DEFAULT NULL,
|
||||
accountancy_code_buy varchar(15) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
21
htdocs/install/mysql/tables/llx_holiday.key.sql
Normal file
21
htdocs/install/mysql/tables/llx_holiday.key.sql
Normal file
@ -0,0 +1,21 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user (fk_user);
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut);
|
||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_fin (date_fin);
|
||||
@ -1,19 +1,37 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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_holiday
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user INT( 11 ) NOT NULL ,
|
||||
date_create DATETIME NOT NULL ,
|
||||
description VARCHAR( 255 ) NOT NULL ,
|
||||
date_debut DATE NOT NULL ,
|
||||
date_fin DATE NOT NULL ,
|
||||
statut INT( 11 ) NOT NULL DEFAULT '1',
|
||||
fk_validator INT( 11 ) NOT NULL ,
|
||||
date_valid DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_valid INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_refuse DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_refuse INT( 11 ) NULL DEFAULT NULL ,
|
||||
date_cancel DATETIME NULL DEFAULT NULL ,
|
||||
fk_user_cancel INT( 11 ) NULL DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) NULL DEFAULT NULL
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user integer NOT NULL,
|
||||
date_create DATETIME NOT NULL,
|
||||
description VARCHAR( 255 ) NOT NULL,
|
||||
date_debut DATE NOT NULL,
|
||||
date_fin DATE NOT NULL,
|
||||
statut integer NOT NULL DEFAULT '1',
|
||||
fk_validator integer NOT NULL,
|
||||
date_valid DATETIME DEFAULT NULL,
|
||||
fk_user_valid integer DEFAULT NULL,
|
||||
date_refuse DATETIME DEFAULT NULL,
|
||||
fk_user_refuse integer DEFAULT NULL,
|
||||
date_cancel DATETIME DEFAULT NULL,
|
||||
fk_user_cancel integer DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) DEFAULT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
@ -1,6 +1,24 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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_holiday_config
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR( 255 ) NOT NULL UNIQUE,
|
||||
value TEXT NULL
|
||||
)
|
||||
|
||||
19
htdocs/install/mysql/tables/llx_holiday_events.key.sql
Normal file
19
htdocs/install/mysql/tables/llx_holiday_events.key.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
ALTER TABLE llx_holiday_events ADD UNIQUE INDEX uk_holiday_name (name, entity);
|
||||
@ -1,7 +1,26 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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_holiday_events
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL PRIMARY KEY AUTO_INCREMENT ,
|
||||
name VARCHAR( 255 ) NOT NULL ,
|
||||
value TEXT NOT NULL
|
||||
rowid integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
name VARCHAR( 255 ) NOT NULL,
|
||||
value TEXT NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
@ -1,11 +1,29 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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_holiday_logs
|
||||
(
|
||||
rowid INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
date_action DATETIME NOT NULL ,
|
||||
fk_user_action INT( 11 ) NOT NULL ,
|
||||
fk_user_update INT( 11 ) NOT NULL ,
|
||||
type_action VARCHAR( 255 ) NOT NULL ,
|
||||
prev_solde VARCHAR( 255 ) NOT NULL ,
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
date_action DATETIME NOT NULL,
|
||||
fk_user_action integer NOT NULL,
|
||||
fk_user_update integer NOT NULL,
|
||||
type_action VARCHAR( 255 ) NOT NULL,
|
||||
prev_solde VARCHAR( 255 ) NOT NULL,
|
||||
new_solde VARCHAR( 255 ) NOT NULL
|
||||
)
|
||||
ENGINE=innodb;
|
||||
@ -1,6 +1,24 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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_holiday_users
|
||||
(
|
||||
fk_user INT( 11 ) NOT NULL PRIMARY KEY,
|
||||
nb_holiday FLOAT( 5 ) NOT NULL DEFAULT '0'
|
||||
fk_user integer NOT NULL PRIMARY KEY,
|
||||
nb_holiday real NOT NULL DEFAULT '0'
|
||||
)
|
||||
ENGINE=innodb;
|
||||
@ -84,7 +84,8 @@ NewSoldeCP=New Balance
|
||||
alreadyCPexist=A request for holidays has already been done on this period.
|
||||
UserName=Name
|
||||
Employee=Employee
|
||||
|
||||
FirstDayOfHoliday=First day of holiday
|
||||
LastDayOfHoliday=Last day of holiday
|
||||
|
||||
## Configuration du Module ##
|
||||
ConfCP=Configuration of holidays module
|
||||
|
||||
@ -1303,7 +1303,9 @@ Buy=Achat
|
||||
Sell=Vente
|
||||
InvoiceDateUsed=Date de facture utilisée
|
||||
YourCompanyDoesNotUseVAT=Votre institution est configurée comme non assujettie à la TVA (Accueil - Configuration - Société/Institution), aussi il n'y a aucune option sur la gestion TVA à paramétrer.
|
||||
AccountancyCode=Code compta
|
||||
AccountancyCode=Code compta
|
||||
AccountancyCodeSell=Code compta vente
|
||||
AccountancyCodeBuy=Code compta achat
|
||||
##### Agenda #####
|
||||
AgendaSetup= Configuration du module actions et agenda
|
||||
PasswordTogetVCalExport= Clé pour autoriser lien export
|
||||
|
||||
@ -84,7 +84,8 @@ NewSoldeCP=Nouveau Solde
|
||||
alreadyCPexist=Une demande de congés à déjà été effectuée sur cette période.
|
||||
UserName=Nom Prénom
|
||||
Employee=Salarié
|
||||
|
||||
FirstDayOfHoliday=Premier jour de congès
|
||||
LastDayOfHoliday=Dernier jour de congès
|
||||
|
||||
## Configuration du Module ##
|
||||
ConfCP=Configuration du module Congés
|
||||
|
||||
@ -250,7 +250,7 @@ MonthOfDay=Mois du jour
|
||||
HourShort=H
|
||||
Rate=Taux
|
||||
UseLocalTax=Inclure taxe
|
||||
LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:<br>1 : local tax apply on products and services without vat (vat is not applied on local tax)<br>2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)<br>3 : local tax apply on products without vat (vat is not applied on local tax)<br>4 : local tax apply on products before vat (vat is calculated on amount + localtax)<br>5 : local tax apply on services without vat (vat is not applied on local tax)<br>6 : local tax apply on services before vat (vat is calculated on amount + localtax)<br>7 : local tax is a fix amount applied on global invoice
|
||||
LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:<br>1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)<br>3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)<br>4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)<br>5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale)<br>7 : la taxe locale est un montant fixe ajouté au total de la facture
|
||||
Bytes=Octets
|
||||
KiloBytes=Kilooctets
|
||||
MegaBytes=Mégaoctets
|
||||
|
||||
@ -113,6 +113,47 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testNumBetweenDay
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNumBetweenDay()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
// With same hours
|
||||
$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
|
||||
$date2=dol_mktime(0, 0, 0, 1, 2, 2012);
|
||||
|
||||
$result=num_between_day($date1,$date2,1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(2,$result);
|
||||
|
||||
$result=num_between_day($date1,$date2,0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1,$result);
|
||||
|
||||
// With different hours
|
||||
$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
|
||||
$date2=dol_mktime(12, 0, 0, 1, 2, 2012);
|
||||
|
||||
$result=num_between_day($date1,$date2,1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(2,$result);
|
||||
|
||||
$result=num_between_day($date1,$date2,0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1,$result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testConvertTime2Seconds
|
||||
*
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file test/phpunit/_NumberingModulesTest.php
|
||||
* \file test/phpunit/NumberingModulesTest.php
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
@ -129,7 +129,6 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
||||
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/mod_facture_mercure.php';
|
||||
|
||||
|
||||
// First we try with a simple mask, with no reset
|
||||
// and we test counter is still increase second year.
|
||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
|
||||
@ -137,21 +136,21 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1900); // we use year 1900 to be sure to not have existing invoice for this year
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
$result2=$localobject->create($user,1);
|
||||
$result3=$localobject->validate($user, $result);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('1900-0001', $result); // counter must start to 1
|
||||
$this->assertEquals('1915-0001', $result); // counter must start to 1
|
||||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1901); // we use following year for second invoice
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('1901-0002', $result); // counter must not be reset
|
||||
$this->assertEquals('1916-0002', $result); // counter must not be reset
|
||||
|
||||
// Now we try with a reset
|
||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user