Merge remote-tracking branch 'uptream/develop' into 7.0-SPEC1
This commit is contained in:
commit
a0d186bae6
27
ChangeLog
27
ChangeLog
@ -28,6 +28,33 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Remove js library fileupload that was not used by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||
FIX: #7211 Update qty dispatched on qty change
|
||||
FIX: #7458
|
||||
FIX: #7593
|
||||
FIX: #7616
|
||||
FIX: #7619
|
||||
FIX: #7626
|
||||
FIX: #7648
|
||||
FIX: #7675
|
||||
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
|
||||
FIX: API to get object does not return data of linked objects
|
||||
FIX: Bad localtax apply
|
||||
FIX: Bad ressource list in popup in gantt view
|
||||
FIX: bankentries search conciliated if val 0
|
||||
FIX: hook formObjectOptions() must use $expe and not $object which i…
|
||||
FIX: hook formObjectOptions() must use $expe and not $object which is an order here
|
||||
FIX: make of link to other object during creation
|
||||
FIX: Missing function getLinesArray
|
||||
FIX: old batch not shown in multi shipping
|
||||
FIX: paid supplier invoices are shown as abandoned
|
||||
FIX: selection of thirdparty was lost on stats page of invoices
|
||||
FIX: sql syntax error because of old field accountancy_journal
|
||||
FIX: Stats on invoices show nothing
|
||||
FIX: substitution in ODT of thirdparties documents
|
||||
FIX: wrong key in selectarray
|
||||
FIX: wrong personnal project time spent
|
||||
|
||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||
FIX: #7148
|
||||
FIX: #7288
|
||||
|
||||
@ -78,15 +78,17 @@ $sqls=array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
||||
),
|
||||
'supplier_order'=>array(
|
||||
'supplier_proposal'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||
),
|
||||
'supplier_order'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
||||
),
|
||||
'supplier_invoice'=>array(
|
||||
'supplier_invoice'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||
),
|
||||
'delivery'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
||||
@ -114,8 +116,10 @@ $sqls=array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||
),
|
||||
'project'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
||||
@ -128,12 +132,13 @@ $sqls=array(
|
||||
),
|
||||
'thirdparty'=>array(
|
||||
'@contact',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
||||
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||
)
|
||||
);
|
||||
|
||||
@ -152,27 +157,37 @@ $mode = $argv[1];
|
||||
$option = $argv[2];
|
||||
|
||||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||
print "\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||
print "\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Replace database handler
|
||||
if (! empty($argv[3]))
|
||||
{
|
||||
$db->close();
|
||||
unset($db);
|
||||
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
|
||||
$user=new User($db);
|
||||
}
|
||||
|
||||
//var_dump($user->db->database_name);
|
||||
$ret=$user->fetch('','admin');
|
||||
if (! $ret > 0)
|
||||
{
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
|
||||
print 'An admin user with login "admin" must exists to use this script.'."\n";
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
//$user->getrights();
|
||||
|
||||
|
||||
print "Purge all data for this database:\n";
|
||||
print "Server = ".$db->database_host."\n";
|
||||
@ -190,14 +205,14 @@ if (! $confirmed)
|
||||
|
||||
/**
|
||||
* Process sql requests of a family
|
||||
*
|
||||
*
|
||||
* @param string $family Name of family key of array $sqls
|
||||
* @return int -1 if KO, 1 if OK
|
||||
*/
|
||||
function processfamily($family)
|
||||
{
|
||||
global $db, $sqls;
|
||||
|
||||
|
||||
$error=0;
|
||||
foreach($sqls[$family] as $sql)
|
||||
{
|
||||
@ -207,7 +222,7 @@ function processfamily($family)
|
||||
processfamily($newfamily);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
print "Run sql: ".$sql."\n";
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
@ -217,7 +232,7 @@ function processfamily($family)
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error)
|
||||
{
|
||||
print $db->lasterror();
|
||||
@ -225,7 +240,7 @@ function processfamily($family)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error) return -1;
|
||||
else return 1;
|
||||
}
|
||||
@ -242,7 +257,7 @@ foreach($sqls as $family => $familysql)
|
||||
$oldfamily = $family;
|
||||
|
||||
$result=processfamily($family);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
|
||||
@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -437,8 +437,8 @@ if ($mode == 'searchkey')
|
||||
// Now search into translation array
|
||||
foreach($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue;
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue;
|
||||
$recordtoshow[$key]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,14 +139,14 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
{
|
||||
$module = strtolower($regmod[1]);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
$moduleforperm = $module;
|
||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||
$modulenameforenabled = $module;
|
||||
if ($module == 'propale') { $moduleforenabled='propal'; }
|
||||
|
||||
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||
if (empty($conf->$moduleforenabled->enabled)) $enabled=false;
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1341,6 +1341,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
// Note: Output of sql request is encoded in $conf->file->character_set_client
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
$diff = 0;
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$qualified=true;
|
||||
@ -1377,6 +1378,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$eventarray[]=$event;
|
||||
}
|
||||
$diff++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -326,7 +326,6 @@ if (empty($reshook))
|
||||
{
|
||||
$label = $lines[$i]->product_label;
|
||||
}
|
||||
|
||||
$desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
|
||||
}
|
||||
else {
|
||||
|
||||
@ -2089,10 +2089,10 @@ class Contrat extends CommonObject
|
||||
if ($mode == 'inactives') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ foreach($listofstatus as $status)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
else $bool=false;
|
||||
print "</tr>\n";
|
||||
@ -468,7 +468,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
@ -548,7 +548,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
|
||||
@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/services.php
|
||||
* \file htdocs/contrat/services_list.php
|
||||
* \ingroup contrat
|
||||
* \brief Page to list services in contracts
|
||||
*/
|
||||
@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contrat/services.php", LOG_DEBUG);
|
||||
dol_syslog("contrat/services_list.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -160,6 +160,10 @@ if ($action == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
|
||||
$result=$extrafields->addExtraField(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
@ -173,7 +177,7 @@ if ($action == 'add')
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
@ -323,6 +327,10 @@ if ($action == 'update')
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
|
||||
$result=$extrafields->update(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
@ -335,7 +343,7 @@ if ($action == 'update')
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('default_value','alpha'),
|
||||
GETPOST('computed_value','alpha'),
|
||||
|
||||
@ -89,9 +89,7 @@ else // For no ajax call
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
// Load traductions files
|
||||
$langs->load("ecm");
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
$langs->loadLangs(array("ecm","companies","other"));
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
|
||||
@ -553,6 +553,90 @@ abstract class CommonObject
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the link of last main doc file for direct public download.
|
||||
*
|
||||
* @param string $modulepart Module related to document
|
||||
* @param int $initsharekey Init the share key if it was not yet defined
|
||||
* @return string Link or empty string if there is no download link
|
||||
*/
|
||||
function getLastMainDocLink($modulepart, $initsharekey=0)
|
||||
{
|
||||
global $user, $dolibarr_main_url_root;
|
||||
|
||||
if (empty($this->last_main_doc))
|
||||
{
|
||||
return ''; // No known last doc
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', $this->last_main_doc);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error = $ecmfile->error;
|
||||
$this->errors = $ecmfile->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (empty($ecmfile->id))
|
||||
{
|
||||
// Add entry into index
|
||||
if ($initsharekey)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
// TODO We can't, we dont' have full path of file, only last_main_doc adn ->element, so we must rebuild full path first
|
||||
/*
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error = $ecmfile->error;
|
||||
$this->errors = $ecmfile->errors;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else return '';
|
||||
}
|
||||
elseif (empty($ecmfile->share))
|
||||
{
|
||||
// Add entry into index
|
||||
if ($initsharekey)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
$ecmfile->update($user);
|
||||
}
|
||||
else return '';
|
||||
}
|
||||
|
||||
// Define $urlwithroot
|
||||
$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=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$forcedownload=1;
|
||||
$rellink='/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) $rellink.='&attachment=1';
|
||||
if (! empty($ecmfile->entity)) $rellink.='&entity='.$ecmfile->entity;
|
||||
//$rellink.='&file='.urlencode($filepath); // No need of name of file for public link, we will use the hash
|
||||
$fulllink=$urlwithroot.$rellink;
|
||||
//if (! empty($object->ref)) $fulllink.='&hashn='.$object->ref; // Hash of file path
|
||||
//elseif (! empty($object->label)) $fulllink.='&hashc='.$object->label; // Hash of file content
|
||||
if (! empty($ecmfile->share)) $fulllink.='&hashp='.$ecmfile->share; // Hash for public share
|
||||
|
||||
// Here $ecmfile->share is defined
|
||||
return $fulllink;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a link between element $this->element and a contact
|
||||
*
|
||||
@ -4091,7 +4175,12 @@ abstract class CommonObject
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
|
||||
if (! empty($conf->global->PROPOSAL_USE_ONLINE_SIGN))
|
||||
// Set the public "share" key
|
||||
$setsharekey = false;
|
||||
if ($this->element == 'propal' && ! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($setsharekey)
|
||||
{
|
||||
if (empty($ecmfile->share)) // Because object not found or share not set yet
|
||||
{
|
||||
@ -4115,6 +4204,7 @@ abstract class CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$ecmfile->entity = $conf->entity;
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
|
||||
@ -5642,9 +5642,9 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
* Show a multiselect dropbox from an array.
|
||||
*
|
||||
* @param string $htmlname Name of select
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
|
||||
* @param string $varpage Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);
|
||||
* @return string HTML multiselect string
|
||||
|
||||
@ -249,16 +249,16 @@ class FormActions
|
||||
print $action->type;
|
||||
print '</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
|
||||
print '<td align="center">'.dol_print_date($action->datep, 'dayhour', 'tzuserrel');
|
||||
if ($action->datef)
|
||||
{
|
||||
$tmpa=dol_getdate($action->datep);
|
||||
$tmpb=dol_getdate($action->datef);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
|
||||
{
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef,'hour');
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef, 'hour', 'tzuserrel');
|
||||
}
|
||||
else print '-'.dol_print_date($action->datef,'dayhour');
|
||||
else print '-'.dol_print_date($action->datef, 'dayhour', 'tzuserrel');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -1610,7 +1610,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
|
||||
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
|
||||
* false or 'tzserver' => output string is for local PHP server TZ usage
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst)
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
|
||||
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position) (TODO not implemented yet)
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param boolean $encodetooutput false=no convert into output pagecode
|
||||
@ -1641,8 +1641,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
{
|
||||
$to_gmt=true;
|
||||
$offsettzstring=(empty($_SESSION['dol_tz_string'])?'UTC':$_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; // Will not be used anymore
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; // Will not be used anymore
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1699,8 +1699,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg)
|
||||
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
{
|
||||
// This part of code should not be used. TODO Remove this.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
// TODO Remove this.
|
||||
// This part of code should not be used.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||
@ -1710,22 +1711,26 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date is a timestamps
|
||||
if ($time < 100000000000) // Protection against bad date values
|
||||
{
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$ret=adodb_strftime($format, $timetouse, $to_gmt);
|
||||
}
|
||||
else $ret='Bad value '.$time.' for date';
|
||||
}
|
||||
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month=adodb_strftime('%m', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=adodb_strftime('%m', $timetouse);
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
@ -1745,7 +1750,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
}
|
||||
if (preg_match('/__a__/i',$format))
|
||||
{
|
||||
$w=adodb_strftime('%w', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$w=adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
|
||||
$ret=str_replace('__A__',$dayweek,$ret);
|
||||
$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
|
||||
|
||||
@ -611,7 +611,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
}
|
||||
}
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
|
||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
@ -871,7 +871,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
|
||||
@ -154,11 +154,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
-- Commercial - Interventions
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
||||
|
||||
@ -768,11 +768,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000);
|
||||
$newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
|
||||
$newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
// Interventions
|
||||
|
||||
@ -35,9 +35,10 @@ $langs->load("modulebuilder");
|
||||
jQuery(document).ready(function() {
|
||||
function init_typeoffields(type)
|
||||
{
|
||||
console.log("selected type is "+type);
|
||||
var size = jQuery("#size");
|
||||
console.log("We select a new type = "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -51,7 +52,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -93,7 +94,7 @@ $langs->load("modulebuilder");
|
||||
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
||||
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'separate') {
|
||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
langfile.val('').prop('disabled',true);size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
||||
}
|
||||
else { // type = string
|
||||
@ -104,12 +105,13 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
default_value.removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
langfile.removeAttr('disabled');required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
|
||||
@ -162,7 +164,7 @@ $langs->load("modulebuilder");
|
||||
<!-- Position -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos','int'); ?>"></td></tr>
|
||||
<!-- Language file -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<!-- Computed Value -->
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value','none')?GETPOST('computed_value','none'):''); ?>"></td></tr>
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
|
||||
@ -37,6 +37,7 @@ $langs->load("modulebuilder");
|
||||
console.log("select new type "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -50,7 +51,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -99,7 +100,8 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -31,12 +31,18 @@
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
// Pour autre que bittorrent, on charge environnement + info issus de logon (comme le user)
|
||||
// For bittorent link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent' && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
// For direct external download link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
@ -111,21 +117,23 @@ if (! empty($hashp))
|
||||
$result = $ecmfile->fetch(0, '', '', '', $hashp);
|
||||
if ($result > 0)
|
||||
{
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepatch is relative to document directory
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
|
||||
$moduleparttocheck = $tmp[0];
|
||||
if ($moduleparttocheck == $modulepart)
|
||||
{
|
||||
// We remove first level of directory
|
||||
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
|
||||
//var_dump($original_file); exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File owns to another module part.',0,0,1);
|
||||
accessforbidden('Bad link. File is from another module part.',0,0,1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File was not found or sharing attribute removed recently.',0,0,1);
|
||||
$langs->load("errors");
|
||||
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"),0,0,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,30 +146,38 @@ $refname=basename(dirname($original_file)."/");
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
|
||||
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
if (! empty($hashp))
|
||||
{
|
||||
if ($sqlprotectagainstexternals)
|
||||
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
|
||||
}
|
||||
else
|
||||
{
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
if ($sqlprotectagainstexternals)
|
||||
{
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,6 +112,7 @@ class EcmFiles //extends CommonObject
|
||||
}
|
||||
if (isset($this->filepath)) {
|
||||
$this->filepath = trim($this->filepath);
|
||||
$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
|
||||
}
|
||||
if (isset($this->fullpath_orig)) {
|
||||
$this->fullpath_orig = trim($this->fullpath_orig);
|
||||
@ -164,6 +165,11 @@ class EcmFiles //extends CommonObject
|
||||
$maxposition=$maxposition+1;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->filename) || empty($this->filepath))
|
||||
{
|
||||
$this->errors[] = 'Bad property filename or filepath';
|
||||
return -1;
|
||||
}
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
@ -349,7 +355,7 @@ class EcmFiles //extends CommonObject
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="label";
|
||||
|
||||
$section=GETPOST("section");
|
||||
$section=GETPOST("section",'alpha');
|
||||
if (! $section)
|
||||
{
|
||||
dol_print_error('','Error, section parameter missing');
|
||||
@ -101,7 +101,7 @@ $filepathtodocument=$relativetodocument.$file->label;
|
||||
// Try to load object from index
|
||||
$object = new ECMFiles($db);
|
||||
$result=$object->fetch(0, '', $filepathtodocument);
|
||||
if (! ($result >= 0))
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
@ -109,7 +109,6 @@ if (! ($result >= 0))
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -124,7 +123,7 @@ if ($cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.$urlfile.'§ion='.$section);
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -140,13 +139,18 @@ if ($action == 'update')
|
||||
|
||||
//$db->begin();
|
||||
|
||||
$olddir=$ecmdir->getRelativePath(0);
|
||||
$olddir=$ecmdir->getRelativePath(0); // Relative to ecm
|
||||
$olddirrelativetodocument = 'ecm/'.$olddir; // Relative to document
|
||||
$newdirrelativetodocument = 'ecm/'.$olddir;
|
||||
$olddir=$conf->ecm->dir_output.'/'.$olddir;
|
||||
$newdir=$olddir;
|
||||
|
||||
$oldfile=$olddir.$oldlabel;
|
||||
$newfile=$newdir.$newlabel;
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
|
||||
//print $oldfile.' - '.$newfile;
|
||||
if ($newlabel != $oldlabel)
|
||||
{
|
||||
@ -157,29 +161,52 @@ if ($action == 'update')
|
||||
setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
// Reload object after the move
|
||||
$result=$object->fetch(0, '', $newdirrelativetodocument.$newlabel);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (is_object($object))
|
||||
if ($shareenabled)
|
||||
{
|
||||
if ($shareenabled)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
// Call update to set the share key
|
||||
$result = $object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call create to insert record
|
||||
$object->entity = $conf->entity;
|
||||
$object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument);
|
||||
$object->filename = $newlabel;
|
||||
$object->label = md5_file(dol_osencode($newfile)); // hash of file content
|
||||
$object->fullpath_orig = '';
|
||||
$object->gen_or_uploaded = 'unknown';
|
||||
$object->description = ''; // indexed content
|
||||
$object->keyword = ''; // keyword content
|
||||
$result = $object->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +214,10 @@ if ($action == 'update')
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
$urlfile=$newlabel;
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -297,6 +327,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
|
||||
$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
|
||||
|
||||
// Link for internal download
|
||||
print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
|
||||
$modulepart='ecm';
|
||||
$forcedownload=1;
|
||||
@ -308,9 +339,10 @@ $fulllink=$urlwithroot.$rellink;
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
|
||||
print '</td></tr>';
|
||||
|
||||
// Link for direct external download
|
||||
print '<tr><td>';
|
||||
if ($action != 'edit') print $langs->trans("DirectDownloadLink");
|
||||
else print $langs->trans("FileSharedViaALink");
|
||||
@ -332,7 +364,7 @@ if (! empty($object->share))
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -374,7 +406,7 @@ if ($action == 'edit')
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($action == 'delete_file')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -385,7 +417,7 @@ if ($action != 'edit')
|
||||
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
|
||||
}
|
||||
|
||||
@ -1242,6 +1242,7 @@ if ($action == 'create')
|
||||
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
|
||||
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
//print $line->fk_product.' - '.$dbatch->batch;
|
||||
print $langs->trans("Batch").': ';
|
||||
|
||||
@ -111,7 +111,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -353,6 +353,7 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||
|
||||
-- We fix value of 'list' from 0 to 1 for all extrafields created before this migration
|
||||
UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||
UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list != 3;
|
||||
|
||||
ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
|
||||
--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
|
||||
|
||||
@ -598,11 +598,11 @@ Module20000Desc=Declare and follow employees leaves requests
|
||||
Module39000Name=Product lot
|
||||
Module39000Desc=Lot or serial number, eat-by and sell-by date management on products
|
||||
Module50000Name=PayBox
|
||||
Module50000Desc=Module to offer an online payment page by credit card with PayBox
|
||||
Module50000Desc=Module to offer an online payment page accepting payments with Credit/Debit card via PayBox. This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||
Module50100Name=Point of sales
|
||||
Module50100Desc=Point of sales module (POS).
|
||||
Module50200Name=Paypal
|
||||
Module50200Desc=Module to offer an online payment page by credit card with Paypal
|
||||
Module50200Desc=Module to offer an online payment page accepting payments using PayPal (credit card or PayPal credit). This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||
Module50400Name=Accounting (advanced)
|
||||
Module50400Desc=Accounting management (double entries, support general and auxiliary ledgers)
|
||||
Module54000Name=PrintIPP
|
||||
|
||||
@ -202,6 +202,7 @@ ErrorObjectMustHaveLinesToBeValidated=Object %s must have lines to be validated.
|
||||
ErrorOnlyInvoiceValidatedCanBeSentInMassAction=Only validated invoices can be sent using the "Send by email" mass action.
|
||||
ErrorChooseBetweenFreeEntryOrPredefinedProduct=You must choose if article is a predefined product or not
|
||||
ErrorDiscountLargerThanRemainToPaySplitItBefore=The discount you try to apply is larger than remain to pay. Split the discount in 2 smaller discounts before.
|
||||
ErrorFileNotFoundWithSharedLink=File was not found. May be the share key was modified or file was removed recently.
|
||||
# Warnings
|
||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||
|
||||
@ -805,6 +805,7 @@ SomeTranslationAreUncomplete=Some languages may be partially translated or may c
|
||||
DirectDownloadLink=Direct download link (public/external)
|
||||
DirectDownloadInternalLink=Direct download link (need to be logged and need permissions)
|
||||
Download=Download
|
||||
DownloadDocument=Download document
|
||||
ActualizeCurrency=Update currency rate
|
||||
Fiscalyear=Fiscal year
|
||||
ModuleBuilder=Module Builder
|
||||
|
||||
@ -71,7 +71,7 @@ NoWidget=No widget
|
||||
GoToApiExplorer=Go to API explorer
|
||||
ListOfPermissionsDefined=List of defined permissions
|
||||
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
IsAMeasureDesc=Can the value of field be cumulated to get a total into list ? (Examples: 1 or 0)
|
||||
SearchAllDesc=Is the field used to make a search from the quick search tool ? (Examples: 1 or 0)
|
||||
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Dolibarr language file - Source file is en_US - stripe
|
||||
StripeSetup=Stripe module setup
|
||||
StripeDesc=This module offer pages to allow payment on <a href="http://www.stripe.com" target="_blank">Stripe</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||
StripeDesc=Module to offer an online payment page accepting payments with Credit/Debit card via <a href="http://www.stripe.com" target="_blank">Stripe</a>. This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||
StripeOrCBDoPayment=Pay with credit card or Stripe
|
||||
FollowingUrlAreAvailableToMakePayments=Following URLs are available to offer a page to a customer to make a payment on Dolibarr objects
|
||||
PaymentForm=Payment form
|
||||
|
||||
@ -126,9 +126,9 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
||||
dol_delete_file($destdir.'/myobject_list.php');
|
||||
dol_delete_file($destdir.'/lib/myobject.lib.php');
|
||||
dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php');
|
||||
dol_delete_file($destdir.'/sql/llx_myobject.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_myobject.key.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_mymodule_myobject.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_mymodule_myobject_extrafields.sql');
|
||||
dol_delete_file($destdir.'/sql/llx_mymodule_myobject.key.sql');
|
||||
dol_delete_file($destdir.'/scripts/myobject.php');
|
||||
dol_delete_file($destdir.'/img/object_myobject.png');
|
||||
dol_delete_file($destdir.'/class/myobject.class.php');
|
||||
@ -220,9 +220,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
'myobject_list.php'=>strtolower($objectname).'_list.php',
|
||||
'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php',
|
||||
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php',
|
||||
'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
|
||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
|
||||
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
||||
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
||||
@ -507,9 +507,9 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
|
||||
'myobject_list.php'=>strtolower($objectname).'_list.php',
|
||||
'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php',
|
||||
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php',
|
||||
'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
|
||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
|
||||
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
||||
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
||||
@ -1421,9 +1421,9 @@ elseif (! empty($module))
|
||||
$pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php';
|
||||
$pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php';
|
||||
$pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php';
|
||||
$pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql';
|
||||
$pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql';
|
||||
$pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql';
|
||||
$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql';
|
||||
$pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.sql';
|
||||
$pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.key.sql';
|
||||
$pathtolib = strtolower($module).'/lib/'.strtolower($tabobj).'.lib.php';
|
||||
$pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# CHANGELOG MYMODULE FOR DOLIBARR ERP CRM
|
||||
# CHANGELOG MYMODULE FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a>
|
||||
|
||||
## 1.0
|
||||
Initial version
|
||||
|
||||
@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_myobject ADD INDEX idx_fieldobject (fieldobject);
|
||||
ALTER TABLE llx_mymodule_myobject ADD INDEX idx_fieldobject (fieldobject);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
--ALTER TABLE llx_myobject ADD UNIQUE INDEX uk_myobject_fieldxyz(fieldx, fieldy);
|
||||
--ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxyz(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_myobject ADD CONSTRAINT llx_myobject_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
|
||||
--ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_myobject(
|
||||
CREATE TABLE llx_mymodule_myobject(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
entity INTEGER DEFAULT 1 NOT NULL,
|
||||
@ -13,7 +13,7 @@
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
create table llx_myobject_extrafields
|
||||
create table llx_mymodule_myobject_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
@ -100,7 +100,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -622,7 +622,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -372,6 +372,7 @@ if ($action == 'dopayment')
|
||||
}
|
||||
|
||||
|
||||
// Called when choosing Stripe mode, after the 'dopayment'
|
||||
if ($action == 'charge')
|
||||
{
|
||||
// Correct the amount according to unit of currency
|
||||
@ -384,21 +385,24 @@ if ($action == 'charge')
|
||||
|
||||
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||
$email = GETPOST("stripeEmail",'alpha');
|
||||
$vatnumber = GETPOST('vatnumber','alpha');
|
||||
|
||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe');
|
||||
|
||||
$error = 0;
|
||||
|
||||
try {
|
||||
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe');
|
||||
$customer = \Stripe\Customer::create(array(
|
||||
'email' => $email,
|
||||
'description' => ($email?'Customer for '.$email:null),
|
||||
'description' => ($email?'Customer card profile for '.$email:null),
|
||||
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
||||
'business_vat_id' => ($vatnumber?$vatnumber:null),
|
||||
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
|
||||
));
|
||||
// TODO Add 'business_vat_id' ?
|
||||
// Return $customer = array('id'=>'cus_XXXX', ...)
|
||||
|
||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
@ -409,6 +413,7 @@ if ($action == 'charge')
|
||||
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name),
|
||||
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
||||
));
|
||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||
} catch(\Stripe\Error\Card $e) {
|
||||
// Since it's a decline, \Stripe\Error\Card will be caught
|
||||
$body = $e->getJsonBody();
|
||||
@ -626,14 +631,12 @@ if (! $source)
|
||||
$fulltag=$tag;
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
@ -653,7 +656,6 @@ if (! $source)
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Tag
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$fulltag.'</b>';
|
||||
print '<input type="hidden" name="tag" value="'.$tag.'">';
|
||||
@ -700,29 +702,32 @@ if ($source == 'order')
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>';
|
||||
if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>';
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($order->ref).'">';
|
||||
$directdownloadlink = $order->getLastMainDocLink('commande');
|
||||
if ($directdownloadlink)
|
||||
{
|
||||
print '<br><a href="'.$directdownloadlink.'">';
|
||||
print img_mime($order->last_main_doc,'').' ';
|
||||
print $langs->trans("DownloadDocument").'</a>';
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
@ -742,7 +747,6 @@ if ($source == 'order')
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Tag
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$fulltag.'</b>';
|
||||
print '<input type="hidden" name="tag" value="'.$tag.'">';
|
||||
@ -774,6 +778,7 @@ if ($source == 'order')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n";
|
||||
$labeldesc=$langs->trans("Order").' '.$order->ref;
|
||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||
@ -815,29 +820,32 @@ if ($source == 'invoice')
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.dol_escape_htmltag($creditor).'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>';
|
||||
if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>';
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($invoice->ref).'">';
|
||||
$directdownloadlink = $invoice->getLastMainDocLink('facture');
|
||||
if ($directdownloadlink)
|
||||
{
|
||||
print '<br><a href="'.$directdownloadlink.'">';
|
||||
print img_mime($invoice->last_main_doc,'').' ';
|
||||
print $langs->trans("DownloadDocument").'</a>';
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
@ -897,6 +905,7 @@ if ($source == 'invoice')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n";
|
||||
$labeldesc=$langs->trans("Invoice").' '.$invoice->ref;
|
||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||
@ -910,6 +919,7 @@ if ($source == 'contractline')
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
|
||||
$contract=new Contrat($db);
|
||||
$contractline=new ContratLigne($db);
|
||||
|
||||
$result=$contractline->fetch('',$ref);
|
||||
@ -924,7 +934,6 @@ if ($source == 'contractline')
|
||||
{
|
||||
$object = $contractline;
|
||||
|
||||
$contract=new Contrat($db);
|
||||
$result=$contract->fetch($contractline->fk_contrat);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -987,19 +996,16 @@ if ($source == 'contractline')
|
||||
if (GETPOST('qty')) $qty=GETPOST('qty');
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>';
|
||||
if ($contractline->fk_product)
|
||||
{
|
||||
@ -1019,10 +1025,16 @@ if ($source == 'contractline')
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">';
|
||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($contractline->ref).'">';
|
||||
$directdownloadlink = $contract->getLastMainDocLink('contract');
|
||||
if ($directdownloadlink)
|
||||
{
|
||||
print '<br><a href="'.$directdownloadlink.'">';
|
||||
print img_mime($invoice->last_main_doc,'').' ';
|
||||
print $langs->trans("DownloadDocument").'</a>';
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Quantity
|
||||
|
||||
$label=$langs->trans("Quantity");
|
||||
$qty=1;
|
||||
$duration='';
|
||||
@ -1050,7 +1062,6 @@ if ($source == 'contractline')
|
||||
print '</b></td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
@ -1070,7 +1081,6 @@ if ($source == 'contractline')
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Tag
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$fulltag.'</b>';
|
||||
print '<input type="hidden" name="tag" value="'.$tag.'">';
|
||||
@ -1102,6 +1112,7 @@ if ($source == 'contractline')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n";
|
||||
$labeldesc=$langs->trans("Contract").' '.$contract->ref;
|
||||
if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha');
|
||||
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Page is called with payment parameters then called with action='dopayment', then called with action='charge' then redirect is done on urlok/jo
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -216,25 +218,28 @@ if ($action == 'charge')
|
||||
|
||||
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||
$email = GETPOST("stripeEmail",'alpha');
|
||||
$vatnumber = GETPOST('vatnumber','alpha');
|
||||
|
||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe');
|
||||
|
||||
$error = 0;
|
||||
|
||||
try {
|
||||
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe');
|
||||
$customer = \Stripe\Customer::create(array(
|
||||
'email' => $email,
|
||||
'description' => ($email?'Customer for '.$email:null),
|
||||
'description' => ($email?'Customer card profile for '.$email:null),
|
||||
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
||||
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
|
||||
'business_vat_id' => ($vatnumber?$vatnumber:null),
|
||||
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
|
||||
));
|
||||
// TODO Add 'business_vat_id' ?
|
||||
|
||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
'customer' => $customer->id,
|
||||
'customer' => $customer->id, // Will reuse default source of this customer card profile
|
||||
'amount' => price2num($amount, 'MU'),
|
||||
'currency' => $currency,
|
||||
'description' => 'Stripe payment: '.$FULLTAG,
|
||||
@ -577,6 +582,7 @@ if (GETPOST("source") == 'order')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n";
|
||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Order").' '.$order->ref.'">'."\n";
|
||||
}
|
||||
|
||||
@ -687,6 +693,7 @@ if (GETPOST("source") == 'invoice')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n";
|
||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Invoice").' '.$invoice->ref.'">'."\n";
|
||||
}
|
||||
|
||||
@ -886,6 +893,7 @@ if (GETPOST("source") == 'contractline')
|
||||
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
|
||||
}
|
||||
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
|
||||
print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n";
|
||||
print '<input type="hidden" name="desc" value="'.$langs->trans("Contract").' '.$contract->ref.'">'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -245,7 +245,7 @@ if ($type_element == 'supplier_invoice')
|
||||
{ // Supplier : Show products from invoices.
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$documentstatic=new FactureFournisseur($db);
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, ';
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, ';
|
||||
$tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d";
|
||||
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
|
||||
$where.= " AND d.fk_facture_fourn = f.rowid";
|
||||
|
||||
@ -197,7 +197,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -348,12 +348,14 @@ input.buttongen {
|
||||
vertical-align: middle;
|
||||
}
|
||||
input.buttonpayment {
|
||||
min-width: 280px;
|
||||
min-width: 290px;
|
||||
margin-bottom: 15px;
|
||||
background-image: none;
|
||||
line-height: 24px;
|
||||
padding: 8px;
|
||||
background: none;
|
||||
padding-left: 30px;
|
||||
text-align: <?php echo $left; ?>;
|
||||
border: 2px solid #666666;
|
||||
}
|
||||
input.buttonpaymentcb {
|
||||
|
||||
@ -345,12 +345,14 @@ input.buttongen {
|
||||
vertical-align: middle;
|
||||
}
|
||||
input.buttonpayment {
|
||||
min-width: 280px;
|
||||
min-width: 290px;
|
||||
margin-bottom: 15px;
|
||||
background-image: none;
|
||||
line-height: 24px;
|
||||
padding: 8px;
|
||||
background: none;
|
||||
padding-left: 30px;
|
||||
text-align: <?php echo $left; ?>;
|
||||
border: 2px solid #666666;
|
||||
}
|
||||
input.buttonpaymentcb {
|
||||
|
||||
@ -102,7 +102,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user