forked from Wavyzz/dolibarr
fix merging
This commit is contained in:
@@ -33,6 +33,7 @@ NEW: Add button "Save and Stay" in website editor of pages.
|
||||
NEW: Accountancy - Can add specific widget in this accountancy area.
|
||||
NEW: Accountancy - Add export model LDCompta V9 & higher
|
||||
NEW: Accountancy - Add permission on export, delete operations in ledger
|
||||
NEW: Can defined alternative profiles (email and signatures) for users.
|
||||
NEW: add ability to edit price without tax before adding a line of a predefined product.
|
||||
NEW: Add a tab to setup "Opening hours" of company (information only).
|
||||
NEW: Add attendee to ical export + cleanup.
|
||||
|
||||
@@ -231,3 +231,8 @@ $dolibarr_main_prod='0';
|
||||
# Default value: 0 (use database value if exist)
|
||||
# Examples:
|
||||
# $dolibarr_mailing_limit_sendbycli='0';
|
||||
|
||||
# dolibarr_distrib
|
||||
# A key to identify the distribution used for first installation
|
||||
$dolibarr_distrib = 'deb';
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-stellar.zip
|
||||
@@ -110,7 +110,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\m
|
||||
; Mysql data files (does not overwrite if exists)
|
||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
|
||||
; Dolibarr
|
||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
|
||||
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
|
||||
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
|
||||
|
||||
@@ -146,7 +146,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries"));
|
||||
@@ -183,6 +184,7 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListAccounts"));
|
||||
|
||||
@@ -201,10 +203,42 @@ if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_accou
|
||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
|
||||
$sql .= " WHERE asy.rowid = ".$pcgver;
|
||||
//print $sql;
|
||||
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
||||
if (strlen(trim($search_account))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
}
|
||||
$search_account_tmp = $search_account;
|
||||
$weremovedsomezero = 0;
|
||||
if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
|
||||
for($i = 0; $i < $lengthpaddingaccount; $i++) {
|
||||
if (preg_match('/0$/', $search_account_tmp)) {
|
||||
$weremovedsomezero++;
|
||||
$search_account_tmp = preg_replace('/0$/', '', $search_account_tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($search_account); exit;
|
||||
if ($search_account_tmp) {
|
||||
if ($weremovedsomezero) {
|
||||
$search_account_tmp_clean = $search_account_tmp;
|
||||
$search_account_clean = $search_account;
|
||||
$startchar = '%';
|
||||
if (strpos($search_account_tmp, '^') === 0)
|
||||
{
|
||||
$startchar = '';
|
||||
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
|
||||
$search_account_clean = preg_replace('/^\^/', '', $search_account);
|
||||
}
|
||||
$sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'";
|
||||
$sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')";
|
||||
}
|
||||
else $sql .= natural_search("aa.account_number", $search_account_tmp);
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
||||
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
|
||||
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
|
||||
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
|
||||
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
||||
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@@ -236,8 +270,12 @@ if ($resql)
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
<<<<<<< HEAD
|
||||
if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort);
|
||||
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
=======
|
||||
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
>>>>>>> upstream/11.0
|
||||
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
@@ -321,9 +359,18 @@ if ($resql)
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
|
||||
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||
<<<<<<< HEAD
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="' . $search_labelshort . '"></td>';
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
=======
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
>>>>>>> upstream/11.0
|
||||
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
@@ -346,6 +393,7 @@ if ($resql)
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
$totalarray = array();
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Manage the different format accountancy export
|
||||
@@ -704,9 +706,9 @@ class AccountancyExport
|
||||
print $end_line;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date_creation = dol_print_date($line->date_creation, '%d%m%Y');
|
||||
$date_doc = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_doc = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_valid = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
print $line->code_journal.$separator;
|
||||
@@ -742,10 +744,10 @@ class AccountancyExport
|
||||
print $line->label_operation.$separator;
|
||||
|
||||
// FEC:Debit
|
||||
print price2num($line->debit).$separator;
|
||||
print price2fec($line->debit).$separator;
|
||||
|
||||
// FEC:Credit
|
||||
print price2num($line->credit).$separator;
|
||||
print price2fec($line->credit).$separator;
|
||||
|
||||
// FEC:EcritureLet
|
||||
print $line->lettering_code.$separator;
|
||||
|
||||
@@ -342,11 +342,12 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Morphy
|
||||
$morphys = array();
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
|
||||
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
@@ -354,12 +355,12 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote", 0, 1);
|
||||
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
|
||||
print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
|
||||
@@ -1298,7 +1298,6 @@ if ($id)
|
||||
// Determines the name of the field in relation to the possible names
|
||||
// in data dictionaries
|
||||
$showfield = 1; // By defaut
|
||||
$align = "left";
|
||||
$cssprefix = '';
|
||||
$sortable = 1;
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
@@ -1310,23 +1309,23 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow = $langs->trans("Rate");
|
||||
else $valuetoshow = $langs->trans("Amount");
|
||||
$align = 'center';
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $align = "center"; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $cssprefix = "center "; $sortable = 0; }
|
||||
if ($fieldlist[$field] == 'organization') { $valuetoshow = $langs->trans("Organization"); }
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'position') { $align = 'right'; }
|
||||
if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; }
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); }
|
||||
if ($fieldlist[$field] == 'libelle_facture') { $valuetoshow = $langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field] == 'country') { $valuetoshow = $langs->trans("Country"); }
|
||||
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $align = "center"; }
|
||||
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $cssprefix = "center "; }
|
||||
if ($fieldlist[$field] == 'nbjour') { $valuetoshow = $langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $align = "center"; }
|
||||
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center "; }
|
||||
if ($fieldlist[$field] == 'decalage') { $valuetoshow = $langs->trans("Offset"); }
|
||||
if ($fieldlist[$field] == 'width' || $fieldlist[$field] == 'nx') { $valuetoshow = $langs->trans("Width"); }
|
||||
if ($fieldlist[$field] == 'height' || $fieldlist[$field] == 'ny') { $valuetoshow = $langs->trans("Height"); }
|
||||
@@ -1368,7 +1367,7 @@ if ($id)
|
||||
// Show field title
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
@@ -1424,8 +1423,8 @@ if ($id)
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
//var_dump($fieldlist);
|
||||
$class = '';
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
|
||||
if ($fieldlist[$field] == 'entity') {
|
||||
@@ -1457,13 +1456,13 @@ if ($id)
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type_cdr') {
|
||||
if (empty($valuetoshow)) $valuetoshow = $langs->trans('None');
|
||||
elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
|
||||
elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
} elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
|
||||
$valuetoshow = price($valuetoshow);
|
||||
}
|
||||
@@ -1577,20 +1576,20 @@ if ($id)
|
||||
$valuetoshow = $localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'localtax2_type') {
|
||||
if ($obj->localtax2 != 0)
|
||||
$valuetoshow = $localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'taux') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
} elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
|
||||
$align = "center";
|
||||
$class = "center";
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
@@ -1622,14 +1621,14 @@ if ($id)
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
$class = 'tddict';
|
||||
$class .= ($class ? ' ' : '').'tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
|
||||
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
|
||||
if ($fieldlist[$field] == 'position') $class .= ' right';
|
||||
if ($fieldlist[$field] == 'localtax1_type') $class .= ' nowrap';
|
||||
if ($fieldlist[$field] == 'localtax2_type') $class .= ' nowrap';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1908,9 +1907,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
|
||||
$align = "left";
|
||||
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $align = "center"; // Fields aligned on right
|
||||
print '<td class="'.$align.'">';
|
||||
$class = "left";
|
||||
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $class = "center"; // Fields aligned on right
|
||||
print '<td class="'.$class.'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@@ -377,6 +377,7 @@ print '</table>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LoginPage").'</td><td></td>';
|
||||
print '<td width="20"> </td>';
|
||||
@@ -427,7 +428,7 @@ print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
|
||||
@@ -467,24 +467,6 @@ if ($action == 'edit')
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
/*
|
||||
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);*/
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
|
||||
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
|
||||
@@ -655,7 +637,8 @@ else
|
||||
$liste = array();
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql.= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -38,14 +38,14 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
@@ -69,13 +69,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
// Protection if external user
|
||||
// Security check
|
||||
$socid = 0;
|
||||
if ($user->socid > 0)
|
||||
if ($user->socid > 0) // Protection if external user
|
||||
{
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'mymodule', $id, '');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||
@@ -97,7 +98,7 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']);
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
@@ -161,8 +162,6 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass = 'EmailSenderProfile';
|
||||
$objectlabel = 'EmailSenderProfile';
|
||||
$permissiontoread = $user->admin;
|
||||
$permissiontodelete = $user->admin;
|
||||
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@@ -185,8 +184,6 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$limit = (GETPOSTISSET('limit') ? $limit : 0);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
@@ -196,7 +193,7 @@ $help_url = '';
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $title);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
@@ -234,6 +231,10 @@ foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') $search[$key] = '';
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
@@ -254,6 +255,7 @@ foreach($object->fields as $key => $val)
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@@ -375,9 +377,12 @@ if ($action != 'create') {
|
||||
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : -1), 'private', 1, null, 0, ($user->admin ? '' : $user->id));
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $form->selectyesno('active', GETPOST('active', 'int'), 1);
|
||||
print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], GETPOST('active', 'int'), 0);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@@ -443,7 +448,10 @@ foreach ($object->fields as $key => $val)
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
}
|
||||
elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@@ -509,11 +517,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
||||
}
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
@@ -532,21 +536,20 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
else print $object->showOutputField($val, $key, $object->$key, '');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
{
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
@@ -562,8 +565,8 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
@@ -180,11 +180,11 @@ if ($action == 'install')
|
||||
$modulename = preg_replace('/module_/', '', $original_file);
|
||||
$modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
|
||||
// Search dir $modulename
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule
|
||||
//var_dump($modulenamedir);
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
|
||||
|
||||
if (!dol_is_dir($modulenamedir))
|
||||
{
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule
|
||||
$modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (!dol_is_dir($modulenamedir))
|
||||
{
|
||||
@@ -207,6 +207,7 @@ if ($action == 'install')
|
||||
$modulenamearrays = explode("\n", $metafile);
|
||||
}
|
||||
$modulenamearrays[$modulename] = $modulename;
|
||||
//var_dump($modulenamearrays);exit;
|
||||
|
||||
foreach ($modulenamearrays as $modulenameval) {
|
||||
if (strpos($modulenameval, '#') === 0) continue; // Discard comments
|
||||
@@ -216,15 +217,14 @@ if ($action == 'install')
|
||||
// Now we install the module
|
||||
if (!$error)
|
||||
{
|
||||
//var_dump($dirins);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
|
||||
dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
|
||||
$result = dolCopyDir($conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
$result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ $type=$db->type;
|
||||
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
llxHeader('', '', $help_url);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
function hideoptions () {
|
||||
jQuery("#mysql_options").hide();
|
||||
@@ -242,7 +242,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="drop"'.((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="drop"'.(((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':'').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
@@ -413,11 +413,6 @@ print '<br>';
|
||||
// Define compressions array
|
||||
$compression=array();
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['gz'] = array(
|
||||
'function' => 'gzopen',
|
||||
'id' => 'radio_compression_gzip',
|
||||
@@ -434,13 +429,18 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("Default")
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['gz'] = array(
|
||||
'function' => 'gzopen',
|
||||
@@ -455,11 +455,14 @@ print "\n";
|
||||
|
||||
print $langs->trans("Compression").': ';
|
||||
|
||||
$i = 0;
|
||||
foreach($compression as $key => $val)
|
||||
{
|
||||
if (! $val['function'] || function_exists($val['function'])) {
|
||||
// Enabled export format
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
}
|
||||
else
|
||||
@@ -467,9 +470,10 @@ foreach($compression as $key => $val)
|
||||
// Disabled export format
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@@ -534,12 +538,15 @@ print '</div>';
|
||||
print '</form>';
|
||||
print '</fieldset>';
|
||||
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print "<!-- Dump of a server -->\n";
|
||||
|
||||
print '<form method="post" action="export_files.php" name="dump">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="export_type" value="server" />';
|
||||
print '<input type="hidden" name="page_y" value="" />';
|
||||
|
||||
print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
|
||||
|
||||
@@ -548,39 +555,44 @@ print $langs->trans("BackupDescX").'<br><br>';
|
||||
|
||||
print '<div id="backupfilesleft" class="fichehalfleft">';
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupZipWizard"));
|
||||
|
||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
$prefix='documents';
|
||||
$ext='zip';
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Show compression choices
|
||||
// Example: With gz choice, you can compress in 5mn, a file of 2GB directory (after compression) with 10 Mb memory.
|
||||
print '<div class="formelementrow">';
|
||||
print "\n";
|
||||
|
||||
print $langs->trans("Compression").': ';
|
||||
$filecompression = $compression;
|
||||
array_shift($filecompression);
|
||||
unset($filecompression['none']);
|
||||
$filecompression['zip']= array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip"));
|
||||
|
||||
$i = 0;
|
||||
foreach($filecompression as $key => $val)
|
||||
{
|
||||
if (! $val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
}
|
||||
else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@@ -598,7 +610,7 @@ print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px;
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/tools/export.php
|
||||
* \brief Page to export a database into a dump file
|
||||
* \file htdocs/admin/tools/export_files.php
|
||||
* \brief Page to export documents into a compressed file
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@@ -33,10 +33,11 @@ $langs->load("admin");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$what=GETPOST('what', 'alpha');
|
||||
$export_type=GETPOST('export_type', 'alpha');
|
||||
$file=GETPOST('zipfilename_template', 'alpha');
|
||||
$file=trim(GETPOST('zipfilename_template', 'alpha'));
|
||||
$compression = GETPOST('compression');
|
||||
|
||||
$file = dol_sanitizeFileName($file);
|
||||
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
@@ -73,7 +74,7 @@ if ($action == 'delete')
|
||||
*/
|
||||
|
||||
// Increase limit of time. Works only if we are not in safe mode
|
||||
$ExecTimeLimit=600;
|
||||
$ExecTimeLimit=1800; // 30mn
|
||||
if (!empty($ExecTimeLimit))
|
||||
{
|
||||
$err=error_reporting();
|
||||
@@ -88,7 +89,7 @@ if (!empty($MemoryLimit))
|
||||
@ini_set('memory_limit', $MemoryLimit);
|
||||
}
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
@@ -112,10 +113,18 @@ $utils = new Utils($db);
|
||||
|
||||
if ($compression == 'zip')
|
||||
{
|
||||
$file .= '.zip';
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
|
||||
if ($ret < 0)
|
||||
{
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
|
||||
if ($ret == -2) {
|
||||
$langs->load("errors");
|
||||
$errormsg = $langs->trans("ErrNoZipEngine");
|
||||
}
|
||||
else {
|
||||
$langs->load("errors");
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (in_array($compression, array('gz', 'bz')))
|
||||
@@ -124,7 +133,6 @@ elseif (in_array($compression, array('gz', 'bz')))
|
||||
|
||||
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
||||
|
||||
$file = substr($file, 0, strrpos($file, '.'));
|
||||
$file .= '.tar';
|
||||
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
||||
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
|
||||
|
||||
@@ -205,9 +205,9 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_code) $param.='&search_code='.urlencode($search_code);
|
||||
if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
|
||||
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||
@@ -332,13 +332,14 @@ if ($result)
|
||||
// Description
|
||||
print '<td>';
|
||||
$text=$langs->trans($obj->description);
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg))
|
||||
{
|
||||
$val=explode(',', $reg[1]);
|
||||
$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
|
||||
if (! empty($reg[2])) $text.=$reg[2];
|
||||
}
|
||||
print $text;
|
||||
print dol_escape_htmltag($text);
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
@@ -359,8 +360,8 @@ if ($result)
|
||||
|
||||
// More informations
|
||||
print '<td class="right">';
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent?$obj->user_agent:$langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session?$obj->prefix_session:$langs->trans("Unknown"));
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ $form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("BarCodePrintsheet"));
|
||||
|
||||
print load_fiche_titre($langs->trans("BarCodePrintsheet"));
|
||||
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'<br>';
|
||||
|
||||
@@ -47,7 +47,7 @@ class BOM extends CommonObject
|
||||
public $ismultientitymanaged = 1;
|
||||
|
||||
/**
|
||||
* @var int Does bom support extrafields ? 0=No, 1=Yes
|
||||
* @var int Does object support extrafields ? 0=No, 1=Yes
|
||||
*/
|
||||
public $isextrafieldmanaged = 1;
|
||||
|
||||
@@ -746,6 +746,9 @@ class BOM extends CommonObject
|
||||
$label = '<u>'.$langs->trans("BillOfMaterials").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->status)) {
|
||||
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
|
||||
|
||||
|
||||
@@ -791,16 +791,16 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public function fetchResources()
|
||||
{
|
||||
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
|
||||
$this->userassigned = array();
|
||||
$this->socpeopleassigned = array();
|
||||
|
||||
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
|
||||
$sql .= ' WHERE fk_actioncomm = '.$this->id;
|
||||
$sql .= " AND element_type IN ('user', 'socpeople')";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->userassigned = array();
|
||||
$this->socpeopleassigned = array();
|
||||
|
||||
// If owner is known, we must but id first into list
|
||||
if ($this->userownerid > 0) $this->userassigned[$this->userownerid] = array('id'=>$this->userownerid); // Set first so will be first into list.
|
||||
|
||||
@@ -1393,7 +1393,11 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
$canread = 0;
|
||||
if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event
|
||||
if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned
|
||||
if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other
|
||||
if (! $canread)
|
||||
{
|
||||
$option = 'nolink';
|
||||
}
|
||||
|
||||
@@ -1568,13 +1568,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$titletoshow = $daterange;
|
||||
$titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle);
|
||||
|
||||
if ($event->type_code == 'ICALEVENT') print $titletoshow;
|
||||
else
|
||||
{
|
||||
if ($event->type_code != 'ICALEVENT') {
|
||||
$savlabel = $event->label ? $event->label : $event->libelle;
|
||||
$event->label = $titletoshow;
|
||||
$event->libelle = $titletoshow;
|
||||
print $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
|
||||
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
|
||||
$titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
|
||||
$event->label = $savlabel;
|
||||
$event->libelle = $savlabel;
|
||||
}
|
||||
@@ -1595,6 +1594,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
|
||||
}
|
||||
|
||||
print $titletoshow;
|
||||
print $listofusertoshow;
|
||||
|
||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
|
||||
|
||||
@@ -554,7 +554,10 @@ if ($resql)
|
||||
$actionstatic->type_picto = $obj->type_picto;
|
||||
$actionstatic->label = $obj->label;
|
||||
$actionstatic->location = $obj->location;
|
||||
$actionstatic->note = dol_htmlentitiesbr($obj->note);
|
||||
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
|
||||
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
|
||||
|
||||
$actionstatic->fetchResources();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@@ -656,7 +659,6 @@ if ($resql)
|
||||
if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
||||
print '<td>';
|
||||
|
||||
$actionstatic->fetchResources();
|
||||
if (!empty($actionstatic->socpeopleassigned))
|
||||
{
|
||||
$contactList = array();
|
||||
|
||||
@@ -1047,7 +1047,7 @@ if ($object->id > 0)
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
||||
$sql .= ' f.suspended,';
|
||||
$sql .= ' f.suspended, f.date_when,';
|
||||
$sql .= ' s.nom, s.rowid';
|
||||
$sql .= " ORDER BY f.date_last_gen, f.datec DESC";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/comm/multiprix.php
|
||||
* \ingroup societe
|
||||
* \brief Onglet choix du niveau de prix
|
||||
* \brief Tab to set the price level of a thirdparty
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@@ -64,20 +64,11 @@ $userstatic = new User($db);
|
||||
|
||||
if ($_socid > 0)
|
||||
{
|
||||
// On recupere les donnees societes par l'objet
|
||||
// We load data of thirdparty
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id = $_socid;
|
||||
$objsoc->fetch($_socid, $to);
|
||||
|
||||
if ($errmesg)
|
||||
{
|
||||
print '<div class="error">'.$errmesg.'</div><br>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
|
||||
$head = societe_prepare_head($objsoc);
|
||||
|
||||
@@ -91,7 +82,7 @@ if ($_socid > 0)
|
||||
|
||||
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $langs->trans("PriceLevel").'</td><td>'.$objsoc->price_level."</td></tr>";
|
||||
|
||||
@@ -722,6 +722,7 @@ class Propal extends CommonObject
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
@@ -757,7 +758,7 @@ class Propal extends CommonObject
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new PropaleLigne($this->db);
|
||||
$line->fetch($rowid);
|
||||
$line->fetch_optionals(); // Fetch extrafields for oldcopy
|
||||
$line->fetch_optionals();
|
||||
|
||||
$staticline = clone $line;
|
||||
|
||||
@@ -808,7 +809,10 @@ class Propal extends CommonObject
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach($array_options as $key => $value) {
|
||||
$this->line->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
}
|
||||
|
||||
// Multicurrency
|
||||
@@ -3346,7 +3350,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
@@ -3385,6 +3389,10 @@ class Propal extends CommonObject
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
@@ -3541,9 +3549,10 @@ class Propal extends CommonObject
|
||||
* @param string $get_params Parametres added to url
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $addlinktonotes Add linkt to notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -3609,6 +3618,22 @@ class Propal extends CommonObject
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
||||
if ($txttoshow)
|
||||
{
|
||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
||||
$result .= ' <span class="note inline-block">';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
||||
$result .= img_picto('', 'note');
|
||||
$result .= '</a>';
|
||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||
//$result.='</a>';
|
||||
$result .= '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +275,7 @@ $sql .= " ava.rowid as availability,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||
$sql .= ' p.note_public, p.note_private,';
|
||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql .= ' u.login';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
@@ -764,6 +765,8 @@ if ($resql)
|
||||
|
||||
$objectstatic->id = $obj->rowid;
|
||||
$objectstatic->ref = $obj->ref;
|
||||
$objectstatic->note_public = $obj->note_public;
|
||||
$objectstatic->note_private = $obj->note_private;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
@@ -784,18 +787,11 @@ if ($resql)
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1, '', '', 0, 1);
|
||||
print $objectstatic->getNomUrl(1, '', '', 0, 1, 1);
|
||||
print '</td>';
|
||||
// Warning
|
||||
$warnornote = '';
|
||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
|
||||
if (!empty($obj->note_private))
|
||||
{
|
||||
$warnornote .= ($warnornote ? ' ' : '');
|
||||
$warnornote .= '<span class="note">';
|
||||
$warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
|
||||
$warnornote .= '</span>';
|
||||
}
|
||||
if ($warnornote)
|
||||
{
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
|
||||
@@ -2542,6 +2542,11 @@ if ($action == 'create' && $usercancreate)
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
if ($usercansend) {
|
||||
@@ -2619,11 +2624,6 @@ if ($action == 'create' && $usercancreate)
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
|
||||
|
||||
@@ -959,6 +959,7 @@ class Commande extends CommonOrder
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->db->rollback();
|
||||
@@ -1434,6 +1435,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
@@ -1447,6 +1449,7 @@ class Commande extends CommonOrder
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
@@ -3071,6 +3074,7 @@ class Commande extends CommonOrder
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new OrderLine($this->db);
|
||||
$line->fetch($rowid);
|
||||
$line->fetch_optionals();
|
||||
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
@@ -3082,6 +3086,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
@@ -3142,7 +3147,10 @@ class Commande extends CommonOrder
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach($array_options as $key => $value) {
|
||||
$this->line->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->line->update($user, $notrigger);
|
||||
@@ -3558,9 +3566,10 @@ class Commande extends CommonOrder
|
||||
* @param int $short ???
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $addlinktonotes Add linkt to notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@@ -3627,6 +3636,22 @@ class Commande extends CommonOrder
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
||||
if ($txttoshow)
|
||||
{
|
||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
||||
$result .= ' <span class="note inline-block">';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
||||
$result .= img_picto('', 'note');
|
||||
$result .= '</a>';
|
||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||
//$result.='</a>';
|
||||
$result .= '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -3697,7 +3722,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||
|
||||
@@ -3731,8 +3756,13 @@ class Commande extends CommonOrder
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->availability_code = 'DSP';
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@@ -804,6 +804,8 @@ if ($resql)
|
||||
$generic_commande->total_ht = $obj->total_ht;
|
||||
$generic_commande->total_tva = $obj->total_tva;
|
||||
$generic_commande->total_ttc = $obj->total_ttc;
|
||||
$generic_commande->note_public = $obj->note_public;
|
||||
$generic_commande->note_private = $obj->note_private;
|
||||
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
@@ -818,7 +820,7 @@ if ($resql)
|
||||
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1);
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
@@ -926,12 +928,6 @@ if ($resql)
|
||||
if ($generic_commande->hasDelay()) {
|
||||
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
|
||||
}
|
||||
if (!empty($obj->note_private) || !empty($obj->note_public))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
|
||||
@@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Onglets
|
||||
$head = account_statement_prepare_head($object, $num);
|
||||
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), -1, 'account');
|
||||
dol_fiche_head($head, 'document', $langs->trans("AccountStatement"), -1, 'account');
|
||||
|
||||
|
||||
// Build file list
|
||||
@@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
|
||||
$title = $langs->trans("AccountStatement").' '.$num.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title, '', 'title_bank.png');
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@@ -573,11 +573,13 @@ if ($page >= $nbtotalofpages)
|
||||
if (empty($search_account)) $mode_balance_ok = false;
|
||||
// If a search is done $mode_balance_ok=false
|
||||
if (!empty($search_ref)) $mode_balance_ok = false;
|
||||
if (!empty($req_nb)) $mode_balance_ok = false;
|
||||
if (!empty($search_description)) $mode_balance_ok = false;
|
||||
if (!empty($search_type)) $mode_balance_ok = false;
|
||||
if (!empty($debit)) $mode_balance_ok = false;
|
||||
if (!empty($credit)) $mode_balance_ok = false;
|
||||
if (!empty($thirdparty)) $mode_balance_ok = false;
|
||||
if (!empty($search_debit)) $mode_balance_ok = false;
|
||||
if (!empty($search_credit)) $mode_balance_ok = false;
|
||||
if (!empty($search_thirdparty)) $mode_balance_ok = false;
|
||||
if ($search_conciliated != '') $mode_balance_ok = false;
|
||||
if (!empty($search_num_releve)) $mode_balance_ok = false;
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
|
||||
@@ -364,12 +364,12 @@ if (empty($numref))
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Show list of bank statements
|
||||
* Show list of record into a bank statement
|
||||
*/
|
||||
|
||||
// Onglets
|
||||
$head = account_statement_prepare_head($object, $numref);
|
||||
dol_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');
|
||||
dol_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account');
|
||||
|
||||
|
||||
$mesprevnext = '';
|
||||
@@ -382,7 +382,7 @@ else
|
||||
$mesprevnext .= '</ul></div>';
|
||||
|
||||
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title, $mesprevnext, 'title_bank.png');
|
||||
print load_fiche_titre($title, $mesprevnext, '');
|
||||
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'title_bank.png', 0, '', '', 0, 1);
|
||||
|
||||
print "<form method=\"post\" action=\"releve.php\">";
|
||||
@@ -444,12 +444,11 @@ else
|
||||
// Date de valeur
|
||||
print '<td valign="center" class="center nowrap">';
|
||||
print dol_print_date($db->jdate($objp->dv), "day").' ';
|
||||
print '<a href="releve.php?action=dvprev&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print img_edit_remove()."</a> ";
|
||||
print '<a href="releve.php?action=dvnext&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&num='.$numref.'&account='.$object->id.'&dvid='.$objp->rowid.'">';
|
||||
print img_edit_add()."</a>";
|
||||
print "</td>\n";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
|
||||
// Type and num
|
||||
if ($objp->fk_type == 'SOLD') {
|
||||
@@ -466,7 +465,8 @@ else
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq ? $objp->num_chq : '').$link.'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
print '<td valign="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
$reg = array();
|
||||
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
|
||||
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) print $langs->trans($reg[1]);
|
||||
|
||||
@@ -56,7 +56,7 @@ if (!$sortfield) $sortfield = 'rowid';
|
||||
if (!$sortorder) $sortorder = 'ASC';
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
|
||||
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@@ -82,8 +82,8 @@ $hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
|
||||
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
|
||||
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
@@ -544,14 +544,16 @@ if (empty($action) || $action == "view")
|
||||
print $object->posmodule;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td valign="middle">'.$langs->trans("CashDesk").' ID</td><td>';
|
||||
print '<tr><td valign="middle">'.$langs->trans("Terminal").'</td><td>';
|
||||
print $object->posnumber;
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("Period");
|
||||
print '</td><td>';
|
||||
print $object->year_close."-".$object->month_close."-".$object->day_close;
|
||||
print $object->year_close;
|
||||
print ($object->month_close ? "-" : "").$object->month_close;
|
||||
print ($object->day_close ? "-" : "").$object->day_close;
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -570,7 +572,6 @@ if (empty($action) || $action == "view")
|
||||
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
|
||||
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print "</td></tr>";
|
||||
|
||||
foreach ($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';
|
||||
|
||||
@@ -168,8 +168,8 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass = 'CashControl';
|
||||
$objectlabel = 'CashControl';
|
||||
$permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
|
||||
//$uploaddir = '';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@@ -59,7 +59,7 @@ class CashControl extends CommonObject
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
|
||||
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18),
|
||||
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
|
||||
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20),
|
||||
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
|
||||
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
|
||||
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
|
||||
|
||||
@@ -33,11 +33,13 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$_GET['optioncss']="print";
|
||||
include_once 'class/cashcontrol.class.php';
|
||||
$cashcontrol= new CashControl($db);
|
||||
$cashcontrol->fetch($id);
|
||||
|
||||
@@ -50,7 +52,8 @@ $arrayfields=array(
|
||||
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
|
||||
'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1),
|
||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||
'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||
);
|
||||
|
||||
@@ -128,7 +131,6 @@ if ($resql)
|
||||
|
||||
$invoicetmp = new Facture($db);
|
||||
|
||||
|
||||
print "<div style='text-align: right'><h2>";
|
||||
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
|
||||
print "</h2></div>";
|
||||
@@ -136,13 +138,16 @@ if ($resql)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste">'."\n";
|
||||
|
||||
$param = '';
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'class="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '"', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($arrayfields['cp.code']['label'], $_SERVER['PHP_SELF'], 'cp.code', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
print "</tr>\n";
|
||||
|
||||
$posconciliatecol = 0;
|
||||
@@ -151,7 +156,9 @@ if ($resql)
|
||||
$sign = 1;
|
||||
$cash=$bank=$cheque=$other=0;
|
||||
|
||||
$totalarray=array();
|
||||
$totalarray = array();
|
||||
$cachebankaccount = array();
|
||||
$amountpertype = array();
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@@ -168,7 +175,9 @@ if ($resql)
|
||||
$bankaccount = $cachebankaccount[$objp->bankid];
|
||||
}
|
||||
|
||||
/*if ($first == "yes")
|
||||
$invoicetmp->fetch($objp->facid);
|
||||
|
||||
/*if ($first == "yes")
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
|
||||
@@ -181,12 +190,10 @@ if ($resql)
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap left">';
|
||||
$invoicetmp->fetch($objp->facid);
|
||||
print $invoicetmp->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
// Date ope
|
||||
print '<td class="nowrap left">';
|
||||
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
|
||||
@@ -197,26 +204,38 @@ if ($resql)
|
||||
print '<td class="nowrap right">';
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($cashcontrol->posmodule=="takepos"){
|
||||
if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
|
||||
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
|
||||
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other+=$objp->amount;
|
||||
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
|
||||
}
|
||||
else{
|
||||
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other+=$objp->amount;
|
||||
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
|
||||
}
|
||||
if ($objp->code == 'CHQ') {
|
||||
$cheque += $objp->amount;
|
||||
} elseif ($objp->code == 'CB') {
|
||||
$bank += $objp->amount;
|
||||
} else {
|
||||
if ($conf->global->$var1 == $bankaccount->id) $cash += $objp->amount;
|
||||
//elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
|
||||
//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Debit
|
||||
// Type
|
||||
print '<td class="right">';
|
||||
print $objp->code;
|
||||
if (empty($amountpertype[$objp->code])) $amountpertype[$objp->code] = 0;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
// Debit
|
||||
print '<td class="right">';
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print price($objp->amount * -1);
|
||||
$totalarray['val']['totaldebfield'] += $objp->amount;
|
||||
$amountpertype[$objp->code] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@@ -228,6 +247,7 @@ if ($resql)
|
||||
{
|
||||
print price($objp->amount);
|
||||
$totalarray['val']['totalcredfield'] += $objp->amount;
|
||||
$amountpertype[$objp->code] -= $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@@ -243,12 +263,34 @@ if ($resql)
|
||||
|
||||
print "</table>";
|
||||
|
||||
$cash=$cash+$cashcontrol->opening;
|
||||
//$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
|
||||
$cash = $cash + $cashcontrol->opening;
|
||||
|
||||
print "<div style='text-align: right'><h2>";
|
||||
print $langs->trans("Cash").": ".price($cash)."<br><br>";
|
||||
print $langs->trans("PaymentTypeCB").": ".price($bank)."<br><br>";
|
||||
print $langs->trans("PaymentTypeCHQ").": ".price($cheque)."<br><br>";
|
||||
if ($other) print $langs->trans("Other").": ".price($other)."<br><br>";
|
||||
print $langs->trans("Cash").": ".price($cash);
|
||||
if ($cash != $cashcontrol->cash) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cash).'</span>';
|
||||
}
|
||||
print "<br><br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
|
||||
if ($cheque != $cashcontrol->cheque) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cheque).'</span>';
|
||||
}
|
||||
print "<br><br>";
|
||||
|
||||
//print '<br>';
|
||||
print $langs->trans("PaymentTypeCB").": ".price($bank);
|
||||
if ($bank != $cashcontrol->card) {
|
||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->card).'</span>';
|
||||
}
|
||||
print "<br><br>";
|
||||
|
||||
// print '<br>';
|
||||
if ($other) {
|
||||
print '<br>'.$langs->trans("Other").": ".price($other)."<br><br>";
|
||||
}
|
||||
print "</h2></div>";
|
||||
|
||||
//save totals to DB
|
||||
|
||||
@@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products'));
|
||||
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products', 'banks'));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
@@ -1030,6 +1030,8 @@ if ($action == 'create')
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')';
|
||||
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
|
||||
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
@@ -1446,8 +1448,6 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Bank Account
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
@@ -1468,8 +1468,6 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Model pdf
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('Model');
|
||||
|
||||
@@ -103,7 +103,9 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
if ($action != 'add') {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@@ -134,6 +136,8 @@ if ($user->socid) $socid = $user->socid;
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@@ -286,6 +290,39 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Also negative lines should not be allowed on 'non Credit notes' invoices. A test is done when adding or updating lines but we must
|
||||
// do it again in validation to avoid cases where invoice is created from another object that allow negative lines.
|
||||
// Note that we can accept the negative line if sum with other lines with same vat is positivie: Because all the lines will be merged together
|
||||
// when converted into 'available credit' and we will get a positive available credit line.
|
||||
// Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only).
|
||||
$array_of_pu_ht_per_vat_rate = array();
|
||||
$array_of_pu_ht_devise_per_vat_rate = array();
|
||||
foreach($object->lines as $line) {
|
||||
if (empty($array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
if (empty($array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
$array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->subprice;
|
||||
$array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice;
|
||||
}
|
||||
//var_dump($array_of_pu_ht_per_vat_rate);exit;
|
||||
foreach($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
{
|
||||
$pu_ht = $array_of_pu_ht_per_vat_rate[$vatrate];
|
||||
$pu_ht_devise = $array_of_pu_ht_devise_per_vat_rate[$vatrate];
|
||||
|
||||
if (($pu_ht < 0 || $pu_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -941,11 +978,13 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!($_POST['fac_replacement'] > 0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@@ -992,6 +1031,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@@ -999,6 +1039,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@@ -1181,6 +1222,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@@ -1223,6 +1265,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@@ -1230,6 +1273,7 @@ if (empty($reshook))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
@@ -1642,6 +1686,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@@ -1811,7 +1856,12 @@ if (empty($reshook))
|
||||
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@@ -2123,7 +2173,7 @@ if (empty($reshook))
|
||||
if (!GETPOST('qty')) $special_code = 3;
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$line->fetch(GETPOST('lineid', 'int'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0)
|
||||
@@ -2192,7 +2242,12 @@ if (empty($reshook))
|
||||
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
@@ -2283,17 +2338,17 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier'))
|
||||
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice
|
||||
{
|
||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||
if (GETPOST('all_progress') != "")
|
||||
{
|
||||
$all_progress = GETPOST('all_progress', 'int');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
if (floatval($all_progress) < floatval($percent)) {
|
||||
$mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
$mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else
|
||||
@@ -2303,7 +2358,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -2939,7 +2994,7 @@ if ($action == 'create')
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
||||
@@ -2992,14 +3047,16 @@ if ($action == 'create')
|
||||
exit();
|
||||
}
|
||||
$options = "";
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
if (is_array($facids)) {
|
||||
foreach ($facids as $facparam)
|
||||
{
|
||||
$options .= '<option value="'.$facparam ['id'].'"';
|
||||
if ($facparam ['id'] == $_POST['fac_replacement'])
|
||||
$options .= ' selected';
|
||||
$options .= '>'.$facparam ['ref'];
|
||||
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
|
||||
$options .= '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<!-- replacement line -->';
|
||||
@@ -3955,7 +4012,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
if ($result > 0) {
|
||||
print '. <span class="opacitymediumbycolor">'.$langs->trans(
|
||||
"GeneratedFromTemplate",
|
||||
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
|
||||
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
|
||||
).'</span>';
|
||||
}
|
||||
}
|
||||
@@ -4240,7 +4297,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
if (!$displayWarranty) {
|
||||
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
|
||||
}
|
||||
@@ -4557,7 +4614,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Payments already done (from payment on this invoice)
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||
$sql .= ' pf.amount,';
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||
@@ -4583,7 +4640,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
$paymentstatic->id = $objp->rowid;
|
||||
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentstatic->ref = $objp->ref;
|
||||
$paymentstatic->num_paiement = $objp->num_paiement;
|
||||
$paymentstatic->num_payment = $objp->num_payment;
|
||||
$paymentstatic->payment_code = $objp->payment_code;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
@@ -4591,7 +4648,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
|
||||
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
|
||||
print '<td>'.$label.' '.$objp->num_paiement.'</td>';
|
||||
print '<td>'.$label.' '.$objp->num_payment.'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
@@ -5082,21 +5139,6 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
|
||||
{
|
||||
@@ -5108,6 +5150,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
|
||||
// For situation invoice with excess received
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $usercancreate
|
||||
&& !$objectidnext
|
||||
@@ -5123,6 +5166,21 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
|
||||
{
|
||||
if (!$objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Remove situation from cycle
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
|
||||
@@ -448,10 +448,12 @@ class Facture extends CommonInvoice
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y');
|
||||
$substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y');
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
|
||||
// Only for tempalte invoice
|
||||
// Only for template invoice
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $_facrec->nb_gen_done;
|
||||
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $_facrec->nb_gen_max;
|
||||
|
||||
//var_dump($substitutionarray);exit;
|
||||
|
||||
@@ -3103,6 +3105,7 @@ class Facture extends CommonInvoice
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new FactureLigne($this->db);
|
||||
$line->fetch($rowid);
|
||||
$line->fetch_optionals();
|
||||
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
@@ -3171,7 +3174,10 @@ class Facture extends CommonInvoice
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach($array_options as $key => $value) {
|
||||
$this->line->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->line->update($user, $notrigger);
|
||||
@@ -4046,7 +4052,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function initAsSpecimen($option = '')
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$now = dol_now();
|
||||
$arraynow = dol_getdate($now);
|
||||
@@ -4088,9 +4094,14 @@ class Facture extends CommonInvoice
|
||||
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
|
||||
$this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR
|
||||
$this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR
|
||||
|
||||
$this->note_public = 'This is a comment (public)';
|
||||
$this->note_private = 'This is a comment (private)';
|
||||
$this->note = 'This is a comment (private)';
|
||||
|
||||
$this->multicurrency_tx = 1;
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
$this->fk_incoterms = 0;
|
||||
$this->location_incoterms = '';
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ if ($object->id > 0)
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
|
||||
@@ -282,7 +282,7 @@ if ($object->id > 0)
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
@@ -309,7 +309,7 @@ if ($object->id > 0)
|
||||
|
||||
// Payment condition
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
||||
@@ -334,7 +334,7 @@ if ($object->id > 0)
|
||||
|
||||
// Date payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
@@ -362,7 +362,7 @@ if ($object->id > 0)
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
@@ -409,7 +409,7 @@ if ($object->id > 0)
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
|
||||
@@ -397,7 +397,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $facturestatic->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
@@ -509,7 +509,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
|
||||
//$thirdpartystatic->code_compta = $obj->code_compta;
|
||||
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven nowraponall"><td>';
|
||||
print $facstatic->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@@ -637,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
print $invoice->getNomUrl(1, '');
|
||||
@@ -715,7 +715,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
// Price
|
||||
print '<td class="right" '.(($invoice->id == $facid) ? ' style="font-weight: bold" ' : '').'>'.price($sign * $objp->total_ttc).'</td>';
|
||||
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||
|
||||
// Received or paid back
|
||||
print '<td class="right">'.price($sign * $paiement);
|
||||
|
||||
@@ -63,7 +63,7 @@ $object = new BonPrelevement($db, "");
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard'));
|
||||
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -362,10 +362,19 @@ if ($id > 0 || $ref)
|
||||
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
print '<form method="get" action="' . $_SERVER ['PHP_SELF'] . '" name="search_form">' . "\n";
|
||||
print '<input type="hidden" name="id" value="' . $id . '"/>';
|
||||
print '<input type="hidden" name="socid" value="' . $socid . '"/>';
|
||||
if (! empty($page)) {
|
||||
print '<input type="hidden" name="page" value="' . $page . '"/>';
|
||||
}
|
||||
if (! empty($limit)) {
|
||||
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
|
||||
}
|
||||
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<table class="noborder liste" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd);
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
|
||||
@@ -375,7 +384,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
$total = 0;
|
||||
|
||||
while ($i < min($num, $conf->liste_limit))
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
@@ -433,6 +442,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ else
|
||||
print "</form>\n";
|
||||
|
||||
print "</div>\n";
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@@ -224,6 +225,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
@@ -239,11 +245,12 @@ if ($resql)
|
||||
if($socid) $param .= '&socid='.urlencode($socid);
|
||||
if($option) $param .= "&option=".urlencode($option);
|
||||
|
||||
if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
if (! empty($limit)) {
|
||||
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjec
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$search_facture = GETPOST('search_facture', 'alpha');
|
||||
$search_societe = trim(GETPOST('search_societe', 'alpha'));
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@@ -57,6 +60,26 @@ if (! $sortfield) $sortfield="f.ref";
|
||||
|
||||
$massactionbutton = '';
|
||||
|
||||
$hookmanager->initHooks(array('withdrawalstodolist'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('socid' => $socid, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_facture = '';
|
||||
$search_societe = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -98,10 +121,8 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql.= " AND pfd.fk_facture = f.rowid";
|
||||
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
|
||||
{
|
||||
$sql.= natural_search("s.nom", 'search_societe');
|
||||
}
|
||||
if ($search_facture) $sql.= natural_search("f.ref", $search_facture);
|
||||
if ($search_societe) $sql.= natural_search("s.nom", $search_societe);
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@@ -140,9 +161,7 @@ else
|
||||
|
||||
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
@@ -152,6 +171,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<table class="liste centpercent">';
|
||||
|
||||
@@ -164,13 +184,13 @@ print_liste_field_titre('');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture', 'alpha')).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe', 'alpha')).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" class="middle">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
@@ -141,7 +141,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
|
||||
if (!$dateech)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
elseif (!$dateperiod)
|
||||
@@ -193,7 +193,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
|
||||
|
||||
if (! $dateech)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (! $dateperiod)
|
||||
@@ -337,26 +337,26 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end period
|
||||
// Date
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date due
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $langs->trans("DateDue");
|
||||
print $langs->trans("Date");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date end period
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">';
|
||||
@@ -434,11 +434,11 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1);
|
||||
}
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240);
|
||||
}
|
||||
|
||||
|
||||
@@ -515,9 +515,20 @@ if ($id > 0)
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_label."</td>";
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("Type")."</td><td>".$object->type_label."</td>";
|
||||
print "</tr>";
|
||||
|
||||
// Date
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Date")."</td><td>";
|
||||
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
|
||||
print "</td></tr>";
|
||||
} else {
|
||||
print "<tr><td>".$langs->trans("Date")."</td><td>".dol_print_date($object->date_ech, 'day')."</td></tr>";
|
||||
}
|
||||
|
||||
// Period end date
|
||||
print "<tr><td>".$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"))."</td>";
|
||||
print "<td>";
|
||||
@@ -531,16 +542,6 @@ if ($id > 0)
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Due date
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td>";
|
||||
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
|
||||
print "</td></tr>";
|
||||
} else {
|
||||
print "<tr><td>".$langs->trans("DateDue")."</td><td>".dol_print_date($object->date_ech, 'day')."</td></tr>";
|
||||
}
|
||||
|
||||
// Amount
|
||||
if ($action == 'edit')
|
||||
{
|
||||
@@ -604,7 +605,7 @@ if ($id > 0)
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||
$sql .= " c.code as type_code,c.libelle as paiement_type,";
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
@@ -653,6 +654,7 @@ if ($id > 0)
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
$bankaccountstatic->number = $objp->banumber;
|
||||
$bankaccountstatic->currency_code = $objp->bacurrency_code;
|
||||
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$bankaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
@@ -499,16 +499,20 @@ class ChargeSociales extends CommonObject
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("customers","bills"));
|
||||
|
||||
// We reinit status array to force to redefine them because label may change according to properties values.
|
||||
$this->labelStatus = array();
|
||||
$this->labelStatusShort = array();
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
|
||||
$this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid');
|
||||
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Paid');
|
||||
if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
}
|
||||
|
||||
$statusType = 'status1';
|
||||
|
||||
@@ -121,7 +121,7 @@ $sql .= " AND cs.entity = ".$conf->entity;
|
||||
// Search criteria
|
||||
if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql .= natural_search("cs.libelle", $search_label);
|
||||
if ($search_amount) $sql .= natural_search("cs.amount", price2num(trim($search_amount)), 1);
|
||||
if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1);
|
||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status);
|
||||
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
|
||||
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year);
|
||||
@@ -217,7 +217,9 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
|
||||
print '</td>';
|
||||
// Period end date
|
||||
// Date
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Period end date
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
|
||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
|
||||
@@ -227,7 +229,6 @@ if ($resql)
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone right">';
|
||||
$liststatus = array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid"));
|
||||
@@ -244,9 +245,9 @@ if ($resql)
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cs.paye", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@@ -276,6 +277,10 @@ if ($resql)
|
||||
print "<td>".$obj->type_label."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date end period
|
||||
print '<td class="center">';
|
||||
if ($obj->periode)
|
||||
@@ -295,10 +300,6 @@ if ($resql)
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||
|
||||
// Due date
|
||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
|
||||
$result = restrictedArea($user, 'tax', '', 'vat', 'charges');
|
||||
|
||||
|
||||
// Get parameters
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
@@ -155,23 +155,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Si ajout champ produit libre
|
||||
if (GETPOST('mode') == 'libre')
|
||||
{
|
||||
$date_start_sl = '';
|
||||
$date_end_sl = '';
|
||||
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear'))
|
||||
{
|
||||
$date_start_sl = dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
|
||||
}
|
||||
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear'))
|
||||
{
|
||||
$date_end_sl = dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
|
||||
}
|
||||
}
|
||||
|
||||
// Param dates
|
||||
$date_contrat = '';
|
||||
$date_start_update = '';
|
||||
$date_end_update = '';
|
||||
$date_start_real_update = '';
|
||||
@@ -417,12 +401,12 @@ if (empty($reshook))
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
$price_ht = price2num(GETPOST('price_ht'));
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -430,7 +414,7 @@ if (empty($reshook))
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef));
|
||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
if ($qty == '')
|
||||
@@ -438,7 +422,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc))
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free' && empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
|
||||
$error++;
|
||||
@@ -612,7 +596,7 @@ if (empty($reshook))
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['prod_entry_mode']);
|
||||
unset($_POST['prod_entry_mode']);
|
||||
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
@@ -626,8 +610,8 @@ if (empty($reshook))
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
unset($_POST ['np_marginRate']);
|
||||
unset($_POST ['np_markRate']);
|
||||
unset($_POST['np_marginRate']);
|
||||
unset($_POST['np_markRate']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['idprod']);
|
||||
|
||||
@@ -665,11 +649,12 @@ if (empty($reshook))
|
||||
if (!$error)
|
||||
{
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')) < 0)
|
||||
if ($objectline->fetch(GETPOST('elrowid', 'int')) < 0)
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
$objectline->fetch_optionals();
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
@@ -693,6 +678,7 @@ if (empty($reshook))
|
||||
$txtva = $vat_rate;
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
@@ -735,7 +721,13 @@ if (empty($reshook))
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
|
||||
$objectline->array_options = $array_options;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach($array_options as $key => $value) {
|
||||
$objectline->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
@@ -1114,6 +1106,7 @@ if ($action == 'create')
|
||||
if (GETPOST('origin') && GETPOST('originid'))
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$regs = array();
|
||||
$element = $subelement = GETPOST('origin');
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs))
|
||||
{
|
||||
@@ -1544,7 +1537,7 @@ else
|
||||
$sql .= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
|
||||
$sql .= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
|
||||
$sql .= " cd.fk_unit,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity, p.tosell, p.tobuy, p.tobatch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE cd.rowid = ".$object->lines[$cursorline - 1]->id;
|
||||
@@ -1577,12 +1570,16 @@ else
|
||||
// Label
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
$productstatic->id = $objp->fk_product;
|
||||
$productstatic->type = $objp->ptype;
|
||||
$productstatic->ref = $objp->pref;
|
||||
$productstatic->entity = $objp->pentity;
|
||||
$productstatic->label = $objp->plabel;
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->status_batch = $objp->tobatch;
|
||||
|
||||
print '<td>';
|
||||
$text = $productstatic->getNomUrl(1, '', 32);
|
||||
if ($objp->plabel)
|
||||
{
|
||||
|
||||
@@ -189,6 +189,36 @@ class Contrat extends CommonObject
|
||||
protected $lines_id_index_mapper = array();
|
||||
|
||||
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
|
||||
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'Ref supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'mise_en_service' =>array('type'=>'datetime', 'label'=>'Mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'Fin validite', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||
'fk_user_mise_en_service' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
);
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_CLOSED = 2;
|
||||
@@ -1381,10 +1411,10 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Ajoute une ligne de contrat en base
|
||||
*
|
||||
* @param string $desc Description de la ligne
|
||||
* @param float $pu_ht Prix unitaire HT
|
||||
* @param int $qty Quantite
|
||||
* @param float $txtva Taux tva
|
||||
* @param string $desc Description of line
|
||||
* @param float $pu_ht Unit price net
|
||||
* @param int $qty Quantity
|
||||
* @param float $txtva Vat rate
|
||||
* @param float $txlocaltax1 Local tax 1 rate
|
||||
* @param float $txlocaltax2 Local tax 2 rate
|
||||
* @param int $fk_product Id produit
|
||||
@@ -1421,9 +1451,18 @@ class Contrat extends CommonObject
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$txtva = price2num($txtva);
|
||||
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$remise_percent = price2num($remise_percent);
|
||||
@@ -1456,15 +1495,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva.($vat_src_code ? ' ('.$vat_src_code.')' : ''), 0, $this->societe, $mysoc);
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
@@ -1738,8 +1769,14 @@ class Contrat extends CommonObject
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options = $array_options;
|
||||
$contractline->id = $rowid;
|
||||
$contractline->fetch($rowid);
|
||||
$contractline->fetch_optionals();
|
||||
|
||||
// We replace values in $contractline->array_options only for entries defined into $array_options
|
||||
foreach($array_options as $key => $value) {
|
||||
$contractline->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
|
||||
$result = $contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@@ -248,9 +248,17 @@ if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract).
|
||||
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
$filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
|
||||
if ($filter_dateouvertureprevue != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = '=';
|
||||
|
||||
$filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
|
||||
if ($filter_date1 != '' && $filter_op1 == -1) $filter_op1 = '=';
|
||||
|
||||
$filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
|
||||
if ($filter_date2 != '' && $filter_op2 == -1) $filter_op2 = '=';
|
||||
|
||||
$filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
|
||||
if ($filter_datecloture != '' && $filter_opcloture == -1) $filter_opcloture = '=';
|
||||
|
||||
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'";
|
||||
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
|
||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
||||
@@ -259,6 +267,8 @@ if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
//print $sql;
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
|
||||
@@ -352,6 +352,7 @@ if (!$error && $massaction == 'confirm_presend')
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
$reg = array();
|
||||
$fromtype = GETPOST('fromtype');
|
||||
if ($fromtype === 'user') {
|
||||
$from = $user->getFullName($langs).' <'.$user->email.'>';
|
||||
|
||||
@@ -273,6 +273,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
|
||||
|
||||
$langs->load("commercial");
|
||||
|
||||
$reg = array();
|
||||
$fromtype = GETPOST('fromtype', 'alpha');
|
||||
if ($fromtype === 'robot') {
|
||||
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
|
||||
@@ -292,7 +293,8 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
}
|
||||
elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql .= ' WHERE rowid = '.(int) $reg[1];
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
|
||||
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
|
||||
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
|
||||
|
||||
$result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES), '_public');
|
||||
$result_update = $object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES, 'UTF-8', 1), '_public');
|
||||
|
||||
if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture')))
|
||||
|
||||
@@ -109,7 +109,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
$sql.= " AND fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
|
||||
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
||||
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
|
||||
$sql.= " ORDER BY datelimite ASC, f.ref ASC ";
|
||||
|
||||
@@ -94,6 +94,7 @@ class box_services_expired extends ModeleBoxes
|
||||
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
|
||||
$sql.= ", s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql .= " ORDER BY date_line ASC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
|
||||
@@ -4199,6 +4199,7 @@ abstract class CommonObject
|
||||
|
||||
$product_static->ref = $line->ref; //can change ref in hook
|
||||
$product_static->label = $line->label; //can change label in hook
|
||||
|
||||
$text = $product_static->getNomUrl(1);
|
||||
|
||||
// Define output language and label
|
||||
@@ -5186,7 +5187,6 @@ abstract class CommonObject
|
||||
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
|
||||
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
|
||||
|
||||
|
||||
if ($attributeRequired)
|
||||
{
|
||||
$mandatorypb = false;
|
||||
@@ -5217,7 +5217,6 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($attributeType)
|
||||
{
|
||||
case 'int':
|
||||
@@ -6124,7 +6123,7 @@ abstract class CommonObject
|
||||
$param_list_array = explode(':', $param_list[0]);
|
||||
$showempty = (($required && $default != '') ? 0 : 1);
|
||||
|
||||
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled']) ? 0 : 1);
|
||||
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
|
||||
|
||||
if (!empty($param_list_array[2])) // If we set to add a create button
|
||||
{
|
||||
@@ -7523,7 +7522,10 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// If field is an implicit foreign key field
|
||||
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) $values[$key] = 'null';
|
||||
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) {
|
||||
if (isset($this->fields[$key]['default'])) $values[$key] = $this->fields[$key]['default'];
|
||||
else $values[$key] = 'null';
|
||||
}
|
||||
if (!empty($this->fields[$key]['foreignkey']) && empty($values[$key])) $values[$key] = 'null';
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ class Conf
|
||||
{
|
||||
if (!empty($this->$module->enabled))
|
||||
{
|
||||
foreach ($dirs as $type => $name)
|
||||
foreach ($dirs as $type => $name) // $type is 'output' or 'temp'
|
||||
{
|
||||
$subdir = ($type == 'temp' ? '/temp' : '');
|
||||
// For multicompany sharings
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file class/emailsenderprofile.class.php
|
||||
* \ingroup monmodule
|
||||
* \file core/class/emailsenderprofile.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is a CRUD class file for EmailSenderProfile (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class for EmailSenderProfile
|
||||
*/
|
||||
@@ -60,24 +61,29 @@ class EmailSenderProfile extends CommonObject
|
||||
const STATUS_ENABLED = 1;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*
|
||||
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
@@ -90,12 +96,12 @@ class EmailSenderProfile extends CommonObject
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
|
||||
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
|
||||
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
|
||||
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
|
||||
'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1),
|
||||
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
|
||||
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -2147,23 +2147,27 @@ class ExtraFields
|
||||
|
||||
if (in_array($key_type, array('date', 'datetime')))
|
||||
{
|
||||
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it.
|
||||
// Clean parameters
|
||||
$value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
|
||||
$value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
|
||||
}
|
||||
elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
|
||||
{
|
||||
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
// Make sure we get an array even if there's only one checkbox
|
||||
$value_arr = (array) $value_arr;
|
||||
$value_key = implode(',', $value_arr);
|
||||
}
|
||||
elseif (in_array($key_type, array('price', 'double')))
|
||||
elseif (in_array($key_type, array('price', 'double', 'int')))
|
||||
{
|
||||
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key = price2num($value_arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
|
||||
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ class Form
|
||||
$valuetoshow = price2num($editvalue ? $editvalue : $value);
|
||||
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
|
||||
}
|
||||
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata))
|
||||
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor'
|
||||
{
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$cols = $tmp[2];
|
||||
@@ -225,8 +225,10 @@ class Form
|
||||
}
|
||||
|
||||
$valuetoshow = ($editvalue ? $editvalue : $value);
|
||||
|
||||
$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'">';
|
||||
// textarea convert automatically entities chars into simple chars.
|
||||
// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwig is off.
|
||||
$valuetoshow = str_replace('&', '&', $valuetoshow);
|
||||
$ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
|
||||
$ret .= '</textarea>';
|
||||
}
|
||||
@@ -2359,6 +2361,7 @@ class Form
|
||||
$objp->price_ttc = price2num($objp->price_ttc, 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel, $filterkey);
|
||||
// Add new entry
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
@@ -2509,7 +2512,7 @@ class Form
|
||||
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level.'', LOG_DEBUG);
|
||||
$result2 = $this->db->query($sql);
|
||||
if ($result2)
|
||||
{
|
||||
@@ -2637,7 +2640,7 @@ class Form
|
||||
$langs->load("stocks");
|
||||
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->rowid);
|
||||
$tmpproduct->fetch($objp->rowid, '', '', '', 1, 1, 1); // Load product without lang and prices arrays (we just need to make ->virtual_stock() after)
|
||||
$tmpproduct->load_virtual_stock();
|
||||
$virtualstock = $tmpproduct->stock_theorique;
|
||||
|
||||
@@ -3008,7 +3011,6 @@ class Form
|
||||
* @param int $productid Id of product
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param int $selected_supplier Pre-selected supplier if more than 1 result
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '')
|
||||
@@ -5168,11 +5170,11 @@ class Form
|
||||
{
|
||||
if ($societe_vendeuse->id == $mysoc->id)
|
||||
{
|
||||
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>';
|
||||
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</font>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</div>';
|
||||
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</font>';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -5911,6 +5913,7 @@ class Form
|
||||
//var_dump($objecttmp->filter);
|
||||
$prefixforautocompletemode = $objecttmp->element;
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
|
||||
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode='produit';
|
||||
$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
|
||||
@@ -6233,7 +6236,12 @@ class Form
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= $style.$disabled;
|
||||
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
|
||||
if (is_array($id)) {
|
||||
if (in_array($key, $id) && !$disabled) $out .= ' selected'; // To preselect a value
|
||||
} else {
|
||||
$id = (string) $id; // if $id = 0, then $id = '0'
|
||||
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
|
||||
}
|
||||
if ($nohtmlescape) $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
|
||||
if (is_array($tmpvalue))
|
||||
{
|
||||
|
||||
@@ -309,7 +309,7 @@ class FormAccounting extends Form
|
||||
return -1;
|
||||
}
|
||||
|
||||
$selected = 0;
|
||||
$selected = $selectid; // selectid can be -1, 0, 123
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (empty($obj->labelshort))
|
||||
|
||||
@@ -1712,8 +1712,8 @@ class FormFile
|
||||
if (count($filearray) == 0)
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="5">';
|
||||
if (empty($textifempty)) print $langs->trans("NoFileFound");
|
||||
else print $textifempty;
|
||||
if (empty($textifempty)) print '<span class="opacitymedium">'.$langs->trans("NoFileFound").'</span>';
|
||||
else print '<span class="opacitymedium">'.$textifempty.'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
@@ -569,7 +569,9 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// Add also email aliases from the c_email_senderprofile table
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1 ORDER BY position';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$sql .= ' ORDER BY position';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -508,7 +508,7 @@ class SMTPs
|
||||
// The error here just means the ID/password combo doesn't work.
|
||||
$_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235');
|
||||
break;
|
||||
case 'LOGIN':
|
||||
case 'LOGIN': // most common case
|
||||
default:
|
||||
$this->socket_send_str('AUTH LOGIN', '334');
|
||||
// User name will not return any error, server will take anything we give it.
|
||||
@@ -588,7 +588,11 @@ class SMTPs
|
||||
// From this point onward most server response codes should be 250
|
||||
// Specify who the mail is from....
|
||||
// This has to be the raw email address, strip the "name" off
|
||||
$this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
|
||||
$resultmailfrom = $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
|
||||
if (! $resultmailfrom) {
|
||||
fclose($this->socket);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 'RCPT TO:' must be given a single address, so this has to loop
|
||||
// through the list of addresses, regardless of TO, CC or BCC
|
||||
@@ -1792,6 +1796,7 @@ class SMTPs
|
||||
$_retVal = false;
|
||||
break;
|
||||
}
|
||||
$this->log .= $server_response;
|
||||
$limit++;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ class Utils
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
$result = dol_mkdir($outputdir);
|
||||
|
||||
$errormsg = '';
|
||||
|
||||
// MYSQL
|
||||
if ($type == 'mysql' || $type == 'mysqli')
|
||||
@@ -296,7 +296,6 @@ class Utils
|
||||
$paramclear .= ' -p"'.str_replace(array('"', '`'), array('\"', '\`'), $dolibarr_main_db_pass).'"';
|
||||
}
|
||||
|
||||
$errormsg = '';
|
||||
$handle = '';
|
||||
|
||||
// Start call method to execute dump
|
||||
@@ -383,6 +382,8 @@ class Utils
|
||||
{
|
||||
// Get 2048 first chars of error message.
|
||||
$errormsg = fgets($handle, 2048);
|
||||
//$ok=0;$errormsg=''; To force error
|
||||
|
||||
// Close file
|
||||
if ($compression == 'none') fclose($handle);
|
||||
if ($compression == 'gz') gzclose($handle);
|
||||
@@ -492,7 +493,7 @@ class Utils
|
||||
}
|
||||
|
||||
// Clean old files
|
||||
if ($keeplastnfiles > 0)
|
||||
if (! $errormsg && $keeplastnfiles > 0)
|
||||
{
|
||||
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
|
||||
$i = 0;
|
||||
@@ -504,7 +505,7 @@ class Utils
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ($errormsg ? -1 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')';
|
||||
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC';
|
||||
//print $sql;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
|
||||
@@ -158,7 +158,7 @@ print '
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field page_y with value "+page_y);
|
||||
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field with name=page_y with value "+page_y);
|
||||
jQuery("input[type=hidden][name=page_y]").val(page_y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1818,7 +1818,7 @@ function email_admin_prepare_head()
|
||||
$head[$h][2] = 'templates';
|
||||
$h++;
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && !empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
|
||||
$head[$h][1] = $langs->trans("EmailSenderProfiles");
|
||||
|
||||
@@ -172,7 +172,7 @@ function account_statement_prepare_head($object, $num)
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$object->id.'&num='.$num;
|
||||
$head[$h][1] = $langs->trans("AccountStatements");
|
||||
$head[$h][1] = $langs->trans("AccountStatement");
|
||||
$head[$h][2] = 'statement';
|
||||
$h++;
|
||||
|
||||
|
||||
@@ -82,16 +82,16 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters = array(
|
||||
'path' => $newpath,
|
||||
'types'=> $types,
|
||||
'recursive' => $recursive,
|
||||
'filter' => $filter,
|
||||
'excludefilter' => $excludefilter,
|
||||
'sortcriteria' => $sortcriteria,
|
||||
'sortorder' => $sortorder,
|
||||
'loaddate' => $loaddate,
|
||||
'loadsize' => $loadsize,
|
||||
'mode' => $mode
|
||||
'path' => $newpath,
|
||||
'types'=> $types,
|
||||
'recursive' => $recursive,
|
||||
'filter' => $filter,
|
||||
'excludefilter' => $excludefilter,
|
||||
'sortcriteria' => $sortcriteria,
|
||||
'sortorder' => $sortorder,
|
||||
'loaddate' => $loaddate,
|
||||
'loadsize' => $loadsize,
|
||||
'mode' => $mode
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('getDirList', $parameters, $object);
|
||||
}
|
||||
@@ -146,14 +146,14 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'dir'
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'dir'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -179,14 +179,14 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'file'
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'file'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
// Obtain a list of columns
|
||||
if (! empty($sortcriteria) && $sortorder)
|
||||
{
|
||||
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
|
||||
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,8 +445,8 @@ function dol_is_dir($folder)
|
||||
*/
|
||||
function dol_is_dir_empty($dir)
|
||||
{
|
||||
if (!is_readable($dir)) return false;
|
||||
return (count(scandir($dir)) == 2);
|
||||
if (!is_readable($dir)) return false;
|
||||
return (count(scandir($dir)) == 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -514,7 +514,7 @@ function dol_dir_is_emtpy($folder)
|
||||
else return false;
|
||||
}
|
||||
else
|
||||
return true; // Dir does not exists
|
||||
return true; // Dir does not exists
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -624,14 +624,14 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask
|
||||
|
||||
if (empty($arrayreplacementisregex))
|
||||
{
|
||||
$content = make_substitutions($content, $arrayreplacement, null);
|
||||
$content = make_substitutions($content, $arrayreplacement, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($arrayreplacement as $key => $value)
|
||||
{
|
||||
$content = preg_replace($key, $value, $content);
|
||||
}
|
||||
foreach ($arrayreplacement as $key => $value)
|
||||
{
|
||||
$content = preg_replace($key, $value, $content);
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($newpathoftmpdestfile, $content);
|
||||
@@ -1044,8 +1044,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
$checkvirusarray = dolCheckVirus($src_file);
|
||||
if (count($checkvirusarray))
|
||||
{
|
||||
dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING);
|
||||
return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray);
|
||||
dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING);
|
||||
return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
|
||||
global $hookmanager;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('other', 'errors'));
|
||||
$langs->loadLangs(array('other', 'errors'));
|
||||
|
||||
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);
|
||||
|
||||
@@ -1158,10 +1158,10 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters = array(
|
||||
'GET' => $_GET,
|
||||
'file' => $file,
|
||||
'disableglob'=> $disableglob,
|
||||
'nophperrors' => $nophperrors
|
||||
'GET' => $_GET,
|
||||
'file' => $file,
|
||||
'disableglob'=> $disableglob,
|
||||
'nophperrors' => $nophperrors
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('deleteFile', $parameters, $object);
|
||||
}
|
||||
@@ -1458,9 +1458,9 @@ function dol_meta_create($object)
|
||||
fputs($fp, $meta);
|
||||
fclose($fp);
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1830,19 +1830,19 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
|
||||
global $langs;
|
||||
if (class_exists('Imagick'))
|
||||
{
|
||||
$image = new Imagick();
|
||||
$image = new Imagick();
|
||||
try {
|
||||
$filetoconvert = $fileinput.(($page != '') ? '['.$page.']' : '');
|
||||
//var_dump($filetoconvert);
|
||||
$ret = $image->readImage($filetoconvert);
|
||||
$filetoconvert = $fileinput.(($page != '') ? '['.$page.']' : '');
|
||||
//var_dump($filetoconvert);
|
||||
$ret = $image->readImage($filetoconvert);
|
||||
} catch (Exception $e) {
|
||||
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
|
||||
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
|
||||
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
|
||||
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
if ($ret)
|
||||
{
|
||||
$ret = $image->setImageFormat($ext);
|
||||
$ret = $image->setImageFormat($ext);
|
||||
if ($ret)
|
||||
{
|
||||
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
|
||||
@@ -1850,13 +1850,13 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
|
||||
$count = $image->getNumberImages();
|
||||
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
|
||||
{
|
||||
try {
|
||||
try {
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2082,9 +2082,10 @@ function dol_uncompress($inputfile, $outputdir)
|
||||
* @param string $outputfile Target file name (output directory must exists and be writable)
|
||||
* @param string $mode 'zip'
|
||||
* @param string $excludefiles A regex pattern. For example: '/\.log$|\/temp\//'
|
||||
* @param string $rootdirinzip Add a root dir level in zip file
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '')
|
||||
function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '', $rootdirinzip = '')
|
||||
{
|
||||
$foundhandler=0;
|
||||
|
||||
@@ -2105,16 +2106,16 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
||||
elseif ($mode == 'zip')
|
||||
{
|
||||
/*if (defined('ODTPHP_PATHTOPCLZIP'))
|
||||
{
|
||||
$foundhandler=0; // TODO implement this
|
||||
{
|
||||
$foundhandler=0; // TODO implement this
|
||||
|
||||
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
|
||||
$archive = new PclZip($outputfile);
|
||||
$archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
|
||||
//$archive->add($inputfile);
|
||||
return 1;
|
||||
}
|
||||
else*/
|
||||
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
|
||||
$archive = new PclZip($outputfile);
|
||||
$archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
|
||||
//$archive->add($inputfile);
|
||||
return 1;
|
||||
}
|
||||
else*/
|
||||
//if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS))
|
||||
if (class_exists('ZipArchive'))
|
||||
{
|
||||
@@ -2145,7 +2146,8 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
||||
{
|
||||
// Get real and relative path for current file
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen($inputdir) + 1);
|
||||
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1);
|
||||
|
||||
if (empty($excludefiles) || ! preg_match($excludefiles, $filePath))
|
||||
{
|
||||
// Add current file to archive
|
||||
@@ -2530,14 +2532,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'massfilesarea_sendings')
|
||||
{
|
||||
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'massfilesarea_sendings')
|
||||
{
|
||||
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'massfilesarea_invoices')
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@@ -2961,18 +2963,21 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
exit;
|
||||
}
|
||||
|
||||
$perm = GETPOST('perm');
|
||||
$subperm = GETPOST('subperm');
|
||||
if ($perm || $subperm)
|
||||
{
|
||||
if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1;
|
||||
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
|
||||
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
|
||||
}
|
||||
/*$perm = GETPOST('perm', 'aZ09');
|
||||
$subperm = GETPOST('subperm', 'aZ09');
|
||||
if ($perm || $subperm)
|
||||
{
|
||||
if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
// Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read
|
||||
$partsofdirinoriginalfile = explode('/', $original_file);
|
||||
$partofdirinoriginalfile = $partsofdirinoriginalfile[0];
|
||||
if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1;
|
||||
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
|
||||
//}
|
||||
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// For modules who wants to manage different levels of permissions for documents
|
||||
|
||||
@@ -1140,7 +1140,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
{
|
||||
$limittitle = 30;
|
||||
$out .= '<a class="tabTitle">';
|
||||
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' ';
|
||||
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
|
||||
$out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
|
||||
$out .= '</a>';
|
||||
}
|
||||
@@ -1639,13 +1639,14 @@ function dol_bc($var, $moreclass = '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formated address (part address/zip/town/state) according to country rules
|
||||
* Return a formated address (part address/zip/town/state) according to country rules.
|
||||
* See https://en.wikipedia.org/wiki/Address
|
||||
*
|
||||
* @param Object $object A company or contact object
|
||||
* @param int $withcountry 1=Add country into address string
|
||||
* @param string $sep Separator to use to build string
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param int $mode 0=Standard output, 1=Remove address
|
||||
* @param int $withcountry 1=Add country into address string
|
||||
* @param string $sep Separator to use to build string
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param int $mode 0=Standard output, 1=Remove address
|
||||
* @return string Formated string
|
||||
* @see dol_print_address()
|
||||
*/
|
||||
@@ -1656,6 +1657,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
$ret = '';
|
||||
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
||||
|
||||
// See format of addresses on https://en.wikipedia.org/wiki/Address
|
||||
|
||||
// Address
|
||||
if (empty($mode)) {
|
||||
$ret .= $object->address;
|
||||
@@ -1692,7 +1695,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
{
|
||||
$ret .= ($ret ? $sep : '').$object->zip;
|
||||
$ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
|
||||
$ret .= ($object->state_id ? (' ('.($object->state_id).')') : '');
|
||||
$ret .= ($object->state_code ? (' '.($object->state_code)) : '');
|
||||
}
|
||||
else // Other: title firstname name \n address lines \n zip town \n country
|
||||
{
|
||||
@@ -3057,7 +3060,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
@@ -4512,7 +4515,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
|
||||
/**
|
||||
* Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user.
|
||||
* Function to use on each input amount before any numeric test or database insert
|
||||
* Function to use on each input amount before any numeric test or database insert. A better name for this function
|
||||
* should be text2num().
|
||||
*
|
||||
* @param float $amount Amount to convert/clean
|
||||
* @param string $rounding ''=No rounding
|
||||
@@ -4601,7 +4605,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a dimension with best unit
|
||||
*
|
||||
@@ -5697,14 +5700,19 @@ function dol_htmlcleanlastbr($stringtodecode)
|
||||
/**
|
||||
* Replace html_entity_decode functions to manage errors
|
||||
*
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
|
||||
* @param string $c Operand c
|
||||
* @return string String decoded
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
|
||||
* @param string $c Operand c
|
||||
* @param string $keepsomeentities Entities but &, <, >, " are not converted.
|
||||
* @return string String decoded
|
||||
*/
|
||||
function dol_html_entity_decode($a, $b, $c = 'UTF-8')
|
||||
function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0)
|
||||
{
|
||||
return html_entity_decode($a, $b, $c);
|
||||
$newstring = $a;
|
||||
if ($keepsomeentities) $newstring = strtr($newstring, array('&'=>'__andamp__', '<'=>'__andlt__', '>'=>'__andgt__', '"'=>'__dquot__'));
|
||||
$newstring = html_entity_decode($newstring, $b, $c);
|
||||
if ($keepsomeentities) $newstring = strtr($newstring, array('__andamp__'=>'&', '__andlt__'=>'<', '__andgt__'=>'>', '__dquot__'=>'"'));
|
||||
return $newstring;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6036,6 +6044,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:'');
|
||||
|
||||
$birthday = dol_print_date($object->birth, 'day');
|
||||
|
||||
@@ -8489,7 +8498,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
||||
*/
|
||||
function isAFileWithExecutableContent($filename)
|
||||
{
|
||||
if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename))
|
||||
if (preg_match('/\.(htm|html|js|php|php\d+|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2613,3 +2613,32 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow)
|
||||
$notetoshow = preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow);
|
||||
return $notetoshow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals)
|
||||
* Function used into accountancy FEC export
|
||||
*
|
||||
* @param float $amount Amount to format
|
||||
* @return string Chain with formatted upright
|
||||
* @see price2num() Format a numeric into a price for FEC files
|
||||
*/
|
||||
function price2fec($amount)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Clean parameters
|
||||
if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = ''
|
||||
$amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
|
||||
|
||||
// Output decimal number by default
|
||||
$nbdecimal = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH) ? 2 : $conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH);
|
||||
|
||||
// Output separators by default
|
||||
$dec = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR) ? ',' : $conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR);
|
||||
$thousand = (empty($conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR) ? '' : $conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR);
|
||||
|
||||
// Format number
|
||||
$output = number_format($amount, $nbdecimal, $dec, $thousand);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2019 Lenin Rivas <lenin.rivas@servcom-it.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
|
||||
@@ -2153,6 +2154,17 @@ function pdf_getLinkedObjects($object, $outputlangs)
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'fichinter')
|
||||
{
|
||||
$outputlangs->load('interventions');
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("InterDate");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec, 'day', '', $outputlangs);
|
||||
}
|
||||
}
|
||||
elseif ($objecttype == 'shipping')
|
||||
{
|
||||
$outputlangs->loadLangs(array("orders", "sendings"));
|
||||
|
||||
@@ -283,7 +283,7 @@ if (! function_exists('dol_loginfunction'))
|
||||
// Set jquery theme
|
||||
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
|
||||
|
||||
$favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png';
|
||||
$favicon = DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png';
|
||||
if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
|
||||
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
|
||||
|
||||
|
||||
@@ -1474,7 +1474,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
// Cash Control
|
||||
if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled))
|
||||
{
|
||||
$permtomakecashfence = ($user->rights->cashdesk->use || $user->rights->takepos->use);
|
||||
$permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run);
|
||||
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol');
|
||||
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
|
||||
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
|
||||
|
||||
@@ -222,7 +222,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
public $export_permission;
|
||||
public $export_fields_array;
|
||||
public $export_TypeFields_array;
|
||||
public $export_TypeFields_array; // Array of key=>type where type can be 'Numeric', 'Date', 'Text', 'Boolean', 'Status', 'List:xxx:login:rowid'
|
||||
public $export_entities_array;
|
||||
public $export_special_array; // special or computed field
|
||||
public $export_dependencies_array;
|
||||
|
||||
@@ -85,10 +85,10 @@ class modCashDesk extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 50101;
|
||||
$this->rights[$r][1] = 'Use point of sale';
|
||||
$this->rights[$r][1] = 'Use Point of sale';
|
||||
$this->rights[$r][2] = 'a';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'use';
|
||||
$this->rights[$r][4] = 'run';
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
@@ -103,7 +103,7 @@ class modCashDesk extends DolibarrModules
|
||||
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>900,
|
||||
'enabled'=>'$conf->cashdesk->enabled',
|
||||
'perms'=>'$user->rights->cashdesk->use', // Use 'perms'=>'1' if you want your menu with no permission rules
|
||||
'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
|
||||
'target'=>'pointofsale',
|
||||
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories
|
||||
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ class modCategorie extends DolibarrModules
|
||||
); // We define here only fields that use another picto
|
||||
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@@ -65,8 +65,8 @@ class modExpedition extends DolibarrModules
|
||||
"/expedition/sending/temp",
|
||||
"/expedition/receipt",
|
||||
"/expedition/receipt/temp",
|
||||
"/doctemplates/shipment",
|
||||
"/doctemplates/delivery"
|
||||
"/doctemplates/shipments",
|
||||
"/doctemplates/deliveries"
|
||||
);
|
||||
|
||||
// Config pages
|
||||
@@ -98,7 +98,7 @@ class modExpedition extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@@ -119,7 +119,7 @@ class modExpedition extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
@@ -127,7 +127,7 @@ class modExpedition extends DolibarrModules
|
||||
$this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "1";
|
||||
$this->const[$r][3] = "Enable shipments";
|
||||
$this->const[$r][3] = "Enable delivery receipts";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
@@ -326,8 +326,8 @@ class modExpedition extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
//ODT template
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipment';
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipments';
|
||||
$dest = $dirodt.'/template_shipment.odt';
|
||||
|
||||
if (file_exists($src) && !file_exists($dest))
|
||||
|
||||
@@ -320,7 +320,7 @@ class modFournisseur extends DolibarrModules
|
||||
);
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -357,7 +357,7 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// End add extra fields
|
||||
// Add extra fields line
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -440,7 +440,7 @@ class modFournisseur extends DolibarrModules
|
||||
'p.datep'=>'payment','p.num_paiement'=>'payment','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -527,7 +527,7 @@ class modFournisseur extends DolibarrModules
|
||||
);
|
||||
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -565,7 +565,7 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// End add extra fields object
|
||||
// Add extra fields line
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet'";
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -633,7 +633,7 @@ class modFournisseur extends DolibarrModules
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$this->remove($options);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class modMrp extends DolibarrModules
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 660; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
|
||||
$this->numero = 660;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'mrp';
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
@@ -240,17 +240,17 @@ class modMrp extends DolibarrModules
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read objects of Mrp'; // Permission label
|
||||
$this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update objects of Mrp'; // Permission label
|
||||
$this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete objects of Mrp'; // Permission label
|
||||
$this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
|
||||
@@ -449,7 +449,7 @@ class modSociete extends DolibarrModules
|
||||
's.multicurrency_code' => 'MulticurrencyCurrency'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity = ".$conf->entity;
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@@ -597,7 +597,7 @@ class modSociete extends DolibarrModules
|
||||
's.note_public' => "NotePublic"
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity = ".$conf->entity;
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on an old database (during a migration for example)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ class modSupplierProposal extends DolibarrModules
|
||||
|
||||
$this->const[$r][0] = "SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposal";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposals";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
|
||||
@@ -215,8 +215,8 @@ class modSupplierProposal extends DolibarrModules
|
||||
$this->remove($options);
|
||||
|
||||
//ODT template
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposal/template_supplier_proposal.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposal';
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposals/template_supplier_proposal.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposals';
|
||||
$dest=$dirodt.'/template_supplier_proposal.odt';
|
||||
|
||||
if (file_exists($src) && ! file_exists($dest))
|
||||
|
||||
@@ -199,10 +199,10 @@ class modTakePos extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 50151;
|
||||
$this->rights[$r][1] = 'Use point of sale';
|
||||
$this->rights[$r][1] = 'Use Point Of Sale';
|
||||
$this->rights[$r][2] = 'a';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'use';
|
||||
$this->rights[$r][4] = 'run';
|
||||
|
||||
|
||||
// Main menu entries
|
||||
@@ -221,7 +221,7 @@ class modTakePos extends DolibarrModules
|
||||
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
|
||||
'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'takepos',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ class modUser extends DolibarrModules
|
||||
'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
|
||||
'u.rowid'=>'Numeric', 'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
|
||||
'u.accountancy_code'=>'Text',
|
||||
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'Text',
|
||||
|
||||
@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
|
||||
|
||||
@@ -620,7 +620,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
/* When changing predefined product, we reload list of supplier prices required for margin combo */
|
||||
$("#idprod, #idprodfournprice").change(function()
|
||||
{
|
||||
console.log("#idprod, #idprodfournprice change triggered this.val = "+$(this).val());
|
||||
console.log("Call method change() after change on #idprod or #idprodfournprice. this.val = "+$(this).val());
|
||||
|
||||
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
|
||||
|
||||
@@ -631,6 +631,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
{
|
||||
?>
|
||||
// Get the HT price for the product and display it
|
||||
console.log("Load price without tax and set it into #price_ht");
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
|
||||
{ 'id': $(this).val(), 'socid' : <?php print $object->socid; ?> },
|
||||
function(data) { jQuery("#price_ht").val(data.price_ht); },
|
||||
@@ -669,46 +670,47 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
|
||||
var i = 0;
|
||||
$(data).each(function() {
|
||||
if (this.id != 'pmpprice' && this.id != 'costprice')
|
||||
{
|
||||
i++;
|
||||
this.price = parseFloat(this.price); // to fix when this.price >0
|
||||
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
||||
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
||||
}
|
||||
if (this.id == 'pmpprice')
|
||||
{
|
||||
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price);
|
||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) {
|
||||
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||
//console.log("pmppricevalue="+pmppricevalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.id == 'costprice')
|
||||
{
|
||||
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
||||
if ('costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
||||
else if (pmppricevalue > 0) { defaultkey = pmppriceid; defaultprice = pmppricevalue; }
|
||||
}
|
||||
}
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
/* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
|
||||
if (this.id != 'pmpprice' && this.id != 'costprice')
|
||||
{
|
||||
i++;
|
||||
this.price = parseFloat(this.price); // to fix when this.price >0
|
||||
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
||||
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
||||
}
|
||||
if (this.id == 'pmpprice')
|
||||
{
|
||||
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price);
|
||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) {
|
||||
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||
//console.log("pmppricevalue="+pmppricevalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.id == 'costprice')
|
||||
{
|
||||
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
||||
if ('costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
||||
else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
|
||||
}
|
||||
}
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
|
||||
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
|
||||
|
||||
$("#fournprice_predef").html(options).show();
|
||||
if (defaultkey != '')
|
||||
{
|
||||
$("#fournprice_predef").val(defaultkey);
|
||||
$("#fournprice_predef").val(defaultkey);
|
||||
}
|
||||
|
||||
/* At loading, no product are yet selected, so we hide field of buying_price */
|
||||
|
||||
@@ -105,7 +105,7 @@ $coldisplay++;
|
||||
// Do not allow editing during a situation cycle
|
||||
if ($line->fk_prev_id == null)
|
||||
{
|
||||
// editeur wysiwyg
|
||||
// editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$nbrows = ROWS_2;
|
||||
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
|
||||
@@ -66,11 +66,11 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
|
||||
$coldisplay = 0; ?>
|
||||
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
|
||||
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> >
|
||||
<tr id="row-<?php print $line->id?>" class="drag drop oddeven" <?php print $domData; ?> >
|
||||
<?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i + 1); ?></td>
|
||||
<td class="linecolnum center"><?php $coldisplay++; ?><?php print ($i + 1); ?></td>
|
||||
<?php } ?>
|
||||
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
|
||||
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
|
||||
<?php
|
||||
if (($line->info_bits & 2) == 2) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
|
||||
@@ -88,32 +88,32 @@ if (($line->info_bits & 2) == 2) {
|
||||
{
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
|
||||
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0)
|
||||
{
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
|
||||
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
|
||||
echo ' ('.dol_print_date($discount->datec).')';
|
||||
print ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
|
||||
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
|
||||
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description);
|
||||
print ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ else
|
||||
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -132,24 +132,30 @@ else
|
||||
|
||||
if (!empty($line->label)) {
|
||||
$text .= ' <strong>'.$line->label.'</strong>';
|
||||
echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
} else {
|
||||
if (!empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
if (!empty($line->fk_parent_line)) print img_picto('', 'rightarrow');
|
||||
if (preg_match('/^\(DEPOSIT\)/', $line->description)) {
|
||||
$newdesc = preg_replace('/^\(DEPOSIT\)/', $langs->trans("Deposit"), $line->description);
|
||||
print $text.' '.dol_htmlentitiesbr($newdesc);
|
||||
}
|
||||
else {
|
||||
print $text.' '.dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show date range
|
||||
if ($line->element == 'facturedetrec') {
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">';
|
||||
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
|
||||
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
|
||||
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
|
||||
if ($line->date_start_fill || $line->date_end_fill) print '<br><div class="clearboth nowraponall">';
|
||||
if ($line->date_start_fill) print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
|
||||
if ($line->date_start_fill && $line->date_end_fill) print ' - ';
|
||||
if ($line->date_end_fill) print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
|
||||
if ($line->date_start_fill || $line->date_end_fill) print '</div>';
|
||||
}
|
||||
else {
|
||||
if ($line->date_start || $line->date_end) echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
//echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
if ($line->date_start || $line->date_end) print '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
//print get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
// Add description in form
|
||||
@@ -164,15 +170,16 @@ if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0)
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productfourn = new ProductFournisseur($this->db);
|
||||
$productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
|
||||
echo '<div class="clearboth"></div><span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
|
||||
// Supplier ref
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here
|
||||
{
|
||||
echo $productfourn->getNomUrl();
|
||||
print $productfourn->getNomUrl();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $productfourn->ref_supplier;
|
||||
print $productfourn->ref_supplier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,14 +187,14 @@ if (!empty($conf->accounting->enabled) && $line->fk_accounting_account > 0)
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($this->db);
|
||||
$accountingaccount->fetch($line->fk_accounting_account);
|
||||
echo '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
|
||||
print '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
print '<td class="linecolrefsupplier">';
|
||||
echo ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
|
||||
print ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
|
||||
print '</td>';
|
||||
}
|
||||
// VAT Rate
|
||||
@@ -198,18 +205,18 @@ if (price2num($line->tva_tx)) $positiverates .= ($positiverates ? '/' :
|
||||
if (price2num($line->total_localtax1)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx);
|
||||
if (price2num($line->total_localtax2)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx);
|
||||
if (empty($positiverates)) $positiverates = '0';
|
||||
echo vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), '%', $line->info_bits);
|
||||
//echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
|
||||
print vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), '%', $line->info_bits);
|
||||
//print vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
|
||||
?></td>
|
||||
|
||||
<td class="linecoluht nowrap right"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
|
||||
<td class="linecoluht nowrap right"><?php $coldisplay++; ?><?php print price($line->subprice); ?></td>
|
||||
|
||||
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
|
||||
<td class="linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td>
|
||||
<td class="linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php print price($line->multicurrency_subprice); ?></td>
|
||||
<?php }
|
||||
|
||||
if ($inputalsopricewithtax) { ?>
|
||||
<td class="linecoluttc nowrap right"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc) ?price($line->pu_ttc) : price($line->subprice)); ?></td>
|
||||
<td class="linecoluttc nowrap right"><?php $coldisplay++; ?><?php print (isset($line->pu_ttc) ?price($line->pu_ttc) : price($line->subprice)); ?></td>
|
||||
<?php } ?>
|
||||
|
||||
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
|
||||
@@ -219,8 +226,8 @@ if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
|
||||
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
|
||||
// must also not be output for most entities (proposal, intervention, ...)
|
||||
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
|
||||
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
} else echo ' ';
|
||||
print price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
} else print ' ';
|
||||
print '</td>';
|
||||
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
@@ -236,7 +243,7 @@ if (!empty($line->remise_percent) && $line->special_code != 3) {
|
||||
print '<td class="linecoldiscount right">';
|
||||
$coldisplay++;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
echo dol_print_reduction($line->remise_percent, $langs);
|
||||
print dol_print_reduction($line->remise_percent, $langs);
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="linecoldiscount"> </td>';
|
||||
@@ -258,17 +265,17 @@ if ($this->situation_cycle_ref)
|
||||
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid))
|
||||
{
|
||||
if (!empty($user->rights->margins->creer)) { ?>
|
||||
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
|
||||
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print price($line->pa_ht); ?></td>
|
||||
<?php }
|
||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
|
||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
|
||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print (($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
|
||||
<?php }
|
||||
if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
|
||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
|
||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
|
||||
<?php }
|
||||
}
|
||||
if ($line->special_code == 3) { ?>
|
||||
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
|
||||
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php print $langs->trans('Option'); ?></td>
|
||||
<?php } else {
|
||||
print '<td class="linecolht nowrap right">';
|
||||
$coldisplay++;
|
||||
@@ -303,8 +310,8 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
|
||||
$coldisplay++;
|
||||
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
|
||||
} else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
|
||||
<?php echo img_edit().'</a>';
|
||||
<a href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
|
||||
<?php print img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@@ -321,13 +328,13 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
|
||||
print '<td class="linecolmove tdlineupdown center">';
|
||||
$coldisplay++;
|
||||
if ($i > 0) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php echo img_up('default', 0, 'imgupforline'); ?>
|
||||
<a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php print img_up('default', 0, 'imgupforline'); ?>
|
||||
</a>
|
||||
<?php }
|
||||
if ($i < $num - 1) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php echo img_down('default', 0, 'imgdownforline'); ?>
|
||||
<a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php print img_down('default', 0, 'imgdownforline'); ?>
|
||||
</a>
|
||||
<?php }
|
||||
print '</td>';
|
||||
@@ -341,7 +348,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
|
||||
}
|
||||
|
||||
if ($action == 'selectlines') { ?>
|
||||
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td>
|
||||
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php print $i + 1; ?>]" value="<?php print $line->id; ?>" ></td>
|
||||
<?php }
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -1287,12 +1287,12 @@ class Cronjob extends CommonObject
|
||||
/**
|
||||
* Return label of status of user (active, inactive)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->status, $mode, $this->processing);
|
||||
return $this->LibStatut($this->status, $mode, $this->processing, $this->lastresult);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@@ -1300,13 +1300,17 @@ class Cronjob extends CommonObject
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $status Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @param int $processing 0=Not running, 1=Running
|
||||
* @param int $lastresult Value of last result (0=no error, error otherwise)
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0, $processing = 0)
|
||||
public function LibStatut($status, $mode = 0, $processing = 0, $lastresult = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->labelStatus = array(); // Force reset o array because label depends on other fields
|
||||
$this->labelStatusShort = array();
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
@@ -1314,6 +1318,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
$moretext = '';
|
||||
if ($processing) $moretext = ' ('.$langs->trans("Running").')';
|
||||
elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
|
||||
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Draft').$moretext;
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext;
|
||||
@@ -1324,6 +1329,7 @@ class Cronjob extends CommonObject
|
||||
$statusType = 'status4';
|
||||
if ($status == 1 && $processing) $statusType = 'status1';
|
||||
if ($status == 0) $statusType = 'status5';
|
||||
if ($this->lastresult) $statusType = 'status8';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
@@ -425,6 +425,7 @@ if ($num > 0)
|
||||
$object->status = $obj->status;
|
||||
$object->priority = $obj->priority;
|
||||
$object->processing = $obj->processing;
|
||||
$object->lastresult = $obj->lastresult;
|
||||
|
||||
$datelastrun = $db->jdate($obj->datelastrun);
|
||||
$datelastresult = $db->jdate($obj->datelastresult);
|
||||
@@ -541,7 +542,7 @@ if ($num > 0)
|
||||
|
||||
// Status
|
||||
print '<td class="center">';
|
||||
print $object->getLibStatut(3);
|
||||
print $object->getLibStatut(5);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowraponall right">';
|
||||
|
||||
@@ -1243,34 +1243,34 @@ class EmailCollector extends CommonObject
|
||||
|
||||
$objectid = 0;
|
||||
$objectemail = null;
|
||||
if ($reg[0] == 'inv')
|
||||
if ($reg[1] == 'inv')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new Facture($this->db);
|
||||
}
|
||||
if ($reg[0] == 'proj')
|
||||
if ($reg[1] == 'proj')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new Project($this->db);
|
||||
}
|
||||
if ($reg[0] == 'con')
|
||||
if ($reg[1] == 'con')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new Contact($this->db);
|
||||
}
|
||||
if ($reg[0] == 'thi')
|
||||
if ($reg[1] == 'thi')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new Societe($this->db);
|
||||
}
|
||||
if ($reg[0] == 'use')
|
||||
if ($reg[1] == 'use')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new User($this->db);
|
||||
}
|
||||
if ($reg[0] == 'tic')
|
||||
if ($reg[1] == 'tic')
|
||||
{
|
||||
$objectid = $reg[1];
|
||||
$objectid = $reg[2];
|
||||
$objectemail = new Ticket($this->db);
|
||||
}
|
||||
|
||||
|
||||
@@ -389,6 +389,7 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$message = $langs->transnoentities("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut, $object->date_fin, '', $langs), $link);
|
||||
|
||||
// Rebuild pdf
|
||||
@@ -508,6 +509,7 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$dateRefusEx = explode(" ", $object->date_refuse);
|
||||
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $link);
|
||||
|
||||
@@ -633,6 +635,7 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$message = $langs->transnoentities("ExpenseReportApprovedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||
|
||||
// Rebuilt pdf
|
||||
@@ -703,7 +706,8 @@ if (empty($reshook))
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
$result = $object->setDeny($user, GETPOST('detail_refuse', 'alpha'));
|
||||
$detailRefuse = GETPOST('detail_refuse', 'alpha');
|
||||
$result = $object->setDeny($user, $detailRefuse);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -751,7 +755,8 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_refuse'], $link);
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $detailRefuse, $link);
|
||||
|
||||
// Rebuilt pdf
|
||||
/*
|
||||
@@ -831,7 +836,8 @@ if (empty($reshook))
|
||||
|
||||
if ($user->id == $object->fk_user_valid || $user->id == $object->fk_user_author)
|
||||
{
|
||||
$result = $object->set_cancel($user, GETPOST('detail_cancel', 'alpha'));
|
||||
$detailCancel = GETPOST('detail_cancel', 'alpha');
|
||||
$result = $object->set_cancel($user, $detailCancel);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -879,7 +885,8 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), GETPOST('detail_cancel', 'alpha'), $link);
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $detailCancel, $link);
|
||||
|
||||
// Rebuilt pdf
|
||||
/*
|
||||
@@ -1104,6 +1111,7 @@ if (empty($reshook))
|
||||
|
||||
// CONTENT
|
||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||
$link = '<a href="' . $link . '">' . $link . '</a>';
|
||||
$message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||
|
||||
// Generate pdf before attachment
|
||||
@@ -1735,7 +1743,7 @@ else
|
||||
if ($action == 'cancel')
|
||||
{
|
||||
$array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text", 'label'=>'<strong>'.$langs->trans("Comment").'</strong>', 'name'=>"detail_cancel", 'value'=>""));
|
||||
$formconfirm = $form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1);
|
||||
}
|
||||
|
||||
if ($action == 'setdraft')
|
||||
|
||||
@@ -42,6 +42,9 @@ class ExpenseReportStats extends Stats
|
||||
public $field;
|
||||
public $where;
|
||||
|
||||
private $datetouse = 'date_valid';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -91,7 +94,7 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
public function getNbByYear()
|
||||
{
|
||||
$sql = "SELECT YEAR(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
|
||||
$sql = "SELECT YEAR(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
@@ -109,9 +112,9 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
$sql = "SELECT MONTH(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
|
||||
$sql = "SELECT MONTH(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE YEAR(e.date_valid) = ".$year;
|
||||
$sql.= " WHERE YEAR(e.".$this->datetouse.") = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
@@ -131,9 +134,9 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
public function getAmountByMonth($year, $format = 0)
|
||||
{
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, sum(".$this->field.")";
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, sum(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') = '".$year."'";
|
||||
$sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
@@ -151,9 +154,9 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
public function getAverageByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, avg(".$this->field.")";
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, avg(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') = '".$year."'";
|
||||
$sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
@@ -168,7 +171,7 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
public function getAllByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
|
||||
@@ -232,7 +232,9 @@ $liststatus = $tmpexpensereport->statuts;
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("Year"), $langs->trans("DateValidation"));
|
||||
print '</td><td>';
|
||||
if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
|
||||
@@ -52,10 +52,10 @@ class Export
|
||||
public $array_export_help=array(); // array with tooltip help for fields
|
||||
|
||||
// To store export modules
|
||||
public $hexa;
|
||||
public $hexafiltervalue;
|
||||
public $hexa; // List of fields in the export profile
|
||||
public $hexafiltervalue; // List of search criteria in the export profile
|
||||
public $datatoexport;
|
||||
public $model_name;
|
||||
public $model_name; // Name of export profile
|
||||
|
||||
public $sqlusedforexport;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user