commit
0f4420407d
@ -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.
|
||||
|
||||
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,43 @@ 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);
|
||||
@ -237,7 +272,7 @@ if ($resql)
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
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);
|
||||
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
@ -322,8 +357,12 @@ if ($resql)
|
||||
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>';
|
||||
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>';
|
||||
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 +385,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
|
||||
@ -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>';
|
||||
|
||||
@ -235,7 +235,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc/");
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -257,7 +257,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info'))
|
||||
print $module->info($langs);
|
||||
|
||||
@ -178,6 +178,7 @@ $message .= $langs->trans("AgendaUrlOptionsNotAdmin", $user->login, $user->login
|
||||
$message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'<br>';
|
||||
$message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'<br>';
|
||||
$message .= $langs->trans("AgendaUrlOptionsNotAutoEvent", 'systemauto', 'systemauto').'<br>';
|
||||
$message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'<br>';
|
||||
|
||||
print info_admin($message);
|
||||
|
||||
|
||||
@ -350,7 +350,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
||||
$realpath = $reldir."core/modules/bom".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -382,7 +383,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
@ -425,7 +425,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
@ -403,7 +403,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
|
||||
$realpath = $reldir."core/modules/commande".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -472,19 +473,21 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -339,7 +339,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/contract".$valdir);
|
||||
$realpath = $reldir."core/modules/contract".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -407,18 +408,20 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -486,7 +486,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/facture".$valdir);
|
||||
$realpath = $reldir."core/modules/facture".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -555,19 +556,21 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -409,7 +409,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
|
||||
$realpath = $reldir."core/modules/fichinter/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -480,6 +481,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -355,7 +355,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
||||
$realpath = $reldir."core/modules/holiday".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -429,7 +430,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -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']++;
|
||||
|
||||
@ -351,7 +351,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
|
||||
$realpath = $reldir."core/modules/mrp".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -383,7 +384,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
@ -421,14 +421,16 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||
$dir = dol_buildpath($reldir."core/modules/propale");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -399,7 +399,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/propale".$valdir);
|
||||
$realpath = $reldir."core/modules/propale".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -474,7 +475,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -221,7 +221,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception/");
|
||||
$dir = dol_buildpath($reldir."core/modules/reception");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -353,7 +353,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception".$valdir);
|
||||
$realpath = $reldir."core/modules/reception".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -427,7 +428,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -461,6 +461,7 @@ print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
@ -471,7 +472,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Example with a yes / no select
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -481,10 +482,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -494,7 +495,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
@ -507,8 +508,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
*/
|
||||
|
||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||
|
||||
@ -90,7 +90,7 @@ if ($action == 'specimen') // For invoices
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -230,7 +230,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -360,7 +360,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
|
||||
$realpath = $reldir."core/modules/supplier_invoice/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -385,7 +386,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -434,6 +435,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -86,7 +86,7 @@ elseif ($action == 'specimen') // For orders
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -388,7 +388,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
|
||||
$realpath = $reldir."core/modules/supplier_order/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -411,7 +412,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -456,6 +457,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -332,7 +332,8 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
|
||||
$realpath = $reldir."core/modules/supplier_payment/doc";
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -356,7 +357,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -405,6 +406,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td class="center">';
|
||||
|
||||
@ -239,7 +239,7 @@ print '</tr>'."\n";
|
||||
clearstatcache();
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -366,7 +366,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal".$valdir);
|
||||
$realpath = $reldir."core/modules/supplier_proposal".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -440,7 +441,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -209,7 +209,7 @@ print "</tr>\n";
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket/");
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket");
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
|
||||
$file = $reg[1];
|
||||
$classname = substr($file, 4);
|
||||
|
||||
include_once $dir.$file.'.php';
|
||||
include_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
||||
@ -29,18 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="date";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "date";
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
@ -52,33 +52,33 @@ if ($action == 'delete')
|
||||
{
|
||||
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$label=$db::LABEL;
|
||||
$type=$db->type;
|
||||
$label = $db::LABEL;
|
||||
$type = $db->type;
|
||||
//var_dump($db);
|
||||
|
||||
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
$help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
llxHeader('', '', $help_url);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
@ -141,9 +141,9 @@ print '<br>';
|
||||
|
||||
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard"));
|
||||
|
||||
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').' nohover">';
|
||||
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
@ -186,11 +186,11 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump=$db->getPathOfDump();
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
@ -203,7 +203,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
@ -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>';
|
||||
@ -293,7 +293,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
|
||||
print '</div>';
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((!isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"])) || GETPOST('nobin_drop')) ? ' checked' : ''.' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
@ -338,11 +338,11 @@ if (in_array($type, array('pgsql'))) {
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump=$db->getPathOfDump();
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
@ -391,33 +391,28 @@ print '<legend>'.$langs->trans("Destination").'</legend> -->';
|
||||
print '<br>';
|
||||
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||
print '<br>';
|
||||
$prefix='dump';
|
||||
$ext='.sql';
|
||||
$prefix = 'dump';
|
||||
$ext = '.sql';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$prefix='mysqldump';
|
||||
$ext='sql';
|
||||
$prefix = 'mysqldump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
//if ($label == 'PostgreSQL') {
|
||||
// $prefix='pg_dump';
|
||||
// $ext='dump';
|
||||
//}
|
||||
if (in_array($type, array('pgsql'))) {
|
||||
$prefix='pg_dump';
|
||||
$ext='sql';
|
||||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$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").'.'.$ext;
|
||||
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Define compressions array
|
||||
$compression=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>';
|
||||
@ -484,7 +488,7 @@ print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">'
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||
{
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
@ -496,11 +500,11 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
if (! empty($_SESSION["commandbackuptorun"]))
|
||||
if (!empty($_SESSION["commandbackuptorun"]))
|
||||
{
|
||||
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
|
||||
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
|
||||
@ -509,9 +513,9 @@ if (! empty($_SESSION["commandbackuptorun"]))
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
|
||||
print "</div> <!-- end div center button -->\n";
|
||||
@ -525,8 +529,8 @@ print "</div> <!-- end div fichehalfleft -->\n";
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
@ -542,6 +546,7 @@ 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>';
|
||||
|
||||
@ -555,34 +560,39 @@ 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>';
|
||||
@ -600,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.
|
||||
|
||||
@ -1378,13 +1378,13 @@ class ActionComm extends CommonObject
|
||||
* Return URL of event
|
||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
||||
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
|
||||
* @param string $classname Force style class on a link
|
||||
* @param string $option ''=Link to action, 'birthday'=Link to contact
|
||||
* @param int $overwritepicto 1=Overwrite picto
|
||||
* @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 string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
|
||||
* @param int $overwritepicto 1 = Overwrite picto
|
||||
* @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
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||
@ -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';
|
||||
}
|
||||
@ -1451,6 +1455,8 @@ class ActionComm extends CommonObject
|
||||
$url = '';
|
||||
if ($option == 'birthday')
|
||||
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
|
||||
elseif ($option == 'holiday')
|
||||
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
|
||||
else
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
|
||||
if ($option !== 'nolink')
|
||||
@ -1557,18 +1563,19 @@ class ActionComm extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Export events from database into a cal file.
|
||||
* Export events from database into a cal file.
|
||||
*
|
||||
* @param string $format 'vcal', 'ical/ics', 'rss'
|
||||
* @param string $type 'event' or 'journal'
|
||||
* @param int $cachedelay Do not rebuild file if date older than cachedelay seconds
|
||||
* @param string $filename Force filename
|
||||
* @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
||||
* @return int <0 if error, nb of events in new file if ok
|
||||
* @param string $format The format of the export 'vcal', 'ical/ics' or 'rss'
|
||||
* @param string $type The type of the export 'event' or 'journal'
|
||||
* @param integer $cachedelay Do not rebuild file if date older than cachedelay seconds
|
||||
* @param string $filename The name for the exported file.
|
||||
* @param array $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
||||
* @param integer $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
|
||||
* @return integer -1 = error on build export file, 0 = export okay
|
||||
*/
|
||||
public function build_exportfile($format, $type, $cachedelay, $filename, $filters)
|
||||
public function build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholiday = 0)
|
||||
{
|
||||
global $hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $dolibarr_main_url_root, $mysoc;
|
||||
@ -1783,6 +1790,91 @@ class ActionComm extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($exportholiday == 1)
|
||||
{
|
||||
$langs->load("holidays");
|
||||
$title = $langs->trans("Holidays");
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.email, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = x.fk_user";
|
||||
$sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$event = array();
|
||||
|
||||
if($obj->halfday == -1)
|
||||
{
|
||||
$event['fulldayevent'] = false;
|
||||
|
||||
$timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0);
|
||||
$timestampEnd = dol_stringtotime($obj->date_end." 12:00:00", 0);
|
||||
}
|
||||
elseif($obj->halfday == 1)
|
||||
{
|
||||
$event['fulldayevent'] = false;
|
||||
|
||||
$timestampStart = dol_stringtotime($obj->date_start." 12:00:00", 0);
|
||||
$timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$event['fulldayevent'] = true;
|
||||
|
||||
$timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0);
|
||||
$timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0);
|
||||
}
|
||||
|
||||
if(!empty($conf->global->AGENDA_EXPORT_FIX_TZ))
|
||||
{
|
||||
$timestampStart =- ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampEnd =- ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
}
|
||||
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
|
||||
$url = $urlwithroot.'/holiday/card.php?id='.$obj->rowid;
|
||||
|
||||
$event['uid'] = 'dolibarrholiday-'.$this->db->database_name.'-'.$obj->rowid."@".$_SERVER["SERVER_NAME"];
|
||||
$event['author'] = dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$event['type'] = 'event';
|
||||
$event['category'] = "Holiday";
|
||||
$event['transparency'] = 'OPAQUE';
|
||||
$event['email'] = $obj->email;
|
||||
$event['created'] = $timestampStart;
|
||||
$event['modified'] = $timestampStart;
|
||||
$event['startdate'] = $timestampStart;
|
||||
$event['enddate'] = $timestampEnd;
|
||||
$event['duration'] = $timestampEnd - $timestampStart;
|
||||
$event['url'] = $url;
|
||||
|
||||
if($obj->status == 2)
|
||||
{
|
||||
// 2 = leave wait for approval
|
||||
$event['summary'] = $title." - ".$obj->lastname." (wait for approval)";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 = leave approved
|
||||
$event['summary'] = $title." - ".$obj->lastname;
|
||||
}
|
||||
|
||||
$eventarray[] = $event;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$langs->load("agenda");
|
||||
|
||||
// Define title and desc
|
||||
|
||||
@ -757,6 +757,95 @@ if ($showbirthday)
|
||||
}
|
||||
}
|
||||
|
||||
if($conf->global->AGENDA_SHOW_HOLIDAYS)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = x.fk_user";
|
||||
$sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
if($action == 'show_day')
|
||||
{
|
||||
// Request only leaves for the current selected day
|
||||
$sql.= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin";
|
||||
}
|
||||
elseif($action == 'show_week')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
elseif($action == 'show_month')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$dateStartArray = dol_getdate(dol_stringtotime($obj->date_start, 1), true);
|
||||
$dateEndArray = dol_getdate(dol_stringtotime($obj->date_end, 1), true);
|
||||
|
||||
$event = new ActionComm($db);
|
||||
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true);
|
||||
$event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true);
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
if($obj->status == 3)
|
||||
{
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
}
|
||||
elseif($obj->status == 2)
|
||||
{
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
}
|
||||
|
||||
if($obj->halfday == 1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
}
|
||||
elseif($obj->halfday == -1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$annee = date('Y', $event->date_start_in_calendar);
|
||||
$mois = date('m', $event->date_start_in_calendar);
|
||||
$jour = date('d', $event->date_start_in_calendar);
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||
|
||||
do
|
||||
{
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60*60*24;
|
||||
}
|
||||
|
||||
while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete $eventarray with external import Ical
|
||||
if (count($listofextcals))
|
||||
{
|
||||
@ -1512,7 +1601,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
{
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
|
||||
}
|
||||
if ($event->type_code != 'BIRTHDAY')
|
||||
elseif ($event->type_code == 'HOLIDAY')
|
||||
{
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user');
|
||||
}
|
||||
elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY')
|
||||
{
|
||||
// Picto
|
||||
if (empty($event->fulldayevent))
|
||||
@ -1568,13 +1661,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 +1687,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).')';
|
||||
@ -1740,6 +1834,17 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
||||
*/
|
||||
function sort_events_by_date($a, $b)
|
||||
{
|
||||
// Sort holidays at first
|
||||
if($a->type_code === 'HOLIDAY')
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($b->type_code === 'HOLIDAY')
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// datep => Event start time
|
||||
// datef => Event end time
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -217,12 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_type = '';
|
||||
$search_country = '';
|
||||
$search_type_thirdparty = '';
|
||||
$search_date_start='';
|
||||
$search_date_end='';
|
||||
$search_dateend_start='';
|
||||
$search_dateend_end='';
|
||||
$search_datedelivery_start='';
|
||||
$search_datedelivery_end='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_dateend_start = '';
|
||||
$search_dateend_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_availability = '';
|
||||
$viewstatut = '';
|
||||
$object_statut = '';
|
||||
@ -338,13 +338,13 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
||||
{
|
||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||
}
|
||||
if ($search_date_start) $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'";
|
||||
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'";
|
||||
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
|
||||
if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
|
||||
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
|
||||
@ -599,12 +599,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -613,12 +613,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -627,12 +627,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -3072,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))
|
||||
{
|
||||
@ -3083,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;
|
||||
@ -3143,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);
|
||||
@ -3715,7 +3722,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::initAsSpecimen");
|
||||
|
||||
@ -3749,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;
|
||||
|
||||
@ -75,6 +75,7 @@ $search_user = GETPOST('search_user', 'int');
|
||||
$search_sale = GETPOST('search_sale', 'int');
|
||||
$search_total_ht = GETPOST('search_total_ht', 'alpha');
|
||||
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
||||
$search_login=GETPOST('search_login', 'alpha');
|
||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$billed = GETPOST('billed', 'int');
|
||||
@ -140,6 +141,7 @@ $arrayfields = array(
|
||||
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
@ -195,10 +197,11 @@ if (empty($reshook))
|
||||
$search_total_ht = '';
|
||||
$search_total_vat = '';
|
||||
$search_total_ttc = '';
|
||||
$search_dateorder_start ='';
|
||||
$search_dateorder_end ='';
|
||||
$search_datedelivery_start ='';
|
||||
$search_datedelivery_end ='';
|
||||
$search_login='';
|
||||
$search_dateorder_start = '';
|
||||
$search_dateorder_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_project_ref = '';
|
||||
$search_project = '';
|
||||
$viewstatut = '';
|
||||
@ -246,10 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||
$sql.= " u.login";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
||||
@ -268,6 +272,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
@ -308,10 +314,10 @@ if ($viewstatut <> '')
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
@ -322,6 +328,7 @@ if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$s
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
@ -417,6 +424,7 @@ if ($resql)
|
||||
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_login) $param.='&search_login='.urlencode($search_login);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
|
||||
@ -646,12 +654,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -659,12 +667,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -689,6 +697,13 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
@ -760,6 +775,8 @@ if ($resql)
|
||||
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -781,7 +798,7 @@ if ($resql)
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
|
||||
$userstatic = new User($db);
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
@ -826,7 +843,7 @@ if ($resql)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
@ -1080,6 +1097,19 @@ if ($resql)
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
|
||||
// Author
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -31,16 +31,16 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","banks","bills","accountancy"));
|
||||
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_user = GETPOST('search_user', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
@ -61,38 +61,38 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="v.datep,v.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield = "v.datep,v.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
$filtre=GETPOST("filtre", 'alpha');
|
||||
$filtre = GETPOST("filtre", 'alpha');
|
||||
|
||||
if (! GETPOST('typeid'))
|
||||
if (!GETPOST('typeid'))
|
||||
{
|
||||
$newfiltre=str_replace('filtre=', '', $filtre);
|
||||
$filterarray=explode('-', $newfiltre);
|
||||
foreach($filterarray as $val)
|
||||
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||
$filterarray = explode('-', $newfiltre);
|
||||
foreach ($filterarray as $val)
|
||||
{
|
||||
$part=explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
|
||||
$part = explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeid=GETPOST('typeid');
|
||||
$typeid = GETPOST('typeid');
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
$search_date_start='';
|
||||
$search_date_end='';
|
||||
$search_amount_deb="";
|
||||
$search_amount_cred="";
|
||||
$search_account='';
|
||||
$search_ref = "";
|
||||
$search_label = "";
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_amount_deb = "";
|
||||
$search_amount_cred = "";
|
||||
$search_account = '';
|
||||
$search_accountancy_account = '';
|
||||
$search_accountancy_subledger = '';
|
||||
$typeid="";
|
||||
$typeid = "";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -107,62 +107,62 @@ $variousstatic = new PaymentVarious($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql .= " pst.code as payment_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql.= natural_search(array('v.label'), $search_label);
|
||||
if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||
if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid;
|
||||
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":", "=", $filtre);
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
$total = 0;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end);
|
||||
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
|
||||
if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
||||
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->banque->modifier)
|
||||
@ -198,12 +198,12 @@ if ($result)
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@ -227,14 +227,14 @@ if ($result)
|
||||
// Accounting account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200');
|
||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Subledger account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -246,7 +246,7 @@ if ($result)
|
||||
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -258,9 +258,9 @@ if ($result)
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
@ -279,19 +279,19 @@ if ($result)
|
||||
|
||||
// Ref
|
||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Account
|
||||
if (!empty($conf->banque->enabled))
|
||||
@ -316,7 +316,7 @@ if ($result)
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
@ -325,14 +325,14 @@ if ($result)
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting subledger account
|
||||
if (! empty($conf->accounting->enabled))
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td>' . length_accounta($obj->subledger_account) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Debit
|
||||
@ -342,8 +342,8 @@ if ($result)
|
||||
print price($obj->amount);
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||
print '</td>';
|
||||
|
||||
// Credit
|
||||
@ -353,12 +353,12 @@ if ($result)
|
||||
print price($obj->amount);
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
||||
print '</td>' ;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
|
||||
@ -480,10 +480,10 @@ if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape(
|
||||
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
|
||||
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
|
||||
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
|
||||
if ($search_date_start) $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";
|
||||
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";
|
||||
if ($search_date_start) $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";
|
||||
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
|
||||
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
|
||||
if ($search_user > 0)
|
||||
@ -752,12 +752,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -766,12 +766,12 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = '';
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -73,6 +73,11 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
public $ismultientitymanaged = 1;
|
||||
|
||||
/**
|
||||
* @var int Does object support extrafields ? 0=No, 1=Yes
|
||||
*/
|
||||
public $isextrafieldmanaged = 1;
|
||||
|
||||
/**
|
||||
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||
* @var integer
|
||||
@ -189,6 +194,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, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
|
||||
'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;
|
||||
@ -675,18 +710,18 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->entity = $obj->entity;
|
||||
$this->statut = $obj->statut;
|
||||
$this->mise_en_service = $this->db->jdate($obj->datemise);
|
||||
|
||||
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
||||
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
||||
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
||||
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
||||
|
||||
$this->fin_validite = $this->db->jdate($obj->fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
$this->fin_validite = $this->db->jdate($obj->fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
@ -696,9 +731,9 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
$this->fk_projet = $obj->fk_project; // deprecated
|
||||
$this->fk_projet = $obj->fk_project; // deprecated
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -708,7 +743,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Retreive all extrafields
|
||||
// Retrieve all extrafields
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
@ -1381,10 +1416,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
|
||||
@ -1739,8 +1774,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)
|
||||
{
|
||||
@ -3004,6 +3045,7 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$this->oldcopy = new ContratLigne($this->db);
|
||||
$this->oldcopy->fetch($this->id);
|
||||
$this->oldcopy->fetch_optionals();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -34,11 +34,15 @@ if ($action == 'update' && is_array($arrayofparameters))
|
||||
$ok=true;
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
// Modify constant only if key was posted (avoid resetting key to the null value)
|
||||
if (GETPOSTISSET($key))
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -1123,7 +1123,7 @@ abstract class CommonDocGenerator
|
||||
*/
|
||||
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
||||
{
|
||||
global $hookmanager;
|
||||
global $hookmanager, $conf;
|
||||
|
||||
foreach ($this->cols as $colKey => $colDef) {
|
||||
$parameters = array(
|
||||
@ -1153,6 +1153,14 @@ abstract class CommonDocGenerator
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
|
||||
global $outputlangsbis;
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||
}
|
||||
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
{
|
||||
@ -6612,7 +6611,7 @@ abstract class CommonObject
|
||||
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;
|
||||
|
||||
// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
|
||||
$enabled = 1;
|
||||
//$enabled = 1;
|
||||
|
||||
$visibility = 1;
|
||||
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
|
||||
@ -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
|
||||
|
||||
@ -225,7 +225,8 @@ class DolEditor
|
||||
breakAfterClose : true
|
||||
});
|
||||
}
|
||||
}';
|
||||
},
|
||||
disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER)?'true':'false');
|
||||
|
||||
if ($this->uselocalbrowser)
|
||||
{
|
||||
|
||||
@ -1135,7 +1135,7 @@ class DolGraph
|
||||
public function total()
|
||||
{
|
||||
$value = 0;
|
||||
foreach($this->data as $valarray) // Loop on each x
|
||||
foreach ($this->data as $valarray) // Loop on each x
|
||||
{
|
||||
$value += $valarray[1];
|
||||
}
|
||||
@ -1145,8 +1145,8 @@ class DolGraph
|
||||
/**
|
||||
* Output HTML string to show graph
|
||||
*
|
||||
* @param int $shownographyet Show graph to say there is not enough data
|
||||
* @return string HTML string to show graph
|
||||
* @param int|string $shownographyet Show graph to say there is not enough data or the message in $shownographyet if it is a string.
|
||||
* @return string HTML string to show graph
|
||||
*/
|
||||
public function show($shownographyet = 0)
|
||||
{
|
||||
@ -1155,7 +1155,13 @@ class DolGraph
|
||||
if ($shownographyet)
|
||||
{
|
||||
$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
|
||||
$s .= '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
$s .= '<div class="nographyettext">';
|
||||
if (is_numeric($shownographyet)) {
|
||||
$s .= $langs->trans("NotEnoughDataYet");
|
||||
} else {
|
||||
$s .= $shownographyet;
|
||||
}
|
||||
$s .= '</div>';
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php';
|
||||
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
||||
use Mike42\Escpos\PrintConnectors\DummyPrintConnector;
|
||||
use Mike42\Escpos\CapabilityProfile;
|
||||
use Mike42\Escpos\Printer;
|
||||
use Mike42\Escpos\EscposImage;
|
||||
@ -529,7 +530,13 @@ class dolReceiptPrinter extends Printer
|
||||
$this->printer->text("Most simple example\n");
|
||||
$this->printer->feed();
|
||||
$this->printer->cut();
|
||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||
|
||||
// If is DummyPrintConnector send to log to debugging
|
||||
if($this->printer->connector instanceof DummyPrintConnector)
|
||||
{
|
||||
$data = $this->printer->connector-> getData();
|
||||
dol_syslog($data);
|
||||
}
|
||||
$this->printer->close();
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
@ -713,9 +720,13 @@ class dolReceiptPrinter extends Printer
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Close and print
|
||||
// uncomment next line to see content sent to printer
|
||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||
// If is DummyPrintConnector send to log to debugging
|
||||
if($this->printer->connector instanceof DummyPrintConnector)
|
||||
{
|
||||
$data = $this->printer->connector->getData();
|
||||
dol_syslog($data);
|
||||
}
|
||||
// Close and print
|
||||
$this->printer->close();
|
||||
}
|
||||
return $error;
|
||||
@ -783,7 +794,6 @@ class dolReceiptPrinter extends Printer
|
||||
try {
|
||||
switch ($obj['fk_type']) {
|
||||
case 1:
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/src/DummyPrintConnector.php';
|
||||
$this->connector = new DummyPrintConnector();
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
@ -688,18 +690,19 @@ class Form
|
||||
/**
|
||||
* Return combo list of activated countries, into language of user
|
||||
*
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @return string HTML string with select
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0)
|
||||
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $mysoc;
|
||||
@ -731,6 +734,7 @@ class Form
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$countryArray[$i]['rowid'] = $obj->rowid;
|
||||
$countryArray[$i]['code_iso'] = $obj->code_iso;
|
||||
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
|
||||
@ -763,6 +767,7 @@ class Form
|
||||
{
|
||||
//if (empty($showempty) && empty($row['rowid'])) continue;
|
||||
if (empty($row['rowid'])) continue;
|
||||
if (is_array($exclude_country_code) && count($exclude_country_code) && in_array($row['code_iso'], $exclude_country_code)) continue; // exclude some countries
|
||||
|
||||
if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++;
|
||||
if (empty($row['favorite']) && $atleastonefavorite)
|
||||
@ -2359,6 +2364,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 +2515,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 +2643,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;
|
||||
|
||||
@ -5167,11 +5173,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;
|
||||
}
|
||||
@ -5910,7 +5916,7 @@ class Form
|
||||
//var_dump($objecttmp->filter);
|
||||
$prefixforautocompletemode = $objecttmp->element;
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
|
||||
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode='produit';
|
||||
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 +6239,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))
|
||||
{
|
||||
@ -7864,7 +7875,7 @@ class Form
|
||||
*/
|
||||
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
global $user, $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
@ -7873,16 +7884,16 @@ class Form
|
||||
$usertofilter = $user;
|
||||
}
|
||||
|
||||
$out='';
|
||||
$out = '';
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
if (empty($projectsListId))
|
||||
{
|
||||
if (empty($usertofilter->rights->projet->all->lire))
|
||||
{
|
||||
$projectstatic=new Project($this->db);
|
||||
$projectstatic = new Project($this->db);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
||||
}
|
||||
}
|
||||
@ -7890,37 +7901,37 @@ class Form
|
||||
// Search all projects
|
||||
$sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref,
|
||||
p.title, p.fk_soc, p.fk_statut, p.public,';
|
||||
$sql.= ' s.nom as name';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql.= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||
$sql .= ' s.nom as name';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||
//if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
$sql.= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
|
||||
$sql .= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Use select2 selector
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out.=$comboenhancement;
|
||||
$morecss='minwidth200imp maxwidth500';
|
||||
$out .= $comboenhancement;
|
||||
$morecss = 'minwidth200imp maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out.= '<select class="valignmiddle flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
}
|
||||
if (! empty($show_empty)) {
|
||||
$out.= '<option value="0" class="optiongrey">';
|
||||
if (! is_numeric($show_empty)) $out.=$show_empty;
|
||||
else $out.=' ';
|
||||
$out.= '</option>';
|
||||
if (!empty($show_empty)) {
|
||||
$out .= '<option value="0" class="optiongrey">';
|
||||
if (!is_numeric($show_empty)) $out .= $show_empty;
|
||||
else $out .= ' ';
|
||||
$out .= '</option>';
|
||||
}
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
@ -7946,57 +7957,57 @@ class Form
|
||||
|
||||
if ($showproject == 'all')
|
||||
{
|
||||
$labeltoshow.=dol_trunc($obj->ref, 18); // Invoice ref
|
||||
if ($obj->name) $labeltoshow.=' - '.$obj->name; // Soc name
|
||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
|
||||
if ($obj->name) $labeltoshow .= ' - '.$obj->name; // Soc name
|
||||
|
||||
$disabled=0;
|
||||
$disabled = 0;
|
||||
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Draft");
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||
}
|
||||
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
||||
{
|
||||
if ($discard_closed == 2) $disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
||||
if ($discard_closed == 2) $disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
||||
}
|
||||
elseif ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid)
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected';
|
||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||
$out.= '>'.$labeltoshow.'</option>';
|
||||
$out .= '>'.$labeltoshow.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
|
||||
{
|
||||
$resultat='';
|
||||
$resultat = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultat='<option value="'.$obj->rowid.'"';
|
||||
if ($disabled) $resultat.=' disabled';
|
||||
$resultat = '<option value="'.$obj->rowid.'"';
|
||||
if ($disabled) $resultat .= ' disabled';
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$resultat.='>';
|
||||
$resultat.=$labeltoshow;
|
||||
$resultat.='</option>';
|
||||
$resultat .= '>';
|
||||
$resultat .= $labeltoshow;
|
||||
$resultat .= '</option>';
|
||||
}
|
||||
$out.= $resultat;
|
||||
$out .= $resultat;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if (empty($option_only)) {
|
||||
$out.= '</select>';
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
print $out;
|
||||
@ -8010,4 +8021,23 @@ class Form
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the component to make advanced search criteries
|
||||
*
|
||||
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
|
||||
* @param array $search_component_params Array of selected search criterias
|
||||
* @return string HTML component for advanced search
|
||||
*/
|
||||
public function searchComponent($arrayofcriterias, $search_component_params)
|
||||
{
|
||||
$ret = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@ -493,7 +493,7 @@ class Utils
|
||||
}
|
||||
|
||||
// Clean old files
|
||||
if (! $errormsg && $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;
|
||||
|
||||
@ -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
|
||||
{
|
||||
@ -2106,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'))
|
||||
{
|
||||
@ -2532,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))
|
||||
@ -2963,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>';
|
||||
}
|
||||
@ -2064,7 +2064,7 @@ function dol_now($mode = 'gmt')
|
||||
$tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
||||
$ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
|
||||
}
|
||||
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
/*elseif ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time
|
||||
@ -3060,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',
|
||||
@ -4515,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
|
||||
@ -4604,7 +4605,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a dimension with best unit
|
||||
*
|
||||
@ -5700,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6039,7 +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__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : '');
|
||||
$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');
|
||||
|
||||
@ -6084,6 +6089,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object) ? $object->address : '');
|
||||
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object) ? $object->zip : '');
|
||||
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object) ? $object->town : '');
|
||||
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object) ? $object->country_id : '');
|
||||
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object) ? $object->country_code : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object) ? $object->idprof1 : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object) ? $object->idprof2 : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object) ? $object->idprof3 : '');
|
||||
@ -6107,6 +6114,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object->thirdparty) ? $object->thirdparty->address : '');
|
||||
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty) ? $object->thirdparty->zip : '');
|
||||
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty) ? $object->thirdparty->town : '');
|
||||
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_id : '');
|
||||
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_code : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof1 : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof2 : '');
|
||||
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof3 : '');
|
||||
@ -7412,7 +7421,7 @@ function printCommonFooter($zone = 'private')
|
||||
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||
$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
//$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
if (!empty($user->default_values[$relativepathstring]['focus']))
|
||||
{
|
||||
foreach ($user->default_values[$relativepathstring]['focus'] as $defkey => $defval)
|
||||
@ -7424,7 +7433,9 @@ function printCommonFooter($zone = 'private')
|
||||
$foundintru = 0;
|
||||
foreach ($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1;
|
||||
$tmpquerytohaveparam = explode('=', $tmpquerytohave);
|
||||
//print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');";
|
||||
if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1;
|
||||
}
|
||||
if (!$foundintru) $qualified = 1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
@ -7454,7 +7465,9 @@ function printCommonFooter($zone = 'private')
|
||||
$foundintru = 0;
|
||||
foreach ($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1;
|
||||
$tmpquerytohaveparam = explode('=', $tmpquerytohave);
|
||||
//print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');";
|
||||
if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1;
|
||||
}
|
||||
if (!$foundintru) $qualified = 1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
@ -8493,7 +8506,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);
|
||||
}
|
||||
}
|
||||
elseif ($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"));
|
||||
|
||||
@ -935,7 +935,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
|
||||
// Warning
|
||||
print '<td class="right">';
|
||||
/*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||
else if ($disabledtask)
|
||||
elseif ($disabledtask)
|
||||
{
|
||||
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||
if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...');
|
||||
|
||||
@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user