Merge branch 'develop' into new_branch_13_09_2018

This commit is contained in:
Philippe Grand 2018-09-27 09:42:58 +02:00 committed by GitHub
commit 031b3b44c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
351 changed files with 39234 additions and 36505 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ dolibarr_install.log
upgrade.log upgrade.log
doxygen_warnings.log doxygen_warnings.log
/.project /.project
/.vscode
.DS_Store .DS_Store
.idea .idea
*.iml *.iml

View File

@ -8,6 +8,7 @@ For Users:
NEW: Stable module: Website NEW: Stable module: Website
NEW: Stable module: WebDAV NEW: Stable module: WebDAV
NEW: Stable module: Module Builder NEW: Stable module: Module Builder
NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more tools.
NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making
Android application like DoliDroid able to provide native features for multicompany module. Android application like DoliDroid able to provide native features for multicompany module.
@ -24,6 +25,40 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 8.0.2 compared to 8.0.1 *****
FIX: #8452
FIX: #9043
FIX: #9316 Error when listing invoices
FIX: #9317
FIX: #9353 Bug: html error - div inside span on graphs
FIX: #9355
FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES
FIX: #9394
FIX: #9396
FIX: #9403
FIX: #9412
FIX: #9497
FIX: Add paypal error message in alert email when online payment fails.
FIX: better compatibility with multicompany
FIX: capital must be empty and not 0 if undefined
FIX: character making error on bill list
FIX: Entering negative price on order.
FIX: Expedition not showing extrafields on creation.
FIX: Homepage links were using wrong topmenus
FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES
FIX: invert mime type and name.
FIX: invoice popup hide localtax2 and 3 if not defined.
FIX: Lose filter on payment type or category after a sort on invoice list.
FIX: Maxi debug to allow to load chart of account with multicompany.
FIX: Missing translation in predefined email to membership renewal.
FIX: Mixing tickets of different thirdparties.
FIX: "Other ..." link so the "Back to" link works.
FIX: PDF address: handle when contact thirdparty is different from thirdparty of document
FIX: Problems with permissions of module to record payment of salaries
FIX: remove debug
FIX: Several fixes on the management of minimal amount for orders
FIX: wrong var name
***** ChangeLog for 8.0.1 compared to 8.0.0 ***** ***** ChangeLog for 8.0.1 compared to 8.0.0 *****
FIX: #9258 FIX: #9258
FIX: #9328 FIX: #9328

View File

@ -295,6 +295,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0; if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0; if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0;
if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0;
// admin.lang // admin.lang
if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0; if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0;
if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0; if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0;

View File

@ -63,9 +63,9 @@ if (! $sortorder) $sortorder = "ASC";
$arrayfields=array( $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
); );
@ -122,16 +122,34 @@ if (empty($reshook))
{ {
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql'; $sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
// FIXME Get the ADD rowid and pass it + num of comapny * 100 000 000 to run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. $offsetforchartofaccount = 0;
// Get the comment line '-- ADD CCCNNNNN to rowid...' to find CCCNNNNN (CCC is country num, NNNNN is id of accounting account)
// and pass CCCNNNNN + (num of company * 100 000 000) as offset to the run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value.
// This is to be sure there is no conflict for each chart of account, whatever is country, whatever is company when multicompany is used.
$tmp = file_get_contents($sqlfile);
if (preg_match('/-- ADD (\d+) to rowid/ims', $tmp, $reg))
{
$offsetforchartofaccount += $reg[1];
}
$offsetforchartofaccount+=($conf->entity * 100000000);
$result = run_sql($sqlfile, 1, 0, 1); $result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount);
if ($result > 0)
{
setEventMessages($langs->trans("ChartLoaded"), null);
}
else
{
setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings');
}
} }
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} else { } else {
$error ++; $error++;
} }
} }

View File

@ -761,7 +761,7 @@ class AccountancyCategory // extends CommonObject
* Return list of personalized groups that are active * Return list of personalized groups that are active
* *
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array Array of groups * @return array|int Array of groups or -1 if error
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
@ -818,7 +818,7 @@ class AccountancyCategory // extends CommonObject
* *
* @param int $cat_id Id if personalized accounting group/category * @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array Array of accounting accounts * @return array|int Array of accounting accounts or -1 if error
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {

View File

@ -35,7 +35,7 @@ class lettering extends BookKeeping
* lettrageTiers * lettrageTiers
* *
* @param int $socid Thirdparty id * @param int $socid Thirdparty id
* @return void * @return int 1 OK, <0 error
*/ */
public function lettrageTiers($socid) public function lettrageTiers($socid)
{ {

View File

@ -2019,52 +2019,47 @@ class Adherent extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == -1) return $langs->trans("MemberStatusDraft"); if ($statut == -1) return $langs->trans("MemberStatusDraft");
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); if (! $date_end_subscription) return $langs->trans("MemberStatusActive");
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate");
else return $langs->trans("MemberStatusPaid"); else return $langs->trans("MemberStatusPaid");
} }
if ($statut == 0) return $langs->trans("MemberStatusResiliated"); elseif ($statut == 0) return $langs->trans("MemberStatusResiliated");
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); if ($statut == -1) return $langs->trans("MemberStatusDraftShort");
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort");
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort");
else return $langs->trans("MemberStatusPaidShort"); else return $langs->trans("MemberStatusPaidShort");
} }
if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort");
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort");
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort");
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort");
else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort");
} }
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort");
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0');
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1');
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3');
else return img_picto($langs->trans('MemberStatusPaid'),'statut4'); else return img_picto($langs->trans('MemberStatusPaid'),'statut4');
} }
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft");
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive");
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate");
else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid");
@ -2074,8 +2069,7 @@ class Adherent extends CommonObject
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0');
if ($statut >= 1) elseif ($statut >= 1) {
{
if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1');
elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3');
else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4');
@ -2085,8 +2079,7 @@ class Adherent extends CommonObject
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0');
if ($statut >= 1) if ($statut >= 1) {
{
if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1');
elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3');
else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4');
@ -2107,7 +2100,7 @@ class Adherent extends CommonObject
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$this->nb=array(); $this->nb = array();
$sql = "SELECT count(a.rowid) as nb"; $sql = "SELECT count(a.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";

View File

@ -356,7 +356,7 @@ print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n"; print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n"; print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n"; print '<td align="right">'."\n";
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); $tmplist=array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -766,7 +766,13 @@ else
// Web // Web
print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>';
$arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB);
foreach($arrayofurl as $urltoshow)
{
if ($urltoshow) print dol_print_url($urltoshow,'_blank',80);
}
print '</td></tr>';
// Barcode // Barcode
if (! empty($conf->barcode->enabled)) if (! empty($conf->barcode->enabled))

View File

@ -951,7 +951,6 @@ if (empty($id))
print $langs->trans("DictionaryDesc"); print $langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
} }
print "<br>\n";
$param = '&id='.urlencode($id); $param = '&id='.urlencode($id);
@ -1016,6 +1015,13 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION))
{
print info_admin($langs->trans("VATIsUsedIsOff", $langs->transnoentities("Setup"), $langs->transnoentities("CompanyFoundation")));
}
print "<br>\n";
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {

View File

@ -89,6 +89,14 @@ print '<br>';
// Show info setup module // Show info setup module
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
/*
$nbofactivatedmodules=count($conf->modules);
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
print '<br>'.$moreinfo;
*/
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{ {
$langs->load("errors"); $langs->load("errors");

View File

@ -272,14 +272,13 @@ $dirins_ok=(dol_is_dir($dirins));
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0); llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0);
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
$arrayofwarnings=array(); // Array of warning each module want to show when activated
$arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module
// Search modules dirs // Search modules dirs
$modulesdir = dolGetModulesDirs(); $modulesdir = dolGetModulesDirs();
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
$arrayofwarnings=array(); // Array of warning each module want to show when activated
$arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module
$filename = array(); $filename = array();
$modules = array(); $modules = array();
$orders = array(); $orders = array();
@ -847,6 +846,8 @@ if ($mode == 'common')
dol_fiche_end(); dol_fiche_end();
print '<br>';
// Show warning about external users // Show warning about external users
print info_admin(showModulesExludedForExternal($modules))."\n"; print info_admin(showModulesExludedForExternal($modules))."\n";
@ -1063,7 +1064,7 @@ if ($mode == 'develop')
//print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">'; //print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">';
print '<div class="imgmaxheight50 logo_setup"></div>'; print '<div class="imgmaxheight50 logo_setup"></div>';
print '</td>'; print '</td>';
print '<td>'.$langs->trans("TryToUseTheModuleBuilder").'</td>'; print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
print '<td>'.$langs->trans("SeeTopRightMenu").'</td>'; print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
print '</tr>'; print '</tr>';

View File

@ -342,7 +342,7 @@ if ($mode == 'test' && $user->admin)
$langs->load($driver); $langs->load($driver);
$printer = new $classname($db); $printer = new $classname($db);
//print '<pre>'.print_r($printer, true).'</pre>'; //print '<pre>'.print_r($printer, true).'</pre>';
if (count($printer->getlist_available_printers())) { if (count($printer->getlistAvailablePrinters())) {
if ($printer->listAvailablePrinters()==0) { if ($printer->listAvailablePrinters()==0) {
print $printer->resprint; print $printer->resprint;
} else { } else {

View File

@ -67,6 +67,8 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity);
@ -572,31 +574,36 @@ else // Show
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
//Desc // Hide Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">'; print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
print '</td></tr>'; print '</td></tr>';
//Ref // Hide Ref
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">'; print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
print '</td></tr>'; print '</td></tr>';
//Details // Hide Details
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">'; print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
print '</td></tr>'; print '</td></tr>';
// Invert sender and recipient
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT,1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">'; // Use French location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1); print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">'; print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)]; print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
print '</td></tr>'; print '</td></tr>';

View File

@ -0,0 +1,123 @@
<?php
/* Copyright (C) 2018 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/socialnetworks.php
* \ingroup socialnetworks
* \brief Page to setup the module Social Networks
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "errors"));
if (! $user->admin) accessforbidden();
$type=array('yesno','texte','chaine');
$action = GETPOST('action','aZ09');
/*
* Actions
*/
// Action activation d'un sous module du module adherent
if ($action == 'set')
{
$result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
if ($result < 0)
{
dol_print_error($db);
}
}
// Action desactivation d'un sous module du module adherent
if ($action == 'unset')
{
$result=dolibarr_del_const($db, $_GET["name"], $conf->entity);
if ($result < 0)
{
dol_print_error($db);
}
}
/*
* View
*/
$help_url='';
llxHeader('',$langs->trans("SocialNetworkSetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SocialNetworkSetup"),$linkback,'title_setup');
//$head = socialnetworks_admin_prepare_head();
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/socialnetworks.php';
$head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'setup', '', 0, 'user');
print '<br>';
$arrayofsocialnetworks=array('skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
foreach($arrayofsocialnetworks as $snkey => $snlabel)
{
$consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey);
if (! empty($conf->global->$consttocheck))
{
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name='.$consttocheck.'">';
//$link.=$langs->trans("Disable");
$link.=img_picto($langs->trans("Activated"),'switch_on');
$link.='</a>';
}
else
{
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name='.$consttocheck.'">';
//$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>';
}
print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'<br><br>';
}
dol_fiche_end();
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -156,7 +156,8 @@ $i=0;
foreach($_SESSION as $key => $val) foreach($_SESSION as $key => $val)
{ {
if ($i > 0) print ', '; if ($i > 0) print ', ';
print $key.' => '.dol_escape_htmltag($val); if (is_array($val)) print $key.' => array(...)';
else print $key.' => '.dol_escape_htmltag($val);
$i++; $i++;
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -337,7 +337,13 @@ if (! $error && $xml)
$i++; $i++;
$out.='<tr class="oddeven">'; $out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n"; $out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n"; $out.='<td>'.$file['filename'];
$out.=PHP_OS;
if (! preg_match('/^win/i',PHP_OS)) {
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm');
}
$out.='</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n"; $out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
$out.='<td align="center">'.$file['md5'].'</td>' . "\n"; $out.='<td align="center">'.$file['md5'].'</td>' . "\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);

View File

@ -372,32 +372,32 @@ class Asset extends CommonObject
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
} }

View File

@ -52,7 +52,6 @@ class BlockedLogAuthority
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }

View File

@ -46,6 +46,9 @@ class BlockedLog
*/ */
public $entity; public $entity;
/**
* @var string Error message
*/
public $error = ''; public $error = '';
/** /**

View File

@ -44,6 +44,7 @@ $origin = GETPOST('origin','alpha');
$catorigin = GETPOST('catorigin','int'); $catorigin = GETPOST('catorigin','int');
$type = GETPOST('type','alpha'); $type = GETPOST('type','alpha');
$urlfrom = GETPOST('urlfrom','alpha'); $urlfrom = GETPOST('urlfrom','alpha');
$backtopage = GETPOST('backtopage','alpha');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
$label=GETPOST('label'); $label=GETPOST('label');
@ -173,6 +174,11 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr
header("Location: ".$urlfrom); header("Location: ".$urlfrom);
exit; exit;
} }
elseif ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
else if ($idProdOrigin) else if ($idProdOrigin)
{ {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
@ -232,8 +238,9 @@ if ($user->rights->categorie->creer)
print '<input type="hidden" name="urlfrom" value="'.$urlfrom.'">'; print '<input type="hidden" name="urlfrom" value="'.$urlfrom.'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="addcat" value="addcat">'; print '<input type="hidden" name="addcat" value="addcat">';
print '<input type="hidden" name="id" value="'.GETPOST('origin').'">'; print '<input type="hidden" name="id" value="'.GETPOST('origin','alpha').'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($origin) print '<input type="hidden" name="origin" value="'.$origin.'">'; if ($origin) print '<input type="hidden" name="origin" value="'.$origin.'">';
if ($catorigin) print '<input type="hidden" name="catorigin" value="'.$catorigin.'">'; if ($catorigin) print '<input type="hidden" name="catorigin" value="'.$catorigin.'">';

View File

@ -65,8 +65,11 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss); llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
print load_fiche_titre($title); print load_fiche_titre($title, $newcardbutton);
//print '<table border="0" width="100%" class="notopnoleftnoright">'; //print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">'; //print '<tr><td valign="top" width="30%" class="notopnoleft">';
@ -170,6 +173,8 @@ foreach($fulltree as $key => $val)
} }
//print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1);
print '<table class="liste nohover" width="100%">'; print '<table class="liste nohover" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">'; print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -251,6 +252,19 @@ if ($action == 'add')
} }
} }
$object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
$taskid = GETPOST('taskid','int');
if(!empty($taskid)){
$taskProject = new Task($db);
if($taskProject->fetch($taskid)>0){
$object->fk_project = $taskProject->fk_project;
}
$object->fk_element = $taskid;
$object->elementtype = 'task';
}
$object->datep = $datep; $object->datep = $datep;
$object->datef = $datef; $object->datef = $datef;
$object->percentage = $percentage; $object->percentage = $percentage;
@ -877,10 +891,37 @@ if ($action == 'create')
// Projet associe // Projet associe
$langs->load("projects"); $langs->load("projects");
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>'; $projectid = GETPOST('projectid', 'int');
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container" >';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), GETPOST("projectid")?GETPOST("projectid"):'', 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
$urloption='?action=create';
$url = dol_buildpath('comm/action/card.php',2).$urloption;
// update task list
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#projectid").change(function () {
var url = "'.$url.'&projectid="+$("#projectid").val();
$.get(url, function(data) {
console.log($( data ).find("#taskid").html());
if (data) $("#taskid").html( $( data ).find("#taskid").html() ).select2();
})
});
})';
print '</script>'."\n";
print '</td></tr>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Task").'</td><td id="project-task-input-container" >';
$projectsListId=false;
if(!empty($projectid)){ $projectsListId=$projectid; }
$tid=GETPOST("projecttaskid")?GETPOST("projecttaskid"):'';
$formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500',$projectsListId);
print '</td></tr>'; print '</td></tr>';
} }
if (!empty($origin) && !empty($originid)) if (!empty($origin) && !empty($originid))
@ -1270,10 +1311,41 @@ if ($id > 0)
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("LinkedObject").'</td>'; print '<td>'.$langs->trans("LinkedObject").'</td>';
print '<td>'.dolGetElementUrl($object->fk_element,$object->elementtype,1);
print '<input type="hidden" name="fk_element" value="'.$object->fk_element.'">'; if ($object->elementtype == 'task' && ! empty($conf->projet->enabled))
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">'; {
print '</td>'; print '<td id="project-task-input-container" >';
$urloption='?action=create'; // we use create not edit for more flexibility
$url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption;
// update task list
print "\n".'<script type="text/javascript" >';
print '$(document).ready(function () {
$("#projectid").change(function () {
var url = "'.$url.'&projectid="+$("#projectid").val();
$.get(url, function(data) {
console.log($( data ).find("#fk_element").html());
if (data) $("#fk_element").html( $( data ).find("#taskid").html() ).select2();
})
});
})';
print '</script>'."\n";
$formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $object->fk_element, 'fk_element', 24, 0, 0, 1, 0, 0, 'maxwidth500',$object->fk_project);
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
}
else
{
print '<td>';
print dolGetElementUrl($object->fk_element,$object->elementtype,1);
print '<input type="hidden" name="fk_element" value="'.$object->fk_element.'">';
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
}
print '</tr>'; print '</tr>';
} }

View File

@ -1166,58 +1166,58 @@ class ActionComm extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
} }
else if ($mode == 1) elseif ($mode == 1)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
else if ($percent==0) return $langs->trans('StatusActionToDo'); elseif ($percent==0) return $langs->trans('StatusActionToDo');
else if ($percent > 0 && $percent < 100) return $percent.'%'; elseif ($percent > 0 && $percent < 100) return $percent.'%';
else if ($percent >= 100) return $langs->trans('StatusActionDone'); elseif ($percent >= 100) return $langs->trans('StatusActionDone');
} }
else if ($mode == 2) elseif ($mode == 2)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo'); elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo');
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%'; elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%';
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone'); elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone');
} }
else if ($mode == 3) elseif ($mode == 3)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1'); elseif ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1');
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3');
else if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6'); elseif ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6');
} }
else if ($mode == 4) elseif ($mode == 4)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)'; elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)';
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)'; elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)';
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)'; elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)';
} }
else if ($mode == 5) elseif ($mode == 5)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6');
} }
else if ($mode == 6) elseif ($mode == 6)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6');
} }
else if ($mode == 7) elseif ($mode == 7)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6');
} }
return ''; return '';
@ -1564,8 +1564,8 @@ class ActionComm extends CommonObject
// Write file // Write file
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); elseif ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp); elseif ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($result >= 0) if ($result >= 0)
{ {

View File

@ -189,32 +189,32 @@ class ActionCommReminder extends CommonObject
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {
if ($status == 1) return $langs->trans('Done'); if ($status == 1) return $langs->trans('Done');
if ($status == 0) return $langs->trans('ToDo'); elseif ($status == 0) return $langs->trans('ToDo');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
} }
} }

View File

@ -83,7 +83,7 @@ $resourceid=GETPOST("resourceid","int");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):0; $day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3); $pid=GETPOST("projectid","int",3);
$status=GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo' $status=GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo'
$type=GETPOST("type",'az09'); $type=GETPOST("type",'az09');
@ -101,20 +101,23 @@ else
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
if ($action == 'default') $defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=$defaultview;
if ($action == 'default') // When action is default, we want a calendar view and not the list
{ {
$action = ((! empty($conf->global->AGENDA_DEFAULT_VIEW) && $conf->global->AGENDA_DEFAULT_VIEW!='show_list') ? $conf->global->AGENDA_DEFAULT_VIEW : 'show_month'); $action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
} }
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { if (GETPOST('viewcal','none') && GETPOST('action','alpha') != 'show_day' && GETPOST('action','alpha') != 'show_week') {
$action='show_month'; $day=''; $action='show_month'; $day='';
} // View by month } // View by month
if (GETPOST('viewweek') || $action == 'show_week') { if (GETPOST('viewweek','none') || GETPOST('action','alpha') == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week } // View by week
if (GETPOST('viewday') || $action == 'show_day') { if (GETPOST('viewday','none') || GETPOST('action','alpha') == 'show_day') {
$action='show_day'; $day=($day?$day:date("d")); $action='show_day'; $day=($day?$day:date("d"));
} // View by day } // View by day
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('agenda', 'other', 'commercial')); $langs->loadLangs(array('agenda', 'other', 'commercial'));

View File

@ -666,6 +666,8 @@ if ($object->id > 0)
*/ */
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{ {
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
$sql.= ", p.tva as total_tva"; $sql.= ", p.tva as total_tva";
$sql.= ", p.total as total_ttc"; $sql.= ", p.total as total_ttc";
@ -674,7 +676,7 @@ if ($object->id > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql.= " AND s.rowid = ".$object->id; $sql.= " AND s.rowid = ".$object->id;
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity IN (".getEntity('propal').")";
$sql.= " ORDER BY p.datep DESC"; $sql.= " ORDER BY p.datep DESC";
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -874,7 +874,7 @@ else
} }
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlright=''; $morehtmlright='';
$nbtry = $nbok = 0; $nbtry = $nbok = 0;

View File

@ -530,6 +530,81 @@ class Mailing extends CommonObject
} }
/**
* Return a link to the object card (with optionaly the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = '';
$companylink = '';
$label = '<u>' . $langs->trans("ShowEmailing") . '</u>';
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowEmailing");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
/*
$hookmanager->initHooks(array('myobjectdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
*/
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array('emailingdao'));
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
$reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
return $result;
}
/** /**
* Return label of status of emailing (draft, validated, ...) * Return label of status of emailing (draft, validated, ...)
* *

View File

@ -35,15 +35,15 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="m.date_creat"; if (! $sortfield) $sortfield="m.date_creat";
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sref=GETPOST("sref", "alpha"); $search_ref=GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
$filteremail=GETPOST('filteremail','alpha'); $filteremail=GETPOST('filteremail','alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -59,6 +59,53 @@ $fieldstosearchall = array(
'm.titre'=>'Ref', 'm.titre'=>'Ref',
); );
$object = new Mailing($db);
/*
* Actions
*/
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
/*foreach($object->fields as $key => $val)
{
$search[$key]='';
}*/
$search_ref = '';
$search_all = '';
$toselect='';
$search_array_options=array();
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
{
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
/*$objectclass='MyObject';
$objectlabel='MyObject';
$permtoread = $user->rights->mymodule->read;
$permtodelete = $user->rights->mymodule->delete;
$uploaddir = $conf->mymodule->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
*/
}
/* /*
@ -76,8 +123,8 @@ if ($filteremail)
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity; $sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
$sql.= " AND mc.email = '".$db->escape($filteremail)."'"; $sql.= " AND mc.email = '".$db->escape($filteremail)."'";
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'"; if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')"; if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid"; if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -88,8 +135,8 @@ else
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE m.entity = ".$conf->entity; $sql.= " WHERE m.entity = ".$conf->entity;
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'"; if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')"; if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid"; if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -115,7 +162,7 @@ if ($result)
$i = 0; $i = 0;
$param = "&sall=".urlencode($sall); $param = "&search_all=".urlencode($search_all);
if ($filteremail) $param.='&filteremail='.urlencode($filteremail); if ($filteremail) $param.='&filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -135,11 +182,11 @@ if ($result)
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth50" name="sref" value="'.dol_escape_htmltag($sref).'">'; print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
// Title // Title
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="sall" value="'.dol_escape_htmltag($sall).'">'; print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>'; if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>';
@ -169,16 +216,22 @@ if ($result)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$email->id = $obj->rowid;
$email->ref = $obj->rowid;
print "<tr>"; print "<tr>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).'</a></td>'; print '<td>';
print $email->getNomUrl(1);
print '</td>';
print '<td>'.$obj->titre.'</td>'; print '<td>'.$obj->titre.'</td>';
// Date creation // Date creation
print '<td align="center">'; print '<td align="center">';
print dol_print_date($db->jdate($obj->datec),'day'); print dol_print_date($db->jdate($obj->datec),'day');
print '</td>'; print '</td>';
// Nb of email // Nb of email
if (! $filteremail) if (! $filteremail)
{ {
@ -196,9 +249,11 @@ if ($result)
print $nbemail; print $nbemail;
print '</td>'; print '</td>';
} }
// Last send // Last send
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi),'day').'</td>'; print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi),'day').'</td>';
print '</td>'; print '</td>';
// Status // Status
print '<td align="right" class="nowrap">'; print '<td align="right" class="nowrap">';
if ($filteremail) if ($filteremail)
@ -210,7 +265,9 @@ if ($result)
print $email->LibStatut($obj->statut,5); print $email->LibStatut($obj->statut,5);
} }
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -1848,7 +1848,7 @@ if ($action == 'create')
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -13,6 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1032,6 +1033,7 @@ class Propal extends CommonObject
// Add linked object (deprecated, use ->linkedObjectsIds instead) // Add linked object (deprecated, use ->linkedObjectsIds instead)
if (! $error && $this->origin && $this->origin_id) if (! $error && $this->origin && $this->origin_id)
{ {
dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
$ret = $this->add_object_linked(); $ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db); if (! $ret) dol_print_error($this->db);
} }
@ -1104,13 +1106,6 @@ class Propal extends CommonObject
} }
} }
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
// Set delivery address // Set delivery address
if (! $error && $this->fk_delivery_address) if (! $error && $this->fk_delivery_address)
{ {
@ -3174,18 +3169,18 @@ class Propal extends CommonObject
$statuttrans=''; $statuttrans='';
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; elseif ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; elseif ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; elseif ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5';
if ($statut==self::STATUS_BILLED) $statuttrans='statut6'; elseif ($statut==self::STATUS_BILLED) $statuttrans='statut6';
if ($mode == 0) return $this->labelstatut[$statut]; if ($mode == 0) return $this->labelstatut[$statut];
if ($mode == 1) return $this->labelstatut_short[$statut]; elseif ($mode == 1) return $this->labelstatut_short[$statut];
if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; elseif ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut];
if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans);
if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; elseif ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut];
if ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans); elseif ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans);
if ($mode == 6) return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans); elseif ($mode == 6) return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans);
} }

View File

@ -1989,7 +1989,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -60,7 +60,8 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankcard','globalcard'));
/* /*
* Actions * Actions

View File

@ -1716,7 +1716,11 @@ class AccountLine extends CommonObject
public $fk_account; // Id of bank account public $fk_account; // Id of bank account
public $bank_account_label; // Label of bank account public $bank_account_label; // Label of bank account
public $emetteur; /**
* Issuer
* @var Societe
*/
public $emetteur;
/** /**
* Constructor * Constructor

View File

@ -49,6 +49,9 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; $vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
$page=isset($_GET["page"])?$_GET["page"]:0; $page=isset($_GET["page"])?$_GET["page"]:0;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('banktreso','globalcard'));
/* /*
* View * View
*/ */
@ -130,6 +133,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Remainder to pay in future // Remainder to pay in future
$sqls = array();
// Customer invoices // Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; $sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
@ -138,79 +142,55 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Supplier invoices // Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom as name, s.fournisseur"; $sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql2.= " WHERE ff.entity = ".$conf->entity; $sql.= " WHERE ff.entity = ".$conf->entity;
$sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid $sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
$sql2.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice $sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql2.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Social contributions // Social contributions
$sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; $sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
$sql3.= ", cs.fk_account"; $sql.= ", cs.fk_account";
$sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql3.= " WHERE cs.entity = ".$conf->entity; $sql.= " WHERE cs.entity = ".$conf->entity;
$sql3.= " AND cs.paye = 0"; // Not paid $sql.= " AND cs.paye = 0"; // Not paid
$sql3.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution $sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql3.= " ORDER BY dlr ASC"; $sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// others sql
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook) and isset($hookmanager->resArray['sql'])){
$sqls[] = $hookmanager->resArray['sql'];
}
$error=0; $error=0;
$tab_sqlobjOrder=array(); $tab_sqlobjOrder=array();
$tab_sqlobj=array(); $tab_sqlobj=array();
// List customer invoices foreach($sqls as $sql){
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if($resql){
{ while($sqlobj = $db->fetch_object($resql)){
$num = $db->num_rows($result); $tab_sqlobj[] = $sqlobj;
for ($i = 0;$i < $num;$i++) $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
{ }
$sqlobj = $db->fetch_object($result); $db->free($resql);
$tab_sqlobj[] = $sqlobj; }else{
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); $error++;
} }
$db->free($result); }
}
else $error++;
// List supplier invoices
$result2=$db->query($sql2);
if ($result2)
{
$num = $db->num_rows($result2);
for ($i = 0;$i < $num;$i++)
{
$sqlobj = $db->fetch_object($result2);
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($result2);
}
else $error++;
// List social contributions
$result3=$db->query($sql3);
if ($result3)
{
$num = $db->num_rows($result3);
for ($i = 0;$i < $num;$i++)
{
$sqlobj = $db->fetch_object($result3);
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($result3);
}
else $error++;
// Sort array // Sort array
if (! $error) if (! $error)
@ -228,7 +208,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$num = count($tab_sqlobj); $num = count($tab_sqlobj);
//$num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
@ -236,7 +215,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$ref = ''; $ref = '';
$refcomp = ''; $refcomp = '';
//$obj = $db->fetch_object($result);
$obj = array_shift($tab_sqlobj); $obj = array_shift($tab_sqlobj);
if ($obj->family == 'invoice_supplier') if ($obj->family == 'invoice_supplier')
@ -284,6 +262,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done $paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
} }
$parameters = array('obj' => $obj);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : '';
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : '';
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0;
}
$total_ttc = $obj->total_ttc; $total_ttc = $obj->total_ttc;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement; if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
$solde += $total_ttc; $solde += $total_ttc;
@ -291,8 +277,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// We discard lines with a remainder to pay to 0 // We discard lines with a remainder to pay to 0
if (price2num($total_ttc) != 0) if (price2num($total_ttc) != 0)
{ {
// Show line // Show line
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -315,15 +299,22 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
dol_print_error($db); dol_print_error($db);
} }
// Solde actuel // Other lines
$parameters = array('solde' => $solde);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
print $hookmanager->resPrint;
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
}
// solde
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$object->currency_code.')</td>'; print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$object->currency_code.')</td>';
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</td>'; print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
print "</div>"; print "</div>";
} }
else else
{ {

View File

@ -0,0 +1,310 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/recap-compta.php
* \ingroup compta
* \brief Page de fiche recap customer
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
restrictedArea($user,'banque');
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
$date_start =GETPOST('date_start','alpha');
$date_startDay= GETPOST('date_startday','int');
$date_startMonth= GETPOST('date_startmonth','int');
$date_startYear= GETPOST('date_startyear','int');
$date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start);
$date_stop =GETPOST('date_stop','alpha');
$date_stopDay= GETPOST('date_stopday','int');
$date_stopMonth= GETPOST('date_stopmonth','int');
$date_stopYear= GETPOST('date_stopyear','int');
//FIXME doldate
$date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop);
$action =GETPOST('action','alpha');
// Security check
//if ($user->societe_id) $id=$user->societe_id;
//$result = restrictedArea($user, 'societe', $id, '&societe');
//$object = new Societe($db);
//if ($id > 0) $object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('comptafilescard','globalcard'));
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field
if (! $sortorder) $sortorder="DESC";
$arrayfields=array(
'date'=>array('label'=>"Date", 'checked'=>1),
//...
);
/*
* Actions
*/
//$parameters = array('socid' => $id);
//$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks
//if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*
* Fetch the lines/files from db /
*/
$filesarray=array();
$result=false;
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
$sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport";
$sql.=" WHERE date_fin between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don";
$sql.=" WHERE datedon between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary";
$sql.=" WHERE datep between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge";
$sql.=" WHERE datep between ".$wheretail;
$resd = $db->query($sql);
$files=array();
$link='';
if ($resd)
{
$numd = $db->num_rows($resd);
$upload_dir ='';
$i=0;
while($i<$numd)
{
$objd = $db->fetch_object($resd);
switch($objd->item){
case "Invoice":
$subdir=dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->facture->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "InvoiceSupplier":
$subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Expense":
$subdir=dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->expensereport->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Salary":
$subdir=dol_sanitizeFileName($objd->id);
$upload_dir = $conf->salaries->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Donation":
$subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->id);
$upload_dir = $conf->don->dir_output . '/' . $subdir;
$link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Charge":
$subdir=dol_sanitizeFileName($objd->id);
$upload_dir = $conf->tax->dir_output . '/' . $subdir;
$link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F';
break;
default:
break;
}
if(!empty($upload_dir)){
$result=true;
$files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1);
foreach ($files as $key => $file){
$file['date']=$db->idate($objd->date);
$file['paid']=$objd->paid;
$file['amount']=$objd->total_ttc;
$file['ref']=$objd->ref;
$file['fk']=$objd->fk_soc;
$file['item']=$objd->item;
$file['link']=$link.$file['name'];
$out.= '<br><a href="'.$link.$file['name'].'">'.$file['name'].'</a>';
$filesarray[]=$file;
}
if(count($files)<1){
$nofile['date']=$db->idate($objd->date);
$nofile['paid']=$objd->paid;
$nofile['amount']=$objd->total_ttc;
$nofile['ref']=$objd->ref;
$nofile['fk']=$objd->fk_soc;
$nofile['item']=$objd->item;
$filesarray[]=$nofile;
}
}
$i++;
}
}
$db->free($resd);
}
/*
* cleanup of old ZIP
*/
//FIXME
/*
*ZIP creation
*/
if($result & $action=="dl"){
unset($zip);
$log='date,type,ref,total,paid,filename,item_id'."\n";
$zipname = ($date_start)."-".($date_stop).'_export.zip';
$zip = new ZipArchive;
$res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE);
if ($res){
foreach ($filesarray as $key=> $file) {
if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);//
$log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n";
}
$zip->addFromString('log.csv', $log);
$zip->close();
///Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipname);
header('Content-Length: ' . filesize($zipname));
readfile($zipname);
unlink($zipname);
exit();
}
}
// None
/*
* View
*/
$form = new Form($db);
$userstatic=new User($db);
$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List");
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME
llxHeader('',$title,$help_url);
print '<div><form name="searchfiles" action="?action=searchfiles'.$tail.'" method="POST" >'."\n\t\t\t";
print '<a>'.$langs->trans("dateStart").': '.$form->select_date($date_start,'date_start',0,0,0,"",1,1,1)."\n</a>";
print '<a>'.$langs->trans("dateStop").': '.$form->select_date($date_stop,'date_stop',0,0,0,"",1,1,1)."\n</a>";
print '<input class="butAction" type="submit" value="Go" /></form></div>'."\n\t\t";
if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
//if (! empty($arrayfields['f.datef']['checked']))
print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("File").'</td>';
print '<td>'.$langs->trans("Paid").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right">'.$langs->trans("Balance").'</td>';
print '</tr>';
if ($result)
{
$TData = dol_sort_array($filesarray, 'date', 'ASC');
if(empty($TData)) {
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
} else {
// Sort array by date ASC to calucalte balance
$totalDebit = 0;
$totalCredit = 0;
// Balance calculation
$balance = 0;
foreach($TData as &$data1) {
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
$data1['amount']=-$data1['amount'];
}
if ($data1['amount']>0){
}else{
}
$balance += $data1['amount'];
$data1['balance'] = $balance;
}
// Display array
foreach($TData as $data) {
$html_class = '';
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
print '<tr class="oddeven '.$html_class.'">';
print "<td align=\"center\">";
print dol_print_date($data['date'],'day');
print "</td>\n";
print '<td aling="left">'.$data['item'].'</td>';
print '<td aling="left">'.$data['ref'].'</td>';
print '<td> <a href='.$data['link'].">".$data['name']."</a></td>\n";
print '<td aling="left">'.$data['paid'].'</td>';
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
// Balance
print '<td align="right">'.price($data['balance'])."</td>\n";
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="5">&nbsp;</td>';
print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
print '<td></td>';
print "</tr>\n";
}
}
print "</table>";
print '<form name="dl" action="?action=dl" method="POST" >'."\n\t\t\t";
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start,'dayxcard').'" />';
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
//print '<input type="hidden" name="date_stopDay" value="'.dol_print_date($date_stop, '%d').'" />';
//print '<input type="hidden" name="date_stopMonth" value="'.dol_print_date($date_stop, '%m').'" />';
//print '<input type="hidden" name="date_stopYear" value="'.dol_print_date($date_stop, '%Y').'" />';
//print '<input type="hidden" name="date_startDay" value="'.dol_print_date($date_start, '%d').'" />';
//print '<input type="hidden" name="date_startMonth" value="'.dol_print_date($date_start, '%m').'" />';
//print '<input type="hidden" name="date_startYear" value="'.dol_print_date($date_start, '%m').'" />';
print '<input class="butAction" type="submit" value="Download" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";
llxFooter();
$db->close();

View File

@ -3644,7 +3644,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -4463,6 +4463,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>'; print '<td align="center" width="5">&nbsp;</td>';
} }
@ -4486,6 +4487,7 @@ else if ($id > 0 || ! empty($ref))
print '<td width="10">&nbsp;</td>'; print '<td width="10">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>'; print '<td align="center" width="5">&nbsp;</td>';
} }

View File

@ -1982,7 +1982,8 @@ class Facture extends CommonInvoice
if (! dol_delete_file($file,0,0,0,$this)) // For triggers if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{ {
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file); $langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteFile",$file);
$this->db->rollback(); $this->db->rollback();
return 0; return 0;
} }
@ -1991,7 +1992,8 @@ class Facture extends CommonInvoice
{ {
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
{ {
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); $langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteDir",$dir);
$this->db->rollback(); $this->db->rollback();
return 0; return 0;
} }

View File

@ -135,18 +135,17 @@ class PaymentTerm // extends CommonObject
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term");
if (! $notrigger) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
// Uncomment this and change MYOBJECT to your own tag if you //if (! $notrigger) {
// want this action call a trigger.
//// Call triggers // // Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); // $interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } // if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers // // End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -311,21 +310,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
if (! $notrigger) //if (! $error && ! $notrigger) {
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
// Call triggers // Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); //$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
// End call triggers // End call triggers
} //}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -367,21 +361,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
if (! $notrigger) //if (! $error && ! $notrigger) {
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers //// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); //$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers //// End call triggers
} //}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -439,12 +428,9 @@ class PaymentTerm // extends CommonObject
$error++; $error++;
} }
if (! $error) //if (! $error)
{ //{
//}
}
unset($this->context['createfromclone']); unset($this->context['createfromclone']);

View File

@ -148,29 +148,29 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
$checkedtypetiers=0; $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'f.facnumber'=>array('label'=>"Ref", 'checked'=>1),
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), 'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1),
'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.town'=>array('label'=>"Town", 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 's.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")), 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0),
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), 'rtp'=>array('label'=>"Rest", 'checked'=>0),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -422,22 +422,14 @@ if ($filtre)
} }
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '' && $search_type >= 0) if ($search_type != '') $sql.=" AND f.type IN (".$db->escape($search_type).")";
{
if ($search_type == '0') $sql.=" AND f.type = 0"; // standard
if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement
if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note
if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit
if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma
if ($search_type == '5') $sql.=" AND f.type = 5"; // situation
}
if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
@ -911,6 +903,7 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
$projectstatic=new Project($db); $projectstatic=new Project($db);
$discount = new DiscountAbsolute($db);
if ($num > 0) if ($num > 0)
{ {
@ -928,6 +921,9 @@ if ($resql)
$facturestatic->total_tva=$obj->total_vat; $facturestatic->total_tva=$obj->total_vat;
$facturestatic->total_ttc=$obj->total_ttc; $facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->paye=$obj->paye;
$facturestatic->fk_soc=$obj->fk_soc;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public; $facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private; $facturestatic->note_private=$obj->note_private;
@ -947,7 +943,12 @@ if ($resql)
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits; $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay; $remaintopay = $facturestatic->total_ttc - $totalpay;
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) {
$remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = $facturestatic->total_ttc - $remaintopay;
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))
@ -1071,11 +1072,20 @@ if ($resql)
if (! empty($arrayfields['typent.code']['checked'])) if (! empty($arrayfields['typent.code']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code]; print $typenArray[$obj->typent_code];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Staff
if (! empty($arrayfields['staff.code']['checked']))
{
print '<td align="center">';
if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1);
print $staffArray[$obj->staff_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Payment mode // Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))

View File

@ -135,15 +135,15 @@ class Cpaiement
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you
// Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger.
// want this action to call a trigger. //if (!$notrigger) {
//// Call triggers // // Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); // $result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; // if ($result < 0) $error++;
//// End call triggers // // End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -278,15 +278,15 @@ class Cpaiement
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
} }
if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you
// Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger.
// want this action calls a trigger. //if (!$error && !$notrigger) {
//// Call triggers // // Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user); // $result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers // // End call triggers
} //}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
@ -316,17 +316,15 @@ class Cpaiement
$this->db->begin(); $this->db->begin();
if (!$error) { // Uncomment this and change MYOBJECT to your own tag if you
if (!$notrigger) { // want this action calls a trigger.
// Uncomment this and change MYOBJECT to your own tag if you //if (!$error && !$notrigger) {
// want this action calls a trigger.
//// Call triggers // // Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user); // $result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers // // End call triggers
} //}
}
if (!$error) { if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;

View File

@ -74,7 +74,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
} }
} }
// Create payment // Validate social contribution
/*
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer) if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer)
{ {
$db->begin(); $db->begin();
@ -111,6 +112,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
$db->rollback(); $db->rollback();
} }
} }
*/
/* /*
@ -150,12 +152,14 @@ if ($action == 'delete')
/* /*
* Validation confirmation of payment * Validation confirmation of payment
*/ */
/*
if ($action == 'valide') if ($action == 'valide')
{ {
$facid = $_GET['facid']; $facid = $_GET['facid'];
print $form->formconfirm('card.php?id='.$object->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); print $form->formconfirm('card.php?id='.$object->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
} }
*/
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/payments.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/payments.php">' . $langs->trans("BackToList") . '</a>';

View File

@ -82,7 +82,6 @@ class PaymentSalary extends CommonObject
$this->db = $db; $this->db = $db;
$this->element = 'payment_salary'; $this->element = 'payment_salary';
$this->table_element = 'payment_salary'; $this->table_element = 'payment_salary';
return 1;
} }
/** /**

View File

@ -25,7 +25,7 @@
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@ -77,31 +77,18 @@ class Cchargesociales
$error = 0; $error = 0;
// Clean parameters // Clean parameters
$this->trimParameters(
if (isset($this->libelle)) { array(
$this->libelle = trim($this->libelle); 'libelle',
} 'deductible',
if (isset($this->deductible)) { 'active',
$this->deductible = trim($this->deductible); 'code',
} 'fk_pays',
if (isset($this->active)) { 'module',
$this->active = trim($this->active); 'accountancy_code',
} )
if (isset($this->code)) { );
$this->code = trim($this->code);
}
if (isset($this->fk_pays)) {
$this->fk_pays = trim($this->fk_pays);
}
if (isset($this->module)) {
$this->module = trim($this->module);
}
if (isset($this->accountancy_code)) {
$this->accountancy_code = trim($this->accountancy_code);
}
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -143,7 +130,7 @@ class Cchargesociales
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) { //if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
@ -151,7 +138,7 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; //if ($result < 0) $error++;
//// End call triggers //// End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -243,28 +230,17 @@ class Cchargesociales
// Clean parameters // Clean parameters
if (isset($this->libelle)) { $this->trimParameters(
$this->libelle = trim($this->libelle); array(
} 'libelle',
if (isset($this->deductible)) { 'deductible',
$this->deductible = trim($this->deductible); 'active',
} 'code',
if (isset($this->active)) { 'fk_pays',
$this->active = trim($this->active); 'module',
} 'accountancy_code',
if (isset($this->code)) { )
$this->code = trim($this->code); );
}
if (isset($this->fk_pays)) {
$this->fk_pays = trim($this->fk_pays);
}
if (isset($this->module)) {
$this->module = trim($this->module);
}
if (isset($this->accountancy_code)) {
$this->accountancy_code = trim($this->accountancy_code);
}
// Check parameters // Check parameters
@ -290,7 +266,7 @@ class Cchargesociales
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
} }
if (!$error && !$notrigger) { //if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -298,7 +274,7 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
@ -328,8 +304,8 @@ class Cchargesociales
$this->db->begin(); $this->db->begin();
if (!$error) { //if (!$error) {
if (!$notrigger) { //if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -337,8 +313,8 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_DELETE',$user); //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
} //}
if (!$error) { if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
@ -476,34 +452,33 @@ class Cchargesociales
if ($mode == 0) if ($mode == 0)
{ {
$prefix='';
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
} }
@ -526,4 +501,20 @@ class Cchargesociales
$this->module = ''; $this->module = '';
$this->accountancy_code = ''; $this->accountancy_code = '';
} }
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @return void
*/
private function trimParameters($parameters)
{
if (!is_array($parameters)) return;
foreach ($parameters as $parameter) {
if (isset($this->$parameter)) {
$this->$parameter = trim($this->$parameter);
}
}
}
} }

View File

@ -76,7 +76,6 @@ class ChargeSociales extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }
/** /**
@ -431,8 +430,9 @@ class ChargeSociales extends CommonObject
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load('customers');
$langs->load('bills'); // Load translation files required by the page
$langs->loadLangs(array("customers","bills"));
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {

View File

@ -186,6 +186,8 @@ if (empty($reshook))
$object->country_id = GETPOST("country_id",'int'); $object->country_id = GETPOST("country_id",'int');
$object->state_id = GETPOST("state_id",'int'); $object->state_id = GETPOST("state_id",'int');
$object->skype = GETPOST("skype",'alpha'); $object->skype = GETPOST("skype",'alpha');
$object->twitter = GETPOST("twitter",'alpha');
$object->facebook = GETPOST("facebook",'alpha');
$object->email = GETPOST("email",'alpha'); $object->email = GETPOST("email",'alpha');
$object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha');
$object->phone_perso = GETPOST("phone_perso",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha');
@ -358,6 +360,8 @@ if (empty($reshook))
$object->email = GETPOST("email",'alpha'); $object->email = GETPOST("email",'alpha');
$object->skype = GETPOST("skype",'alpha'); $object->skype = GETPOST("skype",'alpha');
$object->twitter = GETPOST("twitter",'alpha');
$object->facebook = GETPOST("facebook",'alpha');
$object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha');
$object->phone_perso = GETPOST("phone_perso",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha');
$object->phone_mobile = GETPOST("phone_mobile",'alpha'); $object->phone_mobile = GETPOST("phone_mobile",'alpha');
@ -658,13 +662,28 @@ else
// Instant message and no email // Instant message and no email
print '<tr><td><label for="jabberid">'.$langs->trans("IM").'</label></td>'; print '<tr><td><label for="jabberid">'.$langs->trans("IM").'</label></td>';
print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("jabberid",'alpha')?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>'; print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>';
// Skype if (! empty($conf->socialnetworks->enabled))
if (! empty($conf->skype->enabled))
{ {
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>'; // Skype
print '<td colspan="3"><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("skype",'alpha')?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>'; if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
} }
// Visibility // Visibility
@ -914,11 +933,26 @@ else
} }
print '</tr>'; print '</tr>';
// Skype if (! empty($conf->socialnetworks->enabled))
if (! empty($conf->skype->enabled))
{ {
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>'; // Skype
print '<td><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>'; if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
} }
// Visibility // Visibility

View File

@ -100,7 +100,7 @@ class Contact extends CommonObject
public $state_code; // Code of department public $state_code; // Code of department
public $state; // Label of department public $state; // Label of department
public $poste; // Position public $poste; // Position
public $socid; // fk_soc public $socid; // fk_soc
public $statut; // 0=inactif, 1=actif public $statut; // 0=inactif, 1=actif
@ -354,6 +354,8 @@ class Contact extends CommonObject
$sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", fax='".$this->db->escape($this->fax)."'";
$sql .= ", email='".$this->db->escape($this->email)."'"; $sql .= ", email='".$this->db->escape($this->email)."'";
$sql .= ", skype='".$this->db->escape($this->skype)."'"; $sql .= ", skype='".$this->db->escape($this->skype)."'";
$sql .= ", twitter='".$this->db->escape($this->twitter)."'";
$sql .= ", facebook='".$this->db->escape($this->facebook)."'";
$sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'";
$sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
@ -441,6 +443,16 @@ class Contact extends CommonObject
$tmpobj->skype = $this->skype; $tmpobj->skype = $this->skype;
$usermustbemodified++; $usermustbemodified++;
} }
if ($tmpobj->twitter != $this->twitter)
{
$tmpobj->twitter = $this->twitter;
$usermustbemodified++;
}
if ($tmpobj->facebook != $this->facebook)
{
$tmpobj->facebook = $this->facebook;
$usermustbemodified++;
}
if ($usermustbemodified) if ($usermustbemodified)
{ {
$result=$tmpobj->update($user, 0, 1, 1, 1); $result=$tmpobj->update($user, 0, 1, 1, 1);
@ -493,8 +505,8 @@ class Contact extends CommonObject
global $conf; global $conf;
$dn=''; $dn='';
if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN; if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
if ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN; elseif ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN;
if ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS]; elseif ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
return $dn; return $dn;
} }
@ -508,12 +520,12 @@ class Contact extends CommonObject
function _load_ldap_info() function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf, $langs;
$info = array(); $info = array();
// Object classes // Object classes
$info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS); $info["objectclass"]=explode(',', $conf->global->LDAP_CONTACT_OBJECT_CLASS);
$this->fullname=$this->getFullName($langs); $this->fullname=$this->getFullName($langs);
@ -690,7 +702,7 @@ class Contact extends CommonObject
$sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_pays as country_id,";
$sql.= " c.fk_departement,"; $sql.= " c.fk_departement,";
$sql.= " c.birthday,"; $sql.= " c.birthday,";
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,";
$sql.= " c.photo,"; $sql.= " c.photo,";
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
$sql.= " c.import_key,"; $sql.= " c.import_key,";
@ -756,6 +768,8 @@ class Contact extends CommonObject
$this->email = $obj->email; $this->email = $obj->email;
$this->jabberid = $obj->jabberid; $this->jabberid = $obj->jabberid;
$this->skype = $obj->skype; $this->skype = $obj->skype;
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->photo = $obj->photo; $this->photo = $obj->photo;
$this->priv = $obj->priv; $this->priv = $obj->priv;
$this->mail = $obj->email; $this->mail = $obj->email;
@ -887,9 +901,9 @@ class Contact extends CommonObject
if ($obj->nb) if ($obj->nb)
{ {
if ($obj->element=='facture') $this->ref_facturation = $obj->nb; if ($obj->element=='facture') $this->ref_facturation = $obj->nb;
if ($obj->element=='contrat') $this->ref_contrat = $obj->nb; elseif ($obj->element=='contrat') $this->ref_contrat = $obj->nb;
if ($obj->element=='commande') $this->ref_commande = $obj->nb; elseif ($obj->element=='commande') $this->ref_commande = $obj->nb;
if ($obj->element=='propal') $this->ref_propal = $obj->nb; elseif ($obj->element=='propal') $this->ref_propal = $obj->nb;
} }
} }
$this->db->free($resql); $this->db->free($resql);
@ -914,8 +928,8 @@ class Contact extends CommonObject
$error=0; $error=0;
$this->old_lastname = $obj->lastname; $this->old_lastname = $obj->lastname;
$this->old_firstname = $obj->firstname; $this->old_firstname = $obj->firstname;
$this->db->begin(); $this->db->begin();
@ -1035,7 +1049,7 @@ class Contact extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_creat) { if ($obj->fk_user_creat) {
$cuser = new User($this->db); $cuser = new User($this->db);
@ -1069,9 +1083,9 @@ class Contact extends CommonObject
function getNbOfEMailings() function getNbOfEMailings()
{ {
$sql = "SELECT count(mc.email) as nb"; $sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; $sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' ";
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -1318,8 +1318,10 @@ else
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) {
dol_print_error($db,$object->error);
}
$nbofservices=count($object->lines); $nbofservices=count($object->lines);
@ -1334,56 +1336,54 @@ else
$head = contract_prepare_head($object); $head = contract_prepare_head($object);
$hselected = 0; $hselected = 0;
$formconfirm = '';
dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract'); dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract');
/* if ($action == 'delete') {
* Confirmation de la suppression du contrat //Confirmation de la suppression du contrat
*/ $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
if ($action == 'delete') } elseif ($action == 'valid') {
{ //Confirmation de la validation
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); $ref = substr($object->ref, 1, 4);
if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) {
$numref = $object->getNextNumRef($object->thirdparty);
} else {
$numref = $object->ref;
}
$text = $langs->trans('ConfirmValidateContract',$numref);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1);
} elseif ($action == 'close') {
// Confirmation de la fermeture
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
} elseif ($action == 'activate') {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1);
} elseif ($action == 'clone') {
// Clone confirmation
$formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
}
/* // Call Hook formConfirm
* Confirmation de la validation $parameters = array(
*/ 'id' => $id,
if ($action == 'valid') //'lineid' => $lineid,
{ );
$ref = substr($object->ref, 1, 4); // Note that $action and $object may have been modified by hook
if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
{ if (empty($reshook)) {
$numref = $object->getNextNumRef($object->thirdparty); $formconfirm .= $hookmanager->resPrint;
} } elseif ($reshook > 0) {
else $formconfirm = $hookmanager->resPrint;
{ }
$numref = $object->ref;
}
$text=$langs->trans('ConfirmValidateContract',$numref); // Print form confirm
print $formconfirm;
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); /*
}
/*
* Confirmation de la fermeture
*/
if ($action == 'close')
{
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
}
if ($action == 'activate')
{
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1);
}
/*
* Contrat * Contrat
*/ */
if (! empty($object->brouillon) && $user->rights->contrat->creer) if (! empty($object->brouillon) && $user->rights->contrat->creer)
@ -1393,12 +1393,6 @@ else
print '<input type="hidden" name="action" value="setremise">'; print '<input type="hidden" name="action" value="setremise">';
} }
// Clone confirmation
if ($action == 'clone') {
$formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
@ -1422,6 +1416,7 @@ else
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -1516,7 +1511,7 @@ else
} }
$colorb='666666'; $colorb = '666666';
$arrayothercontracts=$object->getListOfContracts('others'); $arrayothercontracts=$object->getListOfContracts('others');

View File

@ -643,56 +643,49 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$result = $this->db->fetch_array($resql); $obj = $this->db->fetch_object($resql);
if ($result) if ($obj)
{ {
$this->id = $result["rowid"]; $this->id = $obj->rowid;
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; $this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
$this->ref_customer = $result["ref_customer"]; $this->ref_customer = $obj->ref_customer;
$this->ref_supplier = $result["ref_supplier"]; $this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $result["ref_ext"]; $this->ref_ext = $obj->ref_ext;
$this->statut = $result["statut"]; $this->statut = $obj->statut;
$this->mise_en_service = $this->db->jdate($result["datemise"]); $this->mise_en_service = $this->db->jdate($obj->datemise);
$this->date_contrat = $this->db->jdate($result["datecontrat"]); $this->date_contrat = $this->db->jdate($obj->datecontrat);
$this->date_creation = $this->db->jdate($result["datecontrat"]); $this->date_creation = $this->db->jdate($obj->datecontrat);
$this->fin_validite = $this->db->jdate($result["fin_validite"]); $this->fin_validite = $this->db->jdate($obj->fin_validite);
$this->date_cloture = $this->db->jdate($result["date_cloture"]); $this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->user_author_id = $result["fk_user_author"]; $this->user_author_id = $obj->fk_user_author;
$this->commercial_signature_id = $result["fk_commercial_signature"]; $this->commercial_signature_id = $obj->fk_commercial_signature;
$this->commercial_suivi_id = $result["fk_commercial_suivi"]; $this->commercial_suivi_id = $obj->fk_commercial_suivi;
$this->note_private = $result["note_private"]; $this->note_private = $obj->note_private;
$this->note_public = $result["note_public"]; $this->note_public = $obj->note_public;
$this->modelpdf = $result["model_pdf"]; $this->modelpdf = $obj->model_pdf;
$this->fk_projet = $result["fk_projet"]; // deprecated $this->fk_projet = $obj->fk_projet; // deprecated
$this->fk_project = $result["fk_projet"]; $this->fk_project = $obj->fk_projet;
$this->socid = $result["fk_soc"]; $this->socid = $obj->fk_soc;
$this->fk_soc = $result["fk_soc"]; $this->fk_soc = $obj->fk_soc;
$this->extraparams = (array) json_decode($result["extraparams"], true); $this->extraparams = (array) json_decode($obj->extraparams, true);
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafields // Retreive all extrafields
// fetch optionals attributes and labels // fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
// Lines
/*
* Lines
*/
$this->lines = array();
$result=$this->fetch_lines(); $result=$this->fetch_lines();
if ($result < 0) if ($result < 0)
{ {
@ -1852,28 +1845,28 @@ class Contrat extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); } if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); }
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); } if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); } elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); } elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
} }
if ($mode == 4 || $mode == 6 || $mode == 7) elseif ($mode == 4 || $mode == 6 || $mode == 7)
{ {
$text=''; $text='';
if ($mode == 4) if ($mode == 4)
@ -1895,11 +1888,11 @@ class Contrat extends CommonObject
$text.=($mode == 7?'</div>':''); $text.=($mode == 7?'</div>':'');
return $text; return $text;
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); } if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
} }
} }
@ -2123,7 +2116,7 @@ class Contrat extends CommonObject
$sql.= " AND c.rowid = cd.fk_contrat"; $sql.= " AND c.rowid = cd.fk_contrat";
$sql.= " AND cd.statut = 0"; $sql.= " AND cd.statut = 0";
} }
if ($mode == 'expired') elseif ($mode == 'expired')
{ {
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
$sql.= $this->from; $sql.= $this->from;
@ -2389,7 +2382,7 @@ class Contrat extends CommonObject
*/ */
function createFromClone($socid = 0, $notrigger=0) function createFromClone($socid = 0, $notrigger=0)
{ {
global $db, $user, $langs, $conf, $hookmanager; global $db, $user, $langs, $conf, $hookmanager, $extrafields;
dol_include_once('/projet/class/project.class.php'); dol_include_once('/projet/class/project.class.php');
@ -2398,6 +2391,7 @@ class Contrat extends CommonObject
$error = 0; $error = 0;
$this->fetch($this->id); $this->fetch($this->id);
// Load dest object // Load dest object
$clonedObj = clone $this; $clonedObj = clone $this;
$clonedObj->socid = $socid; $clonedObj->socid = $socid;
@ -2408,8 +2402,23 @@ class Contrat extends CommonObject
$objsoc->fetch($clonedObj->socid); $objsoc->fetch($clonedObj->socid);
// $clonedObj->id=0; // Clean data
$clonedObj->statut = 0; $clonedObj->statut = 0;
// Clean extrafields
if (is_array($clonedObj->array_options) && count($clonedObj->array_options) > 0)
{
$extrafields->fetch_name_optionals_label($this->element);
foreach($clonedObj->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
//var_dump($shortkey); var_dump($extrafields->attributes[$this->element]['unique'][$shortkey]);
if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($clonedObj->array_options[$key]);
}
}
}
if (empty($conf->global->CONTRACT_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT . "/core/modules/contract/" . $conf->global->CONTRACT_ADDON . ".php")) { if (empty($conf->global->CONTRACT_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT . "/core/modules/contract/" . $conf->global->CONTRACT_ADDON . ".php")) {
$this->error = 'ErrorSetupNotComplete'; $this->error = 'ErrorSetupNotComplete';
@ -2424,8 +2433,8 @@ class Contrat extends CommonObject
$clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj); $clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj);
// get extrafields so they will be clone // get extrafields so they will be clone
foreach ( $this->lines as $line ) { foreach ($this->lines as $line) {
$line->fetch_optionals($line->rowid); $line->fetch_optionals($line->id);
} }
// Create clone // Create clone
@ -2628,50 +2637,50 @@ class ContratLigne extends CommonObjectLine
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
} }
} }
@ -3011,15 +3020,14 @@ class ContratLigne extends CommonObjectLine
} }
} }
if (! $error) if (! $error && ! $notrigger) {
{ // Call trigger
if (! $notrigger) $result=$this->call_trigger('LINECONTRACT_UPDATE', $user);
{ if ($result < 0) {
// Call trigger $error++;
$result=$this->call_trigger('LINECONTRACT_UPDATE', $user); $this->db->rollback();
if ($result < 0) { $error++; $this->db->rollback(); } }
// End call triggers // End call triggers
}
} }
if (! $error) if (! $error)

View File

@ -163,27 +163,26 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled)) {
{ $langs->load("projects");
$langs->load("projects"); $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; if ($user->rights->contrat->creer) {
if ($user->rights->contrat->creer) if ($action != 'classify') {
{ //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action != 'classify') $morehtmlref.=' : ';
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; }
$morehtmlref.=' : '; if ($action == 'classify') {
if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.='</form>';
$morehtmlref.='</form>'; } else {
} else { $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); }
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
@ -210,9 +209,12 @@ if ($id > 0 || ! empty($ref))
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); if ($object->thirdparty->remise_percent) {
else print $langs->trans("CompanyHasNoRelativeDiscount"); print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
$absolute_discount=$object->thirdparty->getAvailableDiscounts(); } else {
print $langs->trans("CompanyHasNoRelativeDiscount");
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
@ -239,9 +241,7 @@ if ($id > 0 || ! empty($ref))
// Contacts lines // Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
} } else {
else
{
print "ErrorRecordNotFound"; print "ErrorRecordNotFound";
} }
} }

View File

@ -28,8 +28,7 @@
// Filename to print must be provided into 'file' parameter // Filename to print must be provided into 'file' parameter
// Print file // Print file
if ($action == 'print_file' && $user->rights->printing->read) if ($action == 'print_file' && $user->rights->printing->read) {
{
$langs->load("printing"); $langs->load("printing");
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
$objectprint = new PrintingDriver($db); $objectprint = new PrintingDriver($db);
@ -55,7 +54,7 @@ if ($action == 'print_file' && $user->rights->printing->read)
$subdir = 'commande'; $subdir = 'commande';
} }
try { try {
$ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);
if ($ret > 0) { if ($ret > 0) {
//print '<pre>'.print_r($printer->errors, true).'</pre>'; //print '<pre>'.print_r($printer->errors, true).'</pre>';
setEventMessages($printer->error, $printer->errors, 'errors'); setEventMessages($printer->error, $printer->errors, 'errors');

View File

@ -86,7 +86,7 @@ class box_factures_imp extends ModeleBoxes
if ($user->rights->facture->lire) if ($user->rights->facture->lire)
{ {
$sql = "SELECT s.nom as name, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid, s.email,";
$sql.= " s.code_client,"; $sql.= " s.code_client,";
$sql.= " s.logo,"; $sql.= " s.logo,";
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
@ -134,9 +134,11 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut; $facturestatic->statut = $objp->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite);
$societestatic->id = $objp->socid; $societestatic->id = $objp->socid;
$societestatic->name = $objp->name; $societestatic->name = $objp->name;
$societestatic->client = 1; $societestatic->client = 1;
$societestatic->email = $objp->email;
$societestatic->code_client = $objp->code_client; $societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo; $societestatic->logo = $objp->logo;

View File

@ -59,7 +59,11 @@ class CMailFile
var $eol; var $eol;
var $eol2; var $eol2;
var $error='';
/**
* @var string Error code (or message)
*/
public $error='';
var $smtps; // Contains SMTPs object (if this method is used) var $smtps; // Contains SMTPs object (if this method is used)
var $phpmailer; // Contains PHPMailer object (if this method is used) var $phpmailer; // Contains PHPMailer object (if this method is used)
@ -1027,7 +1031,7 @@ class CMailFile
$mimedone=0; $mimedone=0;
$out = ""; $out = "";
if ($filename_list) if (is_array($filename_list))
{ {
$filename_list_size=count($filename_list); $filename_list_size=count($filename_list);
for($i=0;$i < $filename_list_size;$i++) for($i=0;$i < $filename_list_size;$i++)
@ -1199,7 +1203,7 @@ class CMailFile
/** /**
* Attach an image to email (mode = 'mail') * Attach an image to email (mode = 'mail')
* *
* @param array $images_list Tableau * @param array $images_list Array of array image
* @return string Chaine images encodees * @return string Chaine images encodees
*/ */
function write_images($images_list) function write_images($images_list)
@ -1207,7 +1211,7 @@ class CMailFile
// phpcs:enable // phpcs:enable
$out = ''; $out = '';
if ($images_list) if (is_array($images_list))
{ {
foreach ($images_list as $img) foreach ($images_list as $img)
{ {

View File

@ -34,15 +34,18 @@
*/ */
class CSMSFile class CSMSFile
{ {
var $error=''; /**
* @var string Error code (or message)
*/
public $error='';
var $addr_from; public $addr_from;
var $addr_to; public $addr_to;
var $deferred; public $deferred;
var $priority; public $priority;
var $class; public $class;
var $message; public $message;
var $nostop; public $nostop;
/** /**

View File

@ -40,7 +40,10 @@ class AntiVir
*/ */
public $errors = array(); public $errors = array();
var $output; /**
* @var string Used to return message
*/
public $output;
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.

View File

@ -43,15 +43,15 @@ class Canvas
*/ */
public $errors = array(); public $errors = array();
var $actiontype; public $actiontype;
var $dirmodule; // Module directory public $dirmodule; // Module directory
var $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...) public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
var $canvas; // Name of canvas (ex: company, individual, product, service, ...) public $canvas; // Name of canvas (ex: company, individual, product, service, ...)
var $card; // Tab (sub-canvas) public $card; // Tab (sub-canvas)
var $template_dir; // Initialized by getCanvas with templates directory public $template_dir; // Initialized by getCanvas with templates directory
var $control; // Initialized by getCanvas with controller instance public $control; // Initialized by getCanvas with controller instance
/** /**

View File

@ -76,7 +76,6 @@ class Ccountry // extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -33,7 +33,11 @@
*/ */
abstract class CommonDocGenerator abstract class CommonDocGenerator
{ {
var $error=''; /**
* @var string Error code (or message)
*/
public $error='';
protected $db; protected $db;
@ -491,11 +495,11 @@ abstract class CommonDocGenerator
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
* @param array $line Array of lines * @param Object $line Object line
* @param Translate $outputlangs Lang object to use for output * @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array * @return array Return a substitution array
*/ */
function get_substitutionarray_lines($line,$outputlangs) function get_substitutionarray_lines($line, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;

View File

@ -431,11 +431,11 @@ abstract class CommonInvoice extends CommonObject
{ {
global $langs; global $langs;
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
return $langs->trans("Unknown"); return $langs->trans("Unknown");
} }
@ -475,10 +475,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted'); else return $langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -493,10 +493,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted'); else return $langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -511,10 +511,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -529,10 +529,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1');
return img_picto($langs->trans('BillStatusStarted'),'statut3'); else return img_picto($langs->trans('BillStatusStarted'),'statut3');
} }
else else
{ {
@ -547,10 +547,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
} }
else else
{ {
@ -566,14 +566,14 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0'); if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0) elseif ($alreadypaid <= 0)
{ {
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1'); if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
} }
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3'); else return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3');
} }
else else
{ {
@ -598,7 +598,9 @@ abstract class CommonInvoice extends CommonObject
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id;
$cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0; $cdr_nbjour=0;
$cdr_type=0;
$cdr_decalage=0;
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';

View File

@ -1164,8 +1164,8 @@ abstract class CommonObject
$sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE ec.element_id = ".$id; $sql.= " WHERE ec.element_id = ".$id;
$sql.= " AND ec.fk_socpeople = c.rowid"; $sql.= " AND ec.fk_socpeople = c.rowid";
if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")"; if ($source == 'internal') $sql.= " AND c.entity IN (".getEntity('user').")";
if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('socpeople').")"; if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe').")";
$sql.= " AND ec.fk_c_type_contact = tc.rowid"; $sql.= " AND ec.fk_c_type_contact = tc.rowid";
$sql.= " AND tc.element = '".$element."'"; $sql.= " AND tc.element = '".$element."'";
$sql.= " AND tc.source = '".$source."'"; $sql.= " AND tc.source = '".$source."'";
@ -2899,6 +2899,7 @@ abstract class CommonObject
// Special case // Special case
if ($origin == 'order') $origin='commande'; if ($origin == 'order') $origin='commande';
if ($origin == 'invoice') $origin='facture'; if ($origin == 'invoice') $origin='facture';
if ($origin == 'invoice_template') $origin='facturerec';
$this->db->begin(); $this->db->begin();
@ -3824,6 +3825,7 @@ abstract class CommonObject
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>'; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>';
// Description // Description
@ -4911,6 +4913,9 @@ abstract class CommonObject
} }
} }
//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
switch ($attributeType) switch ($attributeType)
{ {
case 'int': case 'int':
@ -4924,6 +4929,21 @@ abstract class CommonObject
$new_array_options[$key] = null; $new_array_options[$key] = null;
} }
break; break;
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value!='')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value=='')
{
$new_array_options[$key] = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$new_array_options[$key] = $value;
break;
/*case 'select': // Not required, we chosed value='0' for undefined values /*case 'select': // Not required, we chosed value='0' for undefined values
if ($value=='-1') if ($value=='-1')
{ {
@ -5118,6 +5138,9 @@ abstract class CommonObject
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key];
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key];
//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
switch ($attributeType) switch ($attributeType)
{ {
case 'int': case 'int':
@ -5131,6 +5154,21 @@ abstract class CommonObject
$this->array_options["options_".$key] = null; $this->array_options["options_".$key] = null;
} }
break; break;
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value!='')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value=='')
{
$this->array_options["options_".$key] = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$this->array_options["options_".$key] = $value;
break;
/*case 'select': // Not required, we chosed value='0' for undefined values /*case 'select': // Not required, we chosed value='0' for undefined values
if ($value=='-1') if ($value=='-1')
{ {
@ -5329,7 +5367,7 @@ abstract class CommonObject
if (!$required && $value == '') $value = '-1'; if (!$required && $value == '') $value = '-1';
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} }
elseif (in_array($type,array('int','integer'))) elseif (in_array($type,array('int','integer')))
{ {
@ -7288,7 +7326,7 @@ abstract class CommonObject
$comment = new Comment($this->db); $comment = new Comment($this->db);
$result=$comment->fetchAllFor($this->element, $this->id); $result=$comment->fetchAllFor($this->element, $this->id);
if ($result<0) { if ($result<0) {
$this->errors=array_merge($this->errors,$comment->errors); $this->errors=array_merge($this->errors, $comment->errors);
return -1; return -1;
} else { } else {
$this->comments = $comment->comments; $this->comments = $comment->comments;
@ -7305,4 +7343,20 @@ abstract class CommonObject
{ {
return count($this->comments); return count($this->comments);
} }
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @return void
*/
public function trimParameters($parameters)
{
if (!is_array($parameters)) return;
foreach ($parameters as $parameter) {
if (isset($this->$parameter)) {
$this->$parameter = trim($this->$parameter);
}
}
}
} }

View File

@ -61,9 +61,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
*/ */
abstract class CommonStickerGenerator abstract class CommonStickerGenerator
{ {
public $code; // Code of format public $code; // Code of format
public $format; // Array with informations
/**
* @var array format Array with informations
*/
public $format;
// protected // protected
var $_Avery_Name = ''; // Nom du format de l'etiquette var $_Avery_Name = ''; // Nom du format de l'etiquette

View File

@ -182,7 +182,7 @@ class Conf
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/';
else if (in_array($partname,array('sms'))) $value = $modulename; else if (in_array($partname,array('sms'))) $value = '/'.$modulename.'/';
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
} }

View File

@ -56,7 +56,19 @@ class Cstate // extends CommonObject
public $id; public $id;
public $code_departement; public $code_departement;
public $nom;
/**
* @var string
* @deprecated
* @see name
*/
public $nom='';
/**
* @var string name
*/
public $name='';
public $active; public $active;
@ -70,7 +82,6 @@ class Cstate // extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -66,7 +66,6 @@ class Ctypent // extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -39,46 +39,46 @@
*/ */
class DolGraph class DolGraph
{ {
var $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...) public $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...)
var $mode='side'; // Mode bars graph: side, depth public $mode='side'; // Mode bars graph: side, depth
private $_library='jflot'; // Graphic library to use (jflot, artichow) private $_library='jflot'; // Graphic library to use (jflot, artichow)
//! Array of data //! Array of data
var $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
var $title; // Title of graph public $title; // Title of graph
var $cssprefix=''; // To add into css styles public $cssprefix=''; // To add into css styles
var $width=380; public $width=380;
var $height=200; public $height=200;
var $MaxValue=0; public $MaxValue=0;
var $MinValue=0; public $MinValue=0;
var $SetShading=0; public $SetShading=0;
var $PrecisionY=-1; public $PrecisionY=-1;
var $horizTickIncrement=-1; public $horizTickIncrement=-1;
var $SetNumXTicks=-1; public $SetNumXTicks=-1;
var $labelInterval=-1; public $labelInterval=-1;
var $hideXGrid=false; public $hideXGrid=false;
var $hideYGrid=false; public $hideYGrid=false;
var $Legend=array(); public $Legend=array();
var $LegendWidthMin=0; public $LegendWidthMin=0;
var $showlegend=1; public $showlegend=1;
var $showpointvalue=1; public $showpointvalue=1;
var $showpercent=0; public $showpercent=0;
var $combine=0; // 0.05 if you want to combine records < 5% into "other" public $combine=0; // 0.05 if you want to combine records < 5% into "other"
var $graph; // Objet Graph (Artichow, Phplot...) public $graph; // Objet Graph (Artichow, Phplot...)
/** /**
* @var string Error code (or message) * @var string Error code (or message)
*/ */
public $error=''; public $error='';
var $bordercolor; // array(R,G,B) public $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B) public $bgcolor; // array(R,G,B)
var $bgcolorgrid=array(255,255,255); // array(R,G,B) public $bgcolorgrid=array(255,255,255); // array(R,G,B)
var $datacolor; // array(array(R,G,B),...) public $datacolor; // array(array(R,G,B),...)
private $stringtoshow; // To store string to output graph into HTML page private $stringtoshow; // To store string to output graph into HTML page

View File

@ -117,7 +117,6 @@ class Events // extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -1001,7 +1001,7 @@ class ExtraFields
if (!$required && $value == '') $value = '-1'; if (!$required && $value == '') $value = '-1';
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} }
elseif (in_array($type,array('int','integer'))) elseif (in_array($type,array('int','integer')))
{ {

View File

@ -79,9 +79,7 @@ class Fiscalyear extends CommonObject
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); $this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
$this->statuts = array(0 => 'Opened', 1 => 'Closed'); $this->statuts = array(0 => 'Opened', 1 => 'Closed');
return 1;
} }
/** /**

View File

@ -1108,8 +1108,8 @@ class Form
else if (!is_array($selected)) $selected = array($selected); else if (!is_array($selected)) $selected = array($selected);
// Clean $filter that may contains sql conditions so sql code // Clean $filter that may contains sql conditions so sql code
if (function_exists('test_sql_and_script_inject')) { if (function_exists('testSqlAndScriptInject')) {
if (test_sql_and_script_inject($filter, 3)>0) { if (testSqlAndScriptInject($filter, 3)>0) {
$filter =''; $filter ='';
} }
} }
@ -4829,6 +4829,10 @@ class Form
$tmpthirdparty=new Societe($this->db); $tmpthirdparty=new Societe($this->db);
$defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
$defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
if (preg_match('/\((.*)\)/', $defaulttx, $reg)) {
$defaultcode=$reg[1];
$defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
}
if (empty($defaulttx)) $defaultnpr=0; if (empty($defaulttx)) $defaultnpr=0;
} }
@ -4928,18 +4932,17 @@ class Form
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date. * @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|null Nothing or string if nooutput is 1 * @return string|null Nothing or string if nooutput is 1
* @deprecated * @deprecated
* @see form_date, select_month, select_year, select_dayofweek * @see form_date, select_month, select_year, select_dayofweek
*/ */
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
{ {
// phpcs:enable // phpcs:enable
$retstring = $this->selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof=''); $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
if (! empty($nooutput)) { if (! empty($nooutput)) {
return $retstring; return $retstring;
} }
print $retstring; print $retstring;
return; return;
} }
@ -5730,7 +5733,7 @@ class Form
* @param string $morecss Add more class to css styles * @param string $morecss Add more class to css styles
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
* @param string $placeholder String to use as placeholder * @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string * @return string HTML select string
* @see selectArrayFilter, ajax_combobox in ajax.lib.php * @see selectArrayFilter, ajax_combobox in ajax.lib.php
*/ */
@ -5832,7 +5835,7 @@ class Form
* @param string $morecss Add more class to css styles * @param string $morecss Add more class to css styles
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
* @param string $placeholder String to use as placeholder * @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string * @return string HTML select string
* @see selectArrayAjax, ajax_combobox in ajax.lib.php * @see selectArrayAjax, ajax_combobox in ajax.lib.php
*/ */
@ -5949,55 +5952,76 @@ class Form
* @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95%
* @param string $moreattrib Add more options on select component. Example: 'disabled' * @param string $moreattrib Add more options on select component. Example: 'disabled'
* @param string $elemtype Type of element we show ('category', ...) * @param string $elemtype Type of element we show ('category', ...)
* @param string $placeholder String to use as placeholder
* @param int $addjscombo Add js combo
* @return string HTML multiselect string * @return string HTML multiselect string
* @see selectarray * @see selectarray
*/ */
static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=1)
{ {
global $conf, $langs; global $conf, $langs;
$out = ''; $out = '';
// Add code for jquery to use multiselect // Add code for jquery to use multiselect
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))
{ {
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; $out.="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$out.="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> <script type="text/javascript">'."\n";
<script type="text/javascript"> if ($addjscombo == 1)
function formatResult(record) {'."\n"; {
if ($elemtype == 'category') $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
{ $out.= 'function formatResult(record) {'."\n";
$out.=' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; if ($elemtype == 'category')
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';'; {
} $out.=' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
else return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
{ }
$out.='return record.text;'; else
} {
$out.= ' }; $out.='return record.text;';
function formatSelection(record) {'."\n"; }
if ($elemtype == 'category') $out.= '};'."\n";
{ $out.= 'function formatSelection(record) {'."\n";
$out.=' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; if ($elemtype == 'category')
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';'; {
} $out.=' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
else return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
{ }
$out.='return record.text;'; else
} {
$out.= ' }; $out.='return record.text;';
$(document).ready(function () { }
$(\'#'.$htmlname.'\').'.$tmpplugin.'({ $out.= '};'."\n";
dir: \'ltr\', $out.= '$(document).ready(function () {
// Specify format function for dropdown item $(\'#'.$htmlname.'\').'.$tmpplugin.'({
formatResult: formatResult, dir: \'ltr\',
templateResult: formatResult, /* For 4.0 */ // Specify format function for dropdown item
// Specify format function for selected item formatResult: formatResult,
formatSelection: formatSelection, templateResult: formatResult, /* For 4.0 */
templateResult: formatSelection /* For 4.0 */ // Specify format function for selected item
}); formatSelection: formatSelection,
}); templateResult: formatSelection /* For 4.0 */
</script>'; });
});'."\n";
}
elseif ($addjscombo == 2)
{
// Add other js lib
// ...
$out.= '$(document).ready(function () {
$(\'#'.$htmlname.'\').multiSelect({
containerHTML: \'<div class="multi-select-container">\',
menuHTML: \'<div class="multi-select-menu">\',
buttonHTML: \'<span class="multi-select-button '.$morecss.'">\',
menuItemHTML: \'<label class="multi-select-menuitem">\',
activeClass: \'multi-select-container--open\',
noneText: \''.$placeholder.'\'
});
})';
}
$out.= '</script>';
} }
// Try also magic suggest // Try also magic suggest
@ -6075,7 +6099,7 @@ class Form
} }
if ($val['label']) if ($val['label'])
{ {
$lis.='<li><input type="checkbox" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/>'.dol_escape_htmltag($langs->trans($val['label'])).'</li>'; $lis.='<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
$listcheckedstring.=(empty($val['checked'])?'':$key.','); $listcheckedstring.=(empty($val['checked'])?'':$key.',');
} }
} }
@ -6346,6 +6370,7 @@ class Form
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'), 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
@ -6408,8 +6433,7 @@ class Form
{ {
$objp = $this->db->fetch_object($resqllist); $objp = $this->db->fetch_object($resqllist);
$var = ! $var; print '<tr class="oddeven">';
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">'; print '<td aling="left">';
print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>'; print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
print '</td>'; print '</td>';

View File

@ -48,7 +48,6 @@ class FormActions
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -41,7 +41,6 @@ class FormAdmin
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps

View File

@ -48,7 +48,6 @@ class FormBarCode
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -49,8 +49,6 @@ class FormCompany
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -46,7 +46,6 @@ class FormCron extends Form
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -54,7 +54,6 @@ class FormFile
{ {
$this->db = $db; $this->db = $db;
$this->numoffiles=0; $this->numoffiles=0;
return 1;
} }
@ -128,11 +127,12 @@ class FormFile
if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb // Now $max and $maxphp are in Kb
if ($maxphp > 0) $max=min($max,$maxphp); $maxmin = $max;
if ($maxphp > 0) $maxmin=min($max,$maxphp);
if ($max > 0) if ($maxmin > 0)
{ {
$out .= '<input type="hidden" name="max_file_size" value="'.($max*1024).'">'; $out .= '<input type="hidden" name="max_file_size" value="'.($maxmin*1024).'">';
} }
$out .= '<input class="flat minwidth400" type="file"'; $out .= '<input class="flat minwidth400" type="file"';
@ -185,7 +185,7 @@ class FormFile
if ($linkfiles) if ($linkfiles)
{ {
$out .= "\n<!-- Start form attach new link -->\n"; $out .= "\n<!-- Start form link new url -->\n";
$langs->load('link'); $langs->load('link');
$title = $langs->trans("LinkANewFile"); $title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null); $out .= load_fiche_titre($title, null, null);
@ -213,19 +213,18 @@ class FormFile
$out .= '</div>'; $out .= '</div>';
$out .= '<div class="clearboth"></div>'; $out .= '<div class="clearboth"></div>';
$out .= '</form><br>'; $out .= '</form><br>';
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
$out .= "\n<!-- End form attach new file -->\n"; $out .= "\n<!-- End form link new url -->\n";
} }
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
if (empty($res)) if (empty($res))
{ {
print '<div class="attacharea attacharea'.$htmlname.'">'; print '<div class="attacharea attacharea'.$htmlname.'">';
print $out; print $out;
print '</div>'; print '</div>';
} }
print $hookmanager->resPrint; print $hookmanager->resPrint;
return 1; return 1;
@ -916,7 +915,7 @@ class FormFile
if (! empty($file_list)) if (! empty($file_list))
{ {
$out='<dl class="dropdown inline-block"> $out='<dl class="dropdown inline-block">
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignbottom').'</a></dt> <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt>
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields" style="display: none;">'; <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields" style="display: none;">';
$tmpout=''; $tmpout='';

View File

@ -132,8 +132,6 @@ class FormMail extends Form
$this->withbodyreadonly=0; $this->withbodyreadonly=0;
$this->withdeliveryreceiptreadonly=0; $this->withdeliveryreceiptreadonly=0;
$this->withfckeditor=-1; // -1 = Auto $this->withfckeditor=-1; // -1 = Auto
return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@ -960,7 +958,7 @@ class FormMail extends Form
if (count($validpaymentmethod) > 0 && $paymenturl) if (count($validpaymentmethod) > 0 && $paymenturl)
{ {
$langs->load('other'); $langs->load('other');
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
} }
else else

View File

@ -47,8 +47,6 @@ class FormMargin
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -53,8 +53,6 @@ class FormOther
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }
@ -1151,8 +1149,8 @@ class FormOther
if ($nbboxactivated) if ($nbboxactivated)
{ {
$langs->load("boxes"); // Load translation files required by the page
$langs->load("projects"); $langs->loadLangs(array("boxes","projects"));
$emptybox=new ModeleBoxes($db); $emptybox=new ModeleBoxes($db);

View File

@ -48,7 +48,6 @@ class FormProjets
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps

View File

@ -84,8 +84,6 @@ class FormSms
$this->withtoreadonly=0; $this->withtoreadonly=0;
$this->withtopicreadonly=0; $this->withtopicreadonly=0;
$this->withbodyreadonly=0; $this->withbodyreadonly=0;
return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps

View File

@ -112,8 +112,6 @@ class FormTicket
$this->withref = 0; $this->withref = 0;
$this->withextrafields = 0; // Show extrafields or not $this->withextrafields = 0; // Show extrafields or not
//$this->withtopicreadonly=0; //$this->withtopicreadonly=0;
return 1;
} }
/** /**
@ -727,8 +725,8 @@ class FormTicket
{ {
global $conf, $langs, $user, $mysoc; global $conf, $langs, $user, $mysoc;
$langs->load("other"); // Load translation files required by the page
$langs->load("mails"); $langs->loadLangs(array('other', 'mails'));
$addfileaction = 'addfile'; $addfileaction = 'addfile';

View File

@ -43,8 +43,6 @@ class FormWebsite
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -62,11 +62,7 @@ class Link extends CommonObject
*/ */
public function __construct($db) public function __construct($db)
{ {
global $conf;
$this->db = $db; $this->db = $db;
return 1;
} }

View File

@ -61,7 +61,7 @@ class RssParser
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db=$db; $this->db = $db;
} }
/** /**

View File

@ -341,7 +341,7 @@ class Utils
{ {
// Renommer fichier sortie en fichier erreur // Renommer fichier sortie en fichier erreur
//print "$outputfile -> $outputerror"; //print "$outputfile -> $outputerror";
@dol_delete_file($outputerror,1); @dol_delete_file($outputerror, 1, 0, 0, null, false, 0);
@rename($outputfile,$outputerror); @rename($outputfile,$outputerror);
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide // Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
if (! $errormsg) if (! $errormsg)
@ -448,7 +448,7 @@ class Utils
{ {
$i++; $i++;
if ($i <= $keeplastnfiles) continue; if ($i <= $keeplastnfiles) continue;
dol_delete_file($val['fullname']); dol_delete_file($val['fullname'], 0, 0, 0, null, false, 0);
} }
} }
@ -675,8 +675,9 @@ class Utils
} }
/** /**
* This saves syslog files and compresses older ones * This saves syslog files and compresses older ones.
* Used from cronjob * Nb of archive to keep is defined into $conf->global->SYSLOG_FILE_SAVES
* CAN BE A CRON TASK
* *
* @return int 0 if OK, < 0 if KO * @return int 0 if OK, < 0 if KO
*/ */
@ -714,50 +715,52 @@ class Utils
$logname = $file['name']; $logname = $file['name'];
$logpath = $file['path']; $logpath = $file['path'];
// Handle already compressed files to rename them and add +1 if (dol_is_file($logpath.'/'.$logname) && dol_filesize($logpath.'/'.$logname) > 0) // If log file exists and is not empty
{
// Handle already compressed files to rename them and add +1
$filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$'; $filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$';
$gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter); $gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter);
$gzfiles = array(); $gzfiles = array();
foreach($gzfilestmp as $gzfile) { foreach($gzfilestmp as $gzfile) {
$tabmatches = array(); $tabmatches = array();
preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches); preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches);
$numsave = intval($tabmatches[1]); $numsave = intval($tabmatches[1]);
$gzfiles[$numsave] = $gzfile; $gzfiles[$numsave] = $gzfile;
}
krsort($gzfiles, SORT_NUMERIC);
foreach($gzfiles as $numsave => $dummy) {
if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) {
return -2;
} }
if($numsave >= $nbSaves) { krsort($gzfiles, SORT_NUMERIC);
dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz');
} else {
dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0);
}
}
// Compress last save foreach($gzfiles as $numsave => $dummy) {
if (dol_is_file($logpath.'/'.$logname.'.1')) { if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) {
if($nbSaves > 1) { return -2;
$gzfilehandle = gzopen($logpath.'/'.$logname.'.2.gz', 'wb9'); }
if($numsave >= $nbSaves) {
dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz', 0, 0, 0, null, false, 0);
} else {
dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0);
}
}
// Compress current file and recreate it
if ($nbSaves > 0) { // If $nbSaves is 1, we keep 1 archive .gz file, If 2, we keep 2 .gz files
$gzfilehandle = gzopen($logpath.'/'.$logname.'.1.gz', 'wb9');
if (empty($gzfilehandle)) { if (empty($gzfilehandle)) {
$this->error = 'Failted to open file '.$logpath.'/'.$logname.'.2.gz'; $this->error = 'Failted to open file '.$logpath.'/'.$logname.'.1.gz';
return -3; return -3;
} }
$sourcehandle = fopen($logpath.'/'.$logname.'.1', 'r'); $sourcehandle = fopen($logpath.'/'.$logname, 'r');
if (empty($sourcehandle)) { if (empty($sourcehandle)) {
$this->error = 'Failed to open file '.$logpath.'/'.$logname.'.1'; $this->error = 'Failed to open file '.$logpath.'/'.$logname;
return -4; return -4;
} }
@ -767,19 +770,18 @@ class Utils
fclose($sourcehandle); fclose($sourcehandle);
gzclose($gzfilehandle); gzclose($gzfilehandle);
} else {
dol_delete_file($logpath.'/'.$logname.'.1');
}
}
// Compress current file et recreate it @chmod($logpath.'/'.$logname.'.1.gz', octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
if (dol_is_file($logpath.'/'.$logname)) {
if (dol_move($logpath.'/'.$logname, $logpath.'/'.$logname.'.1', 0, 1, 0, 0))
{
$newlog = fopen($logpath.'/'.$logname, 'a+');
fclose($newlog);
} }
dol_delete_file($logpath.'/'.$logname, 0, 0, 0, null, false, 0);
// Create empty file
$newlog = fopen($logpath.'/'.$logname, 'a+');
fclose($newlog);
//var_dump($logpath.'/'.$logname." - ".octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
@chmod($logpath.'/'.$logname, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
} }
} }

View File

@ -66,18 +66,19 @@ else
} }
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
$tradTemp=array($langs->trans("January"), $tradTemp=array(
$langs->trans("February"), $langs->trans("January"),
$langs->trans("March"), $langs->trans("February"),
$langs->trans("April"), $langs->trans("March"),
$langs->trans("May"), $langs->trans("April"),
$langs->trans("June"), $langs->trans("May"),
$langs->trans("July"), $langs->trans("June"),
$langs->trans("August"), $langs->trans("July"),
$langs->trans("September"), $langs->trans("August"),
$langs->trans("October"), $langs->trans("September"),
$langs->trans("November"), $langs->trans("October"),
$langs->trans("December") $langs->trans("November"),
$langs->trans("December")
); );
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print 'var tradMonths = ['; print 'var tradMonths = [';
@ -96,25 +97,22 @@ $qualified=true;
if (! isset($_GET["sd"])) $_GET["sd"]="00000000"; if (! isset($_GET["sd"])) $_GET["sd"]="00000000";
if (! isset($_GET["m"])) $qualified=false; if (! isset($_GET["m"]) || ! isset($_GET["y"])) $qualified=false;
if (! isset($_GET["y"])) $qualified=false;
if (isset($_GET["m"]) && isset($_GET["y"])) if (isset($_GET["m"]) && isset($_GET["y"]))
{ {
if ($_GET["m"] < 1) $qualified=false; if ($_GET["m"] < 1 || $_GET["m"] > 12) $qualified=false;
if ($_GET["m"] > 12) $qualified=false; if ($_GET["y"] < 0 || $_GET["y"] > 9999) $qualified=false;
if ($_GET["y"] < 0) $qualified=false;
if ($_GET["y"] > 9999) $qualified=false;
} }
// If parameters provided, we show calendar // If parameters provided, we show calendar
if ($qualified) if ($qualified)
{ {
//print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit; //print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit;
displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int')); displayBox(GETPOST("sd",'alpha'), GETPOST("m",'int'), GETPOST("y",'int'));
} }
else else
{ {
dol_print_error('','ErrorBadParameters'); dol_print_error('', 'ErrorBadParameters');
} }
@ -195,9 +193,7 @@ function displayBox($selectedDate,$month,$year)
{ {
echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n"; echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n";
} }
?> print '</tr>';
</tr>
<?php
//print "x ".$thedate." y"; // $thedate = first day of month //print "x ".$thedate." y"; // $thedate = first day of month
$firstdate=dol_getdate($thedate); $firstdate=dol_getdate($thedate);
//var_dump($firstdateofweek); //var_dump($firstdateofweek);
@ -210,7 +206,7 @@ function displayBox($selectedDate,$month,$year)
//print_r($mydate); //print_r($mydate);
if ($mydate < $firstdate) // At first run if ($mydate < $firstdate) // At first run
{ {
echo "<TR class=\"dpWeek\">"; echo "<tr class=\"dpWeek\">";
//echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
$cols=0; $cols=0;
for ($i = 0; $i < 7; $i++) for ($i = 0; $i < 7; $i++)
@ -221,7 +217,7 @@ function displayBox($selectedDate,$month,$year)
$mydate = $firstdate; $mydate = $firstdate;
break; break;
} }
echo "<TD>&nbsp;</TD>"; echo "<td>&nbsp;</td>";
$cols++; $cols++;
} }
} }
@ -229,7 +225,7 @@ function displayBox($selectedDate,$month,$year)
{ {
if ($mydate["wday"] == $startday) if ($mydate["wday"] == $startday)
{ {
echo "<TR class=\"dpWeek\">"; echo "<tr class=\"dpWeek\">";
$cols=0; $cols=0;
} }
} }
@ -245,17 +241,17 @@ function displayBox($selectedDate,$month,$year)
} }
// Sur click dans calendrier, appelle fonction dpClickDay // Sur click dans calendrier, appelle fonction dpClickDay
echo "<TD class=\"".$dayclass."\""; echo "<td class=\"".$dayclass."\"";
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\""; echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\"";
echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\""; echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\"";
echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; echo ">".sprintf("%02s",$mydate["mday"])."</td>";
$cols++; $cols++;
if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n"; if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n";
//$thedate=strtotime("tomorrow",$thedate); //$thedate=strtotime("tomorrow",$thedate);
$day++; $day++;
$thedate=dol_mktime(12,0,0,$month,$day,$year); $thedate=dol_mktime(12, 0, 0, $month, $day, $year);
if ($thedate == '') if ($thedate == '')
{ {
$stoploop=1; $stoploop=1;
@ -269,8 +265,8 @@ function displayBox($selectedDate,$month,$year)
if ($cols < 7) if ($cols < 7)
{ {
for($i=6; $i>=$cols; $i--) echo "<TD>&nbsp;</TD>"; for($i=6; $i>=$cols; $i--) echo "<td>&nbsp;</td>";
echo "</TR>\n"; echo "</tr>\n";
} }
?> ?>
<tr> <tr>

View File

@ -124,9 +124,10 @@ function versiondolibarrarray()
* @param string $okerror Family of errors we accept ('default', 'none') * @param string $okerror Family of errors we accept ('default', 'none')
* @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined) * @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined)
* @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0) * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0) function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0)
{ {
global $db, $conf, $langs, $user; global $db, $conf, $langs, $user;
@ -265,6 +266,18 @@ function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='',
$arraysql[$i]=$newsql; $arraysql[$i]=$newsql;
} }
if ($offsetforchartofaccount > 0)
{
// Replace lines
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
// with
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
//var_dump($newsql);
$arraysql[$i] = $newsql;
}
} }
// Loop on each request to execute request // Loop on each request to execute request
@ -1718,7 +1731,7 @@ function email_admin_prepare_head()
} }
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates"); $head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates'; $head[$h][2] = 'templates';
$h++; $h++;

View File

@ -131,7 +131,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px;">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap" style="padding-bottom: 2px;">'; print '</td><td class="nowrap" style="padding-bottom: 2px;">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0); print $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr> * Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com> * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
@ -1244,12 +1244,12 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
print "</tr>\n"; print "</tr>\n";
} }
} }
else //else
{ //{
//print '<tr class="oddeven">'; //print '<tr class="oddeven">';
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>'; //print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
//print "</tr>\n"; //print "</tr>\n";
} //}
print "\n</table>\n"; print "\n</table>\n";
print "<br>\n"; print "<br>\n";
@ -1323,30 +1323,30 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; $sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; $sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m"; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{ {
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
{ {
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
if (is_object($filterobj) && get_class($filterobj) == 'Product') elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
{ {
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
@ -1362,7 +1362,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
else else
{ {
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'"; if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'"; elseif ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
} }
} }
else else
@ -1373,7 +1373,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
} }
} }
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
@ -1388,7 +1388,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; //elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone=''; $tododone='';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo'; if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo';
@ -1583,7 +1583,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.='</td>'; $out.='</td>';
// Author of event // Author of event
$out.='<td>'; $out.='<td class="tdoverflowmax100">';
//$userstatic->id=$histo[$key]['userid']; //$userstatic->id=$histo[$key]['userid'];
//$userstatic->login=$histo[$key]['login']; //$userstatic->login=$histo[$key]['login'];
//$out.=$userstatic->getLoginUrl(1); //$out.=$userstatic->getLoginUrl(1);

View File

@ -1133,16 +1133,17 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @param object $object Current object in use * @param object $object Current object in use
* @param boolean $allowdotdot Allow to delete file path with .. inside. Never use this, it is reserved for migration purpose. * @param boolean $allowdotdot Allow to delete file path with .. inside. Never use this, it is reserved for migration purpose.
* @param int $indexdatabase Try to remove also index entries.
* @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
* @see dol_delete_dir * @see dol_delete_dir
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null,$allowdotdot=false) function dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
{ {
global $db, $conf, $user, $langs; global $db, $conf, $user, $langs;
global $hookmanager; global $hookmanager;
$langs->load("other"); // Load translation files required by the page
$langs->load("errors"); $langs->loadLangs(array('other', 'errors'));
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook); dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);
@ -1200,7 +1201,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
{ {
$rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete); $rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete);
if (is_object($db)) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1) if (is_object($db) && $indexdatabase) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1)
{ {
dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG); dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';

View File

@ -3152,7 +3152,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithoutext, array( if (empty($srconly) && in_array($pictowithoutext, array(
'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow') 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow')
)) { )) {
$fakey = $pictowithoutext; $fakey = $pictowithoutext;
@ -3865,8 +3865,8 @@ function dol_print_error($db='',$error='',$errors=null)
$langs = new Translate('', $conf); $langs = new Translate('', $conf);
$langs->load("main"); $langs->load("main");
} }
$langs->load("main"); // Load translation files required by the page
$langs->load("errors"); $langs->loadLangs(array('main', 'errors'));
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
@ -4175,13 +4175,13 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
* @param string $morehtmlright Added message to show on right * @param string $morehtmlright Added message to show on right
* @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param string $picto Icon to use before title (should be a 32x32 transparent png file)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects * @param string $id To force an id on html objects
* @param string $morecssontable More css on table * @param string $morecssontable More css on table
* @param string $morehtmlcenter Added message to show on center * @param string $morehtmlcenter Added message to show on center
* @return string * @return string
* @see print_barre_liste * @see print_barre_liste
*/ */
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='') function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
{ {
global $conf; global $conf;
@ -4191,7 +4191,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
$return.= "\n"; $return.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>'; $return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>';
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle" id="pictotitle"', $pictoisfullpath).'</td>'; if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
$return.= '<td class="nobordernopadding" valign="middle">'; $return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>'; $return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>'; $return.= '</td>';
@ -5213,6 +5213,11 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
} }
} }
// Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle
if (! empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) {
return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice);
}
// Sinon la TVA proposee par defaut=0. Fin de regle. // Sinon la TVA proposee par defaut=0. Fin de regle.
// Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe // Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe
//print 'VATRULE 5'; //print 'VATRULE 5';
@ -6110,7 +6115,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$paymenturl=$url; $paymenturl=$url;
} }
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):''); $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl; $substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
} }
} }
@ -6154,12 +6159,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray=array_merge($substitutionarray, array( $substitutionarray=array_merge($substitutionarray, array(
'__DAY__' => (string) $tmp['mday'], '__DAY__' => (string) $tmp['mday'],
'__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday
'__DAY_TEXT_SHORT__' => $outputlangs->trans('Short'.$tmp['weekday']), '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon
'__DAY_TEXT_MIN__' => $outputlangs->trans($tmp['weekday'].'Min'), '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M
'__MONTH__' => (string) $tmp['mon'], '__MONTH__' => (string) $tmp['mon'],
'__MONTH_TEXT__' => $outputlangs->trans($tmp['month']), '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])),
'__MONTH_TEXT_MIN__' => $outputlangs->trans($tmp['month'].'Min'), '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])),
'__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])),
'__YEAR__' => (string) $tmp['year'], '__YEAR__' => (string) $tmp['year'],
'__PREVIOUS_DAY__' => (string) $tmp2['day'], '__PREVIOUS_DAY__' => (string) $tmp2['day'],
'__PREVIOUS_MONTH__' => (string) $tmp3['month'], '__PREVIOUS_MONTH__' => (string) $tmp3['month'],

View File

@ -2105,8 +2105,8 @@ function pdf_getLinkedObjects($object,$outputlangs)
} }
else if ($objecttype == 'shipping') else if ($objecttype == 'shipping')
{ {
$outputlangs->load('orders'); $outputlangs->loadLangs(array("orders", "sendings"));
$outputlangs->load('sendings');
foreach($objects as $x => $elementobject) foreach($objects as $x => $elementobject)
{ {
$order=null; $order=null;

View File

@ -867,7 +867,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
* @param string $projectsrole Array of roles user has on project * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others
* @param int $preselectedday Preselected day * @param int $preselectedday Preselected day
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break * @param int $oldprojectforbreak Old project id of last project break
@ -911,6 +911,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases
{
continue;
}
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {
@ -1152,7 +1157,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
* @param string $projectsrole Array of roles user has on project * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break * @param int $oldprojectforbreak Old project id of last project break
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
@ -1196,6 +1201,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases
{
continue;
}
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {

View File

@ -105,9 +105,9 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
{ {
dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR); dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
sleep(1); sleep(1);
$langs->load('main'); // Load translation files required by the page
$langs->load('other'); $langs->loadLangs(array('other', 'main', 'errors'));
$langs->load('errors');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
} }
} }

View File

@ -52,6 +52,11 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
if ($removephppart) $replacewith=''; if ($removephppart) $replacewith='';
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); $content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='href="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
//$replacewith='<span class="phptag">...php...</span>';
$replacewith='<span class="phptag">...php...</span>'; $replacewith='<span class="phptag">...php...</span>';
if ($removephppart) $replacewith=''; if ($removephppart) $replacewith='';
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); $content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
@ -89,23 +94,28 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
* *
* @param string $content Content string * @param string $content Content string
* @return void * @return void
* @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice editor context * @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on
*/ */
function dolWebsiteOutput($content) function dolWebsiteOutput($content)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
global $dolibarr_main_url_root, $dolibarr_main_data_root; global $dolibarr_main_url_root, $dolibarr_main_data_root;
dol_syslog("dolWebsiteOutput start (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')'); dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." (USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor') if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
{
if (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server // We remove the <head> part of content
$content = preg_replace('/<head>.*<\/head>/ims', '', $content);
$content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content);
$content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content);
}
elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server
{ {
global $website; global $website;
@ -139,7 +149,7 @@ function dolWebsiteOutput($content)
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage // action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep); $content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
} }
else // REPLACEMENT OF LINKS When page called from virtual host else // REPLACEMENT OF LINKS When page called from virtual host
{ {
$symlinktomediaexists=1; $symlinktomediaexists=1;
@ -536,7 +546,7 @@ function dolSaveMasterFile($filemaster)
$mastercontent = '<?php'."\n"; $mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n"; $mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n"; $mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n"; $mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent); $result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@ -598,7 +608,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent =''; $tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n"; $tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n"; $tplcontent.= "ob_start();\n";
@ -663,7 +673,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$indexcontent = '<?php'."\n"; $indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n"; $indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $indexcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n"; $indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n"; $indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -679,7 +689,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$wrappercontent = '<?php'."\n"; $wrappercontent = '<?php'."\n";
$wrappercontent.= "// BEGIN PHP File generated to provide a wrapper.php - DO NOT MODIFY - It is just a generated wrapper.\n"; $wrappercontent.= "// BEGIN PHP File generated to provide a wrapper.php - DO NOT MODIFY - It is just a generated wrapper.\n";
$wrappercontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $wrappercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n"; $wrappercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= '$original_file=str_replace("../","/", GETPOST("file","alpha"));'."\n"; $wrappercontent.= '$original_file=str_replace("../","/", GETPOST("file","alpha"));'."\n";
$wrappercontent.= 'if ($_GET["modulepart"] == "mycompany" && preg_match(\'/^\/?logos\//\', $original_file)) readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));'."\n"; $wrappercontent.= 'if ($_GET["modulepart"] == "mycompany" && preg_match(\'/^\/?logos\//\', $original_file)) readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));'."\n";
$wrappercontent.= "else print 'Bad value for modulepart or file';\n"; $wrappercontent.= "else print 'Bad value for modulepart or file';\n";

View File

@ -111,8 +111,10 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'");
sleep(2); // Anti brut force protection sleep(2); // Anti brut force protection
$langs->load('main');
$langs->load('errors'); // Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
} }
@ -137,8 +139,10 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'");
sleep(1); sleep(1);
$langs->load('main');
$langs->load('errors'); // Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
} }
} }

View File

@ -54,8 +54,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{ {
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP"); dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP");
sleep(1); sleep(1);
$langs->load('main');
$langs->load('other'); // Load translation files required by the page
$langs->loadLangs(array('main', 'other'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode");
return; return;
} }
@ -207,8 +209,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{ {
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'"); dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'");
sleep(1); sleep(1);
$langs->load('main');
$langs->load('other'); // Load translation files required by the page
$langs->loadLangs(array('main', 'other'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
} }
} }
@ -230,9 +234,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
} }
sleep(2); // Anti brut force protection sleep(2); // Anti brut force protection
$langs->load('main');
$langs->load('other'); // Load translation files required by the page
$langs->load('errors'); $langs->loadLangs(array('main', 'other', 'errors'));
;
$_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword")); $_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword"));
} }

View File

@ -75,6 +75,21 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;'; if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;';
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname); $menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
// Members
$tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 18, $id, $idsel, $classname);
}
// Third parties // Third parties
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur'); $tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
@ -241,8 +256,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname); $menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
} }
// Tools // Tools
$tmpentry=array( $tmpentry=array(
'enabled'=>1, 'enabled'=>1,
@ -261,21 +274,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname); $menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname);
} }
// Members
$tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
}
// Show personalized menus // Show personalized menus
$menuArbo = new Menubase($db,'eldy'); $menuArbo = new Menubase($db,'eldy');
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries $newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries
@ -565,8 +563,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright"></i>'); $newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright"></i>');
if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/',$leftmenu)) if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
{ {
$langs->load("admin"); // Load translation files required by the page
$langs->load("help"); $langs->loadLangs(array('admin', 'help'));
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
if ($usemenuhider || empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2); if ($usemenuhider || empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2);

View File

@ -1329,11 +1329,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$comment = isset($this->cronjobs[$key]['comment'])?$this->cronjobs[$key]['comment']:''; $comment = isset($this->cronjobs[$key]['comment'])?$this->cronjobs[$key]['comment']:'';
$frequency = isset($this->cronjobs[$key]['frequency'])?$this->cronjobs[$key]['frequency']:''; $frequency = isset($this->cronjobs[$key]['frequency'])?$this->cronjobs[$key]['frequency']:'';
$unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:''; $unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:'';
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:''; $priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
$datestart = isset($this->cronjobs[$key]['datestart'])?$this->cronjobs[$key]['datestart']:''; $datestart = isset($this->cronjobs[$key]['datestart'])?$this->cronjobs[$key]['datestart']:'';
$dateend = isset($this->cronjobs[$key]['dateend'])?$this->cronjobs[$key]['dateend']:''; $dateend = isset($this->cronjobs[$key]['dateend'])?$this->cronjobs[$key]['dateend']:'';
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be enabled or not (so visible or not)
// Search if cron entry already present // Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
@ -1430,6 +1430,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " AND test = '1'"; // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed.
// For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module.
dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

Some files were not shown because too many files have changed in this diff Show More