Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-25 08:12:54 +02:00
commit a43e6f96b5
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
174 changed files with 3143 additions and 1669 deletions

View File

@ -42,6 +42,8 @@ FIX: #12041
FIX: #12054
FIX: #12083
FIX: #12088
FIX: CVE-2019-17578 CVE-2019-17577 CVE-2019-17576
FIX: Clean the + of categories on the product view only in POS module
FIX: access to public interface when origin email has an alias.
FIX: Alias name is not into the email recipient label.
FIX: allow standalone credit note even if no invoice

View File

@ -152,7 +152,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$result=$object->create($fuser);
if ($result >= 0)
{

View File

@ -176,7 +176,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$object->contactid = $contids[$socids[$socid]][0];
$object->socid = $socids[$socid];
$object->datep = $dates[mt_rand(1, count($dates)-1)];
@ -200,7 +200,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
}
$xnbp++;
}
$result=$object->valid($fuser);
if ($result > 0)
{

View File

@ -201,7 +201,7 @@
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">

View File

@ -29,6 +29,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
// Load translation files required by the page
@ -65,6 +66,8 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
/*
* Actions
@ -101,7 +104,7 @@ if ($action == 'validatehistory') {
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
if ($db->type == 'pgsql') {
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
@ -114,16 +117,83 @@ if ($action == 'validatehistory') {
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}
}*/
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql.= " co.code as country_code, co.label as country_label,";
$sql.= " s.tva_intra";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
dol_syslog('htdocs/accountancy/customer/index.php');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
$result = $db->query($sql);
if (! $result) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
} else {
$num_lines = $db->num_rows($result);
$isSellerInEEC = isInEEC($mysoc);
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
// Search suggested account for product/service
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
$objp->code_sell_p = $objp->code_sell_export;
$objp->aarowid_suggest = $objp->aarowid_export;
$suggestedaccountingaccountfor = 'export';
}
}
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$resqlupdate = $db->query($sqlupdate);
if (! $resqlupdate)
{
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
$i++;
}
}
if ($error)
{
$db->rollback();
}
else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
}

View File

@ -358,6 +358,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product
@ -377,7 +378,13 @@ if ($result) {
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
// Country
print '<td>';
if ($objp->country_code)
{
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
}
print '</td>';
print '<td>' . $objp->tva_intra . '</td>';

View File

@ -219,9 +219,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
// Add search filter like
@ -247,7 +247,7 @@ if (strlen(trim($search_account))) {
$sql .= natural_search("aa.account_number", $search_account);
}
if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", $search_vat, 1);
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
}
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) {
@ -406,7 +406,7 @@ if ($result) {
$isSellerInEEC = isInEEC($mysoc);
while ( $i < min($num_lines, $limit) ) {
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
$objp->code_sell_l = '';
@ -518,6 +518,7 @@ if ($result) {
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
print '</td>';
// Country
print '<td>';
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
print $labelcountry;

View File

@ -27,6 +27,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
// Load translation files required by the page
@ -63,6 +64,7 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
/*
@ -99,7 +101,7 @@ if ($action == 'validatehistory') {
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
if ($db->type == 'pgsql') {
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
@ -112,16 +114,85 @@ if ($action == 'validatehistory') {
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}
}*/
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
$sql.= " aa.rowid as aarowid,";
$sql.= " co.code as country_code, co.label as country_label,";
$sql.= " s.tva_intra";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
$result = $db->query($sql);
if (! $result) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
} else {
$num_lines = $db->num_rows($result);
$isSellerInEEC = isInEEC($mysoc);
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
// Search suggested account for product/service
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
//$objp->code_buy_p = $objp->code_buy_intra;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_intra;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
//$objp->code_buy_p = $objp->code_buy_export;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_export;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = 'export';
}
}
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$resqlupdate = $db->query($sqlupdate);
if (! $resqlupdate)
{
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
$i++;
}
}
if ($error)
{
$db->rollback();
}
else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
}

View File

@ -367,6 +367,7 @@ if ($result) {
print $objp->invoice_label;
print '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product
@ -387,7 +388,12 @@ if ($result) {
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
print '<td>';
if ($objp->country_code)
{
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
}
print '</td>';
print '<td>' . $objp->tva_intra . '</td>';

View File

@ -222,7 +222,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
// Add search filter like
@ -307,8 +307,8 @@ if ($result) {
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
if ($search_day) $param.='&search_day='.urlencode($search_day);
if ($search_month) $param.='&search_month='.urlencode($search_month);
@ -463,7 +463,7 @@ if ($result) {
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product
// Ref Product
print '<td>';
if ($product_static->id > 0)
print $product_static->getNomUrl(1);
@ -471,7 +471,7 @@ if ($result) {
print '</td>';
// Description
print '<td>';
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);

View File

@ -999,7 +999,7 @@ else
print '</td></tr>';
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email', 'alpha')?GETPOST('member_email', 'alpha'):$object->email).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email', 'alpha')?GETPOST('member_email', 'alpha'):$object->email).'"></td></tr>';
// Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
@ -1036,13 +1036,13 @@ else
}
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
if (! empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
@ -1258,7 +1258,7 @@ else
print '</td></tr>';
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email", '', 2):$object->email).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email", '', 2):$object->email).'"></td></tr>';
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>';
@ -1288,13 +1288,13 @@ else
}
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
if (! empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {

View File

@ -2129,7 +2129,11 @@ class Adherent extends CommonObject
// Only picto
if ($withpictoimg > 0) $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</span>';
// Picto must be a photo
else $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</span>';
else {
$picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>';
$picto.=Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1);
$picto.='</span>';
}
$result.=$picto;
}
if ($withpictoimg > -2 && $withpictoimg != 2)
@ -2172,83 +2176,46 @@ class Adherent extends CommonObject
// phpcs:enable
global $langs;
$langs->load("members");
if ($mode == 0)
if ($statut == -1)
{
if ($statut == -1) return $langs->trans("MemberStatusDraft");
elseif ($statut >= 1) {
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive");
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate");
else return $langs->trans("MemberStatusPaid");
}
elseif ($statut == 0) return $langs->trans("MemberStatusResiliated");
$statusType = 'status0';
$labelstatut = $langs->trans("MemberStatusDraft");
$labelstatutShort = $langs->trans("MemberStatusDraftShort");
}
elseif ($mode == 1)
elseif ($statut >= 1) {
if ($need_subscription == 0)
{
$statusType = 'status4';
$labelstatut = $langs->trans("MemberStatusNoSubscription");
$labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort");
}
elseif (! $date_end_subscription)
{
$statusType = 'status1';
$labelstatut = $langs->trans("MemberStatusActive");
$labelstatutShort = $langs->trans("MemberStatusActiveShort");
}
elseif ($date_end_subscription < time())
{
$statusType = 'status3';
$labelstatut = $langs->trans("MemberStatusActiveLate");
$labelstatutShort = $langs->trans("MemberStatusActiveLateShort");
}
else {
$statusType = 'status4';
$labelstatut = $langs->trans("MemberStatusPaid");
$labelstatutShort = $langs->trans("MemberStatusPaidShort");
}
}
elseif ($statut == 0)
{
if ($statut == -1) return $langs->trans("MemberStatusDraftShort");
elseif ($statut >= 1) {
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort");
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort");
else return $langs->trans("MemberStatusPaidShort");
}
elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort");
}
elseif ($mode == 2)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraftShort");
elseif ($statut >= 1) {
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscriptionShort");
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActiveShort");
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLateShort");
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaidShort");
}
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliatedShort");
}
elseif ($mode == 3)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0');
elseif ($statut >= 1) {
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1');
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4');
}
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
}
elseif ($mode == 4)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraft");
elseif ($statut >= 1) {
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscription");
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActive");
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLate");
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaid");
}
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliated");
}
elseif ($mode == 5)
{
if ($statut == -1) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusDraftShort").'</span> '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
elseif ($statut >= 1) {
if ($need_subscription == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusNoSubscriptionShort").' </span>'.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
elseif (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'), 'statut1');
elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
}
if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
}
elseif ($mode == 6)
{
if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
if ($statut >= 1) {
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription").' '.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'), 'statut1');
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
else return $langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
}
if ($statut == 0) return $langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
$statusType = 'status6';
$labelstatut = $langs->trans("MemberStatusResiliated");
$labelstatutShort = $langs->trans("MemberStatusResiliatedShort");
}
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
}

View File

@ -227,10 +227,8 @@ $sql = "SELECT c.subscription, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != '')
{
$sql .= " AND c.dateadh LIKE '".$date_select."%'";
}
$result = $db->query($sql);
if ($result)
{
@ -251,21 +249,33 @@ if ($result)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Subscriptions").'</th>';
print '<th class="right">'.$langs->trans("Number").'</th>';
print '<th>'.$langs->trans("Year").'</th>';
print '<th class="right">'.$langs->trans("Subscriptions").'</th>';
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
print "</tr>\n";
krsort($Total);
$i = 0;
foreach ($Total as $key=>$value)
{
print '<tr class="oddeven">';
if ($i >= 8)
{
print '<tr class="oddeven">';
print "<td>...</td>";
print "<td class=\"right\"></td>";
print "<td class=\"right\"></td>";
print "<td class=\"right\"></td>";
print "</tr>\n";
break;
}
print '<tr class="oddeven">';
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td class=\"right\">".$Number[$key]."</td>";
print "<td class=\"right\">".price($value)."</td>";
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
print "</tr>\n";
$i++;
}
// Total

View File

@ -681,6 +681,7 @@ while ($i < min($num, $limit))
$memberstatic->datefin= $datefin;
$memberstatic->socid = $obj->fk_soc;
$memberstatic->photo = $obj->photo;
$memberstatic->morphy = $obj->morphy;
if (! empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();

View File

@ -476,7 +476,7 @@ if (! empty($conf->barcode->enabled)) {
}
// Logo
print '<tr class="oddeven"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
@ -493,7 +493,7 @@ print '</td></tr></table>';
print '</td></tr>';
// Logo (squarred)
print '<tr class="oddeven"><td><label for="logo_squarred">'.$langs->trans("LogoSquarred").' (png,jpg)</label></td><td>';
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';

View File

@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* PrestaShop Webservice Library
* @package PrestaShopWebservice
*/
@ -395,52 +395,6 @@ class PrestaShopWebservice
self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']);
}
/**
* Delete (DELETE) a resource.
* Unique parameter must take : <br><br>
* 'resource' => Resource name<br>
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
* // Following code will not be executed if an exception is thrown.
* echo 'Successfully deleted.';
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
*
* @param array $options Array representing resource to delete.
* @return boolean True
*/
public function delete($options)
{
if (isset($options['url'])) {
$url = $options['url'];
} elseif (isset($options['resource']) && isset($options['id'])) {
if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
}
if (isset($options['id_shop'])) {
$url .= '&id_shop='.$options['id_shop'];
}
if (isset($options['id_group_shop'])) {
$url .= '&id_group_shop='.$options['id_group_shop'];
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity
return true;
}
}
/**

View File

@ -65,27 +65,27 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"]))
{
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
// Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
// Content parameters
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@ -101,8 +101,8 @@ $mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml';
@ -821,7 +821,7 @@ else
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->fromid=$user->id;
$formmail->fromalsorobot=1;
$formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
$formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
$formmail->withfromreadonly=1;
$formmail->withsubstit=1;
$formmail->withfrom=1;
@ -847,7 +847,7 @@ else
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode")=='init')
if (GETPOST("mode", "aZ09")=='init')
{
$formmail->clear_attached_files();
}

View File

@ -178,6 +178,7 @@ class DolibarrApi
unset($object->lines[$i]->cond_reglement);
unset($object->lines[$i]->fk_delivery_address);
unset($object->lines[$i]->fk_projet);
unset($object->lines[$i]->fk_project);
unset($object->lines[$i]->thirdparty);
unset($object->lines[$i]->user);
unset($object->lines[$i]->model_pdf);
@ -290,6 +291,7 @@ class DolibarrApi
if (count($tmp) < 3) return '';
$tmpescaped=$tmp[2];
$regbis = array();
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
{
$tmpescaped = "'".$db->escape($regbis[1])."'";

View File

@ -197,13 +197,64 @@ class Setup extends DolibarrApi
* @throws RestException
*/
public function getCountryByID($id, $lang = '')
{
return $this->_fetchCcountry($id, '', '', $lang);
}
/**
* Get country by Code.
*
* @param string $code Code of country
* @param string $lang Code of the language the name of the
* country must be translated to
* @return array Array of cleaned object properties
*
* @url GET dictionary/countries/byCode/{code}
*
* @throws RestException
*/
public function getCountryByCode($code, $lang = '')
{
return $this->_fetchCcountry('', $code, '', $lang);
}
/**
* Get country by Iso.
*
* @param string $iso ISO of country
* @param string $lang Code of the language the name of the
* country must be translated to
* @return array Array of cleaned object properties
*
* @url GET dictionary/countries/byISO/{iso}
*
* @throws RestException
*/
public function getCountryByISO($iso, $lang = '')
{
return $this->_fetchCcountry('', '', $iso, $lang);
}
/**
* Get country.
*
* @param int $id ID of country
* @param string $code Code of country
* @param string $iso ISO of country
* @param string $lang Code of the language the name of the
* country must be translated to
* @return array Array of cleaned object properties
*
* @throws RestException
*/
private function _fetchCcountry($id, $code = '', $iso = '', $lang = '')
{
$country = new Ccountry($this->db);
if ($country->fetch($id) < 0) {
$result = $country->fetch($id, $code, $iso);
if ($result < 0) {
throw new RestException(503, 'Error when retrieving country : '.$country->error);
}
elseif ($country->fetch($id) == 0) {
} elseif ($result == 0) {
throw new RestException(404, 'country not found');
}
@ -320,6 +371,66 @@ class Setup extends DolibarrApi
}
}
/**
* Get the list of shipment methods.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
*
* @return array List of shipment methods
*
* @url GET dictionary/shipment_methods
*
* @throws RestException
*/
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql.= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of shipment methods : '.$this->db->lasterror());
}
return $list;
}
/**
* Get the list of events types.
*

View File

@ -615,7 +615,7 @@ if ($rowid > 0)
if (empty($reshook))
{
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
foreach($extrafields->attributes[$object->element]['label'] as $key=>$label)
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {

View File

@ -79,6 +79,7 @@ $permissionnote=$user->rights->bom->write; // Used by the include of actions_set
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
/*
@ -93,11 +94,11 @@ if (empty($reshook))
{
$error=0;
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage)) {
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
if (empty($backtopage) || ($cancel && empty($id))) {
//var_dump($backurlforlist);exit;
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
}
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
@ -218,7 +219,7 @@ if ($action == 'create')
dol_fiche_head(array(), '');
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
@ -252,7 +253,9 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print '<table class="border centpercent">'."\n";
//$object->fields['keyfield']['disabled'] = 1;
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';

View File

@ -454,12 +454,12 @@ while ($i < min($num, $limit))
$cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';

View File

@ -100,7 +100,7 @@ class Boms extends DolibarrApi
$obj_ret = array();
$tmpobject = new BOM($db);
$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
$restrictonsocid = 0; // Set to 1 if there is a field socid in table of object

View File

@ -91,7 +91,7 @@ class BOM extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
@ -817,34 +817,10 @@ class BOM extends CommonObject
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
if ($mode == 0)
{
return $this->labelstatus[$status];
}
elseif ($mode == 1)
{
return $this->labelstatus[$status];
}
elseif ($mode == 2)
{
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
}
elseif ($mode == 3)
{
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 4)
{
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
}
elseif ($mode == 5)
{
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 6)
{
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
}
$statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
}
/**

View File

@ -92,9 +92,9 @@ $coldisplay++;
echo $line->efficiency;
print '</td>';
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) {
print '<td class="linecoledit center">';
$coldisplay++;
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) {
print '<td class="linecoledit center">';
$coldisplay++;
if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';

View File

@ -66,6 +66,7 @@ function printBookmarksList()
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
$ret.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';

View File

@ -1543,7 +1543,7 @@ class ActionComm extends CommonObject
$event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type']=$type;
$datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
// fix for -> Warning: A non-numeric value encountered
if(is_numeric($this->db->jdate($obj->datep2)))
{

View File

@ -138,13 +138,16 @@ $arrayfields=array(
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*

View File

@ -58,11 +58,11 @@ if ($object->fetch($id) >= 0)
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div><br>';
//print '<table width="100%"><tr><td>';
$object->user_creation=$object->user_creat;
$object->date_creation=$object->date_creat;
@ -70,7 +70,7 @@ if ($object->fetch($id) >= 0)
$object->date_validation=$object->date_valid;
dol_print_object_info($object, 0);
//print '</td></tr></table>';
dol_fiche_end();
}

View File

@ -58,7 +58,7 @@ if (!empty($conf->variants->enabled)) {
}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings'));
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings', 'other'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->margin->enabled))
$langs->load('margins');
@ -121,6 +121,7 @@ $usercancreateorder = $user->rights->commande->creer;
$usercancreateinvoice = $user->rights->facture->creer;
$usercancreatecontract = $user->rights->contrat->creer;
$usercancreateintervention = $user->rights->ficheinter->creer;
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@ -2499,13 +2500,23 @@ if ($action == 'create')
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans('SendMail') . '</a>';
}
// Create an order
// Create a sale order
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateorder) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a>';
}
}
// Create a purchase order
if (! empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL))
{
if (! empty($conf->fournisseur->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddPurchaseOrder") . '</a>';
}
}
}
// Create an intervention
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateintervention) {

View File

@ -106,6 +106,8 @@ $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancr
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
@ -2566,6 +2568,16 @@ if ($action == 'create' && $usercancreate)
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}*/
// Create a purchase order
if (! empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER))
{
if (! empty($conf->fournisseur->enabled) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddPurchaseOrder") . '</a>';
}
}
}
// Create intervention
if ($conf->ficheinter->enabled) {
$langs->load("interventions");

View File

@ -157,13 +157,16 @@ $arrayfields=array(
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');

View File

@ -47,12 +47,9 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
// Security check
if (isset($_GET["id"]) || isset($_GET["ref"]))
{
$id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):'');
}
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$id = GETPOST("id", 'int') ? GETPOST("id", 'int'): GETPOST('ref', 'alpha');
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
$object = new Account($db);
@ -79,12 +76,12 @@ if ($action == 'add')
// Create account
$object = new Account($db);
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
$object->label = trim($_POST["label"]);
$object->courant = $_POST["type"];
$object->clos = $_POST["clos"];
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
$object->url = $_POST["url"];
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
$object->label = trim(GETPOST("label", 'alphanohtml'));
$object->courant = $_POST["type"];
$object->clos = $_POST["clos"];
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
$object->url = trim(GETPOST("url", 'alpha'));
$object->bank = trim($_POST["bank"]);
$object->code_banque = trim($_POST["code_banque"]);
@ -93,27 +90,34 @@ if ($action == 'add')
$object->cle_rib = trim($_POST["cle_rib"]);
$object->bic = trim($_POST["bic"]);
$object->iban = trim($_POST["iban"]);
$object->domiciliation = trim($_POST["domiciliation"]);
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
$object->proprio = trim($_POST["proprio"]);
$object->owner_address = trim($_POST["owner_address"]);
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
$account_number = GETPOST('account_number', 'alpha');
if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; }
$account_number = GETPOST('account_number', 'alphanohtml');
if (empty($account_number) || $account_number == '-1')
{
$object->account_number = '';
}
else
{
$object->account_number = $account_number;
}
$fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
$object->solde = $_POST["solde"];
$object->date_solde = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
$object->currency_code = trim($_POST["account_currency_code"]);
$object->state_id = $_POST["account_state_id"];
$object->country_id = $_POST["account_country_id"];
$object->state_id = GETPOST("account_state_id", 'int');
$object->country_id = GETPOST("account_country_id", 'int');
$object->min_allowed = GETPOST("account_min_allowed", 'int');
$object->min_desired = GETPOST("account_min_desired", 'int');
$object->comment = trim(GETPOST("account_comment"));
$object->comment = trim(GETPOST("account_comment", 'none'));
$object->fk_user_author = $user->id;
@ -176,14 +180,14 @@ if ($action == 'update')
// Update account
$object = new Account($db);
$object->fetch(GETPOST("id"));
$object->fetch(GETPOST("id", 'int'));
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
$object->label = trim($_POST["label"]);
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
$object->label = trim(GETPOST("label", 'alphanohtml'));
$object->courant = $_POST["type"];
$object->clos = $_POST["clos"];
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
$object->url = trim($_POST["url"]);
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
$object->url = trim(GETPOST("url", 'alpha'));
$object->bank = trim($_POST["bank"]);
$object->code_banque = trim($_POST["code_banque"]);
@ -192,10 +196,10 @@ if ($action == 'update')
$object->cle_rib = trim($_POST["cle_rib"]);
$object->bic = trim($_POST["bic"]);
$object->iban = trim($_POST["iban"]);
$object->domiciliation = trim($_POST["domiciliation"]);
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
$object->proprio = trim($_POST["proprio"]);
$object->owner_address = trim($_POST["owner_address"]);
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
$account_number = GETPOST('account_number', 'alpha');
if (empty($account_number) || $account_number == '-1')
@ -211,12 +215,12 @@ if ($action == 'update')
$object->currency_code = trim($_POST["account_currency_code"]);
$object->state_id = $_POST["account_state_id"];
$object->country_id = $_POST["account_country_id"];
$object->state_id = GETPOST("account_state_id", 'int');
$object->country_id = GETPOST("account_country_id", 'int');
$object->min_allowed = GETPOST("account_min_allowed", 'int');
$object->min_desired = GETPOST("account_min_desired", 'int');
$object->comment = trim(GETPOST("account_comment"));
$object->comment = trim(GETPOST("account_comment", 'none'));
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
{
@ -289,7 +293,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
}
else
{
setEventMessages($account->error, $account->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
@ -410,10 +414,15 @@ if ($action == 'create')
{
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$arrayselected = array();
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
if (is_array($cats))
{
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
@ -625,8 +634,8 @@ else
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td>';
$conciliate=$object->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
if ($conciliate == -2) print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
elseif ($conciliate == -3) print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
print '</td></tr>';

View File

@ -1082,38 +1082,27 @@ class Account extends CommonObject
/**
* Return label of given object status
*
* @param int $statut Id statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Label
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load('banks');
if ($statut == self::STATUS_OPEN) {
if ($status == self::STATUS_OPEN) {
$label = $langs->trans("StatusAccountOpened");
$picto = img_picto($label, 'statut4');
$labelshort = $langs->trans("StatusAccountOpened");
$statusType = 'status4';
} else {
$label = $langs->trans("StatusAccountClosed");
$picto = img_picto($label, 'statut5');
$labelshort = $langs->trans("StatusAccountClosed");
$statusType = 'status5';
}
if ($mode == 2) {
return $picto.' '.$label;
} elseif ($mode == 3) {
return $picto;
} elseif ($mode == 4) {
return $picto.' '.$label;
} elseif ($mode == 5) {
return $label.' '.$picto;
} elseif ($mode == 6) {
return $label.' '.$picto;
}
//There is no short mode for this label
return $label;
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
}
@ -2318,11 +2307,11 @@ class AccountLine extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@ -2330,33 +2319,33 @@ class AccountLine extends CommonObject
/*
if ($mode == 0)
{
if ($statut==0) return $langs->trans("ActivityCeased");
if ($statut==1) return $langs->trans("InActivity");
if ($status==0) return $langs->trans("ActivityCeased");
if ($status==1) return $langs->trans("InActivity");
}
if ($mode == 1)
{
if ($statut==0) return $langs->trans("ActivityCeased");
if ($statut==1) return $langs->trans("InActivity");
if ($status==0) return $langs->trans("ActivityCeased");
if ($status==1) return $langs->trans("InActivity");
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
}*/
}

View File

@ -52,8 +52,6 @@ if ($user->societe_id) {
}
if ($user->societe_id)
$socid = $user->societe_id;
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '',
$fieldtype);
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
@ -69,8 +67,10 @@ if (!$sortfield)
$sortfield = "name";
$object = new Account($db);
if ($id)
$object->fetch($id);
if ($id > 0 || ! empty($ref)) $object->fetch($id, $ref);
$result = restrictedArea($user, 'banque', $object->id, 'bank_account', '', '');
/*
* Actions
@ -105,14 +105,14 @@ if ($id > 0 || !empty($ref)) {
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$',
$sortfield,
(strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize+=$file['size'];
}
$morehtmlref = '';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -98,13 +98,16 @@ $arrayfields=array(
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*

View File

@ -47,15 +47,15 @@ if ($id)
$object = new Deplacement($db);
$object->fetch($id);
$object->info($id);
$head = trip_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
}

View File

@ -2566,6 +2566,7 @@ $form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$formmargin = new FormMargin($db);
$soc = new Societe($db);
$paymentstatic=new Paiement($db);
$bankaccountstatic = new Account($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
@ -2586,7 +2587,6 @@ if ($action == 'create')
print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing');
$soc = new Societe($db);
if ($socid > 0)
$res = $soc->fetch($socid);
@ -3465,7 +3465,6 @@ elseif ($id > 0 || ! empty($ref))
$result = $object->fetch_thirdparty();
$soc = new Societe($db);
$result=$soc->fetch($object->socid);
if ($result < 0) dol_print_error($db);
$selleruserevenustamp = $mysoc->useRevenueStamp();

View File

@ -34,7 +34,7 @@ class Cpaiement
* @var string Id to identify managed objects
*/
public $element = 'cpaiement';
/**
* @var string Name of table without prefix where object is stored
*/

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@ -202,6 +202,7 @@ if (empty($reshook))
}
}
$object->email = GETPOST("email", 'alpha');
$object->no_email = GETPOST("no_email", "int");
$object->phone_pro = GETPOST("phone_pro", 'alpha');
$object->phone_perso = GETPOST("phone_perso", 'alpha');
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
@ -240,6 +241,22 @@ if (empty($reshook))
// Categories association
$contcats = GETPOST('contcats', 'array');
$object->setCategories($contcats);
// Add mass emailing flag into table mailing_unsubscribe
if (GETPOST('no_email', 'int') && $object->email)
{
$sql="SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing', 0).") AND email = '".$db->escape($object->email)."'";
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if (empty($obj->nb))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe(email, entity, date_creat) VALUES ('".$db->escape($object->email)."', ".$db->escape(getEntity('mailing', 0)).", '".$db->idate(dol_now())."')";
$resql=$db->query($sql);
}
}
}
}
}
@ -370,6 +387,7 @@ if (empty($reshook))
$object->country_id = GETPOST("country_id", 'int');
$object->email = GETPOST("email", 'alpha');
$object->no_email = GETPOST("no_email", "int");
//$object->jabberid = GETPOST("jabberid", 'alpha');
//$object->skype = GETPOST("skype", 'alpha');
//$object->twitter = GETPOST("twitter", 'alpha');
@ -404,6 +422,35 @@ if (empty($reshook))
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$no_email = GETPOST('no_email', 'int');
// Update mass emailing flag into table mailing_unsubscribe
if (GETPOSTISSET('no_email') && $object->email)
{
if ($no_email)
{
$sql="SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing', 0).") AND email = '".$db->escape($object->email)."'";
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$noemail = $obj->nb;
if (empty($noemail))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe(email, entity, date_creat) VALUES ('".$db->escape($object->email)."', ".$db->escape(getEntity('mailing', 0)).", '".$db->idate(dol_now())."')";
$resql=$db->query($sql);
}
}
}
else
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$db->escape($object->email)."' AND entity = ".$db->escape(getEntity('mailing', 0));
$resql=$db->query($sql);
}
$object->no_email = $no_email;
}
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';

View File

@ -80,25 +80,41 @@ class Contact extends CommonObject
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
);
public $civility_id; // In fact we store civility_code
public $civility_id; // In fact we store civility_code
public $civility_code;
public $civility;
/**
* Address
* @var string
*/
public $address;
public $zip;
public $town;
public $state_id; // Id of department
public $state_code; // Code of department
public $state_code; // Code of department
public $state; // Label of department
public $poste; // Position
public $socid; // fk_soc
public $statut; // 0=inactif, 1=actif
public $statut; // 0=inactif, 1=actif
public $code;
/**
* Email
* @var string
*/
public $email;
/**
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
* @var int
*/
public $no_email;
/**
* @var array array of socialnetworks
*/
@ -433,6 +449,7 @@ class Contact extends CommonObject
if (! $error && $this->user_id > 0)
{
// If contact is linked to a user
$tmpobj = new User($this->db);
$tmpobj->fetch($this->user_id);
$usermustbemodified = 0;
@ -1294,45 +1311,34 @@ class Contact extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
public function LibStatut($statut, $mode)
public function LibStatut($status, $mode)
{
// phpcs:enable
global $langs;
if ($mode == 0)
if (empty($this->status) || empty($this->statusshort))
{
if ($statut==0 || $statut==5) return $langs->trans('Disabled');
elseif ($statut==1 || $statut==4) return $langs->trans('Enabled');
}
elseif ($mode == 1)
{
if ($statut==0 || $statut==5) return $langs->trans('Disabled');
elseif ($statut==1 || $statut==4) return $langs->trans('Enabled');
}
elseif ($mode == 2)
{
if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
}
elseif ($mode == 3)
{
if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
}
elseif ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
}
elseif ($mode == 5)
{
if ($statut==0 || $statut==5) return '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
elseif ($statut==1 || $statut==4) return '<span class="hideonsmartphone">'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
$this->labelstatus[0] = 'ActivityCeased';
$this->labelstatusshort[0] = 'ActivityCeased';
$this->labelstatus[5] = 'ActivityCeased';
$this->labelstatusshort[5] = 'ActivityCeased';
$this->labelstatus[1] = 'InActivity';
$this->labelstatusshort[1] = 'InActivity';
$this->labelstatus[4] = 'InActivity';
$this->labelstatusshort[4] = 'InActivity';
}
$statusType = 'status4';
if ($status==0 || $status==5) $statusType = 'status5';
$label = $langs->trans($this->labelstatus[$status]);
$labelshort = $langs->trans($this->labelstatusshort[$status]);
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
}
@ -1340,14 +1346,14 @@ class Contact extends CommonObject
/**
* Return translated label of Public or Private
*
* @param int $statut Type (0 = public, 1 = private)
* @param int $status Type (0 = public, 1 = private)
* @return string Label translated
*/
public function LibPubPriv($statut)
public function LibPubPriv($status)
{
// phpcs:enable
global $langs;
if ($statut=='1') return $langs->trans('ContactPrivate');
if ($status=='1') return $langs->trans('ContactPrivate');
else return $langs->trans('ContactPublic');
}
@ -1402,18 +1408,18 @@ class Contact extends CommonObject
/**
* Change status of a user
*
* @param int $statut Status to set
* @param int $status Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/
public function setstatus($statut)
public function setstatus($status)
{
global $conf,$langs,$user;
$error=0;
// Check parameters
if ($this->statut == $statut) return 0;
else $this->statut = $statut;
if ($this->statut == $status) return 0;
else $this->statut = $status;
$this->db->begin();

View File

@ -191,15 +191,18 @@ if (! empty($conf->socialnetworks->enabled)) {
}
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$object=new Contact($db);
if (($id > 0 || ! empty($ref)) && $action != 'add')
{
$result=$object->fetch($id, $ref);
@ -950,7 +953,7 @@ while ($i < min($num, $limit))
// Status
if (! empty($arrayfields['p.statut']['checked']))
{
print '<td class="center">'.$contactstatic->getLibStatut(3).'</td>';
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.import_key']['checked']))

View File

@ -32,6 +32,8 @@
if ($cancel)
{
/*var_dump($cancel);
var_dump($backtopage);exit;*/
if (! empty($backtopage))
{
header("Location: ".$backtopage);
@ -80,7 +82,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
if ($result > 0)
{
// Creation OK
$urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: ".$urltogo);
exit;
}

View File

@ -71,7 +71,9 @@ if (! $error && $massaction == 'confirm_presend')
$listofobjectid=array();
$listofobjectthirdparties=array();
$listofobjectcontacts = array();
$listofobjectref=array();
$contactidtosend=array();
$attachedfilesThirdpartyObj=array();
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
@ -97,11 +99,21 @@ if (! $error && $massaction == 'confirm_presend')
if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user;
if (empty($thirdpartyid)) $thirdpartyid=0;
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
}
}
}
if ($objectclass == 'Facture') {
$tmparraycontact = array();
$tmparraycontact = $objecttmp->liste_contact(-1, 'external', 0, 'BILLING');
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
foreach ($tmparraycontact as $data_email) {
$listofobjectcontacts[$toselectid][$data_email['id']] = $data_email['email'];
}
}
}
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
}
}
}
// Check mandatory parameters
if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email))
@ -248,6 +260,21 @@ if (! $error && $massaction == 'confirm_presend')
$fuser->fetch($objectobj->fk_user);
$sendto = $fuser->email;
}
elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid]))
{
$emails_to_sends = array();
$objectobj->fetch_thirdparty();
$contactidtosend=array();
foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) {
$emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid, 'email');
if (!in_array($contactemailid, $contactidtosend)) {
$contactidtosend[] = $contactemailid;
}
}
if (count($emails_to_sends) > 0) {
$sendto = implode(',', $emails_to_sends);
}
}
else
{
$objectobj->fetch_thirdparty();
@ -498,8 +525,8 @@ if (! $error && $massaction == 'confirm_presend')
}
$actionmsg2='';
// Initialisation donnees
$objectobj2->sendtoid = 0;
// Initialisation donnees
$objectobj2->sendtoid = (empty($contactidtosend)?0:$contactidtosend);
$objectobj2->actionmsg = $actionmsg; // Long text
$objectobj2->actionmsg2 = $actionmsg2; // Short text
$objectobj2->fk_element = $objid2;

View File

@ -163,22 +163,24 @@ class Ccountry // extends CommonObject
/**
* Load object in memory from database
*
* @param int $id Id object
* @param string $code Code
* @param int $id Id object
* @param string $code Code
* @param string $code_iso Code ISO
* @return int >0 if OK, 0 if not found, <0 if KO
*/
public function fetch($id, $code = '')
public function fetch($id, $code = '', $code_iso = '')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.code_iso,";
$sql.= " t.label,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.code_iso,";
$sql.= " t.label,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@ -224,15 +224,15 @@ abstract class CommonDocGenerator
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals();
foreach($extrafields->attribute_label as $key=>$label)
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
{
if($extrafields->attribute_type[$key] == 'price')
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
}
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
$array_thirdparty = array_merge($array_thirdparty, array ('company_options_'.$key => $object->array_options ['options_' . $key]));
}
@ -298,15 +298,15 @@ abstract class CommonDocGenerator
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals();
foreach($extrafields->attribute_label as $key => $label)
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{
if ($extrafields->attribute_type[$key] == 'price')
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
}
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
$object->array_options['options_' . $key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_' . $key]];
}
$array_contact = array_merge($array_contact, array($array_key.'_options_' . $key => $object->array_options['options_'. $key]));
}
@ -643,11 +643,11 @@ abstract class CommonDocGenerator
$array_key.'_tracking_number'=>$object->tracking_number,
$array_key.'_tracking_url'=>$object->tracking_url,
$array_key.'_shipping_method'=>$object->listmeths[0]['libelle'],
$array_key.'_weight'=>$object->trueWeight.' '.measuring_units_string($object->weight_units, 'weight'),
$array_key.'_width'=>$object->trueWidth.' '.measuring_units_string($object->width_units, 'size'),
$array_key.'_height'=>$object->trueHeight.' '.measuring_units_string($object->height_units, 'size'),
$array_key.'_depth'=>$object->trueDepth.' '.measuring_units_string($object->depth_units, 'size'),
$array_key.'_size'=>$calculatedVolume.' '.measuring_units_string(0, 'volume'),
$array_key.'_weight'=>$object->trueWeight.' '.measuringUnitString(0, 'weight', $object->weight_units),
$array_key.'_width'=>$object->trueWidth.' '.measuringUnitString(0, 'size', $object->width_units),
$array_key.'_height'=>$object->trueHeight.' '.measuringUnitString(0, 'size', $object->height_units),
$array_key.'_depth'=>$object->trueDepth.' '.measuringUnitString(0, 'size', $object->depth_units),
$array_key.'_size'=>$calculatedVolume.' '.measuringUnitString(0, 'volume'),
);
// Add vat by rates
@ -701,10 +701,10 @@ abstract class CommonDocGenerator
'line_price_ht'=>price($line->total_ht),
'line_price_ttc'=>price($line->total_ttc),
'line_price_vat'=>price($line->total_tva),
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuring_units_string($line->weight_units, 'weight'),
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuring_units_string($line->length_units, 'size'),
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuring_units_string($line->surface_units, 'surface'),
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuring_units_string($line->volume_units, 'volume'),
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuringUnitString(0, 'weight', $line->weight_units),
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuringUnitString(0, 'size', $line->length_units),
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuringUnitString(0, 'surface', $line->surface_units),
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuringUnitString(0, 'volume', $line->volume_units),
);
// Retrieve extrafields
@ -765,30 +765,30 @@ abstract class CommonDocGenerator
{
// phpcs:enable
global $conf;
foreach($extrafields->attribute_label as $key=>$label)
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
{
if($extrafields->attribute_type[$key] == 'price')
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
//Add value to store price with currency
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
}
elseif($extrafields->attribute_type[$key] == 'select')
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
{
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
elseif($extrafields->attribute_type[$key] == 'checkbox') {
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
$valArray=explode(',', $object->array_options['options_'.$key]);
$output=array();
foreach($extrafields->attribute_param[$key]['options'] as $keyopt=>$valopt) {
foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
if (in_array($keyopt, $valArray)) {
$output[]=$valopt;
}
}
$object->array_options['options_'.$key] = implode(', ', $output);
}
elseif($extrafields->attribute_type[$key] == 'date')
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
{
if (strlen($object->array_options['options_'.$key])>0)
{
@ -806,7 +806,7 @@ abstract class CommonDocGenerator
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
}
elseif($extrafields->attribute_type[$key] == 'datetime')
elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
{
$datetime = $object->array_options['options_'.$key];
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
@ -815,7 +815,7 @@ abstract class CommonDocGenerator
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
}
elseif($extrafields->attribute_type[$key] == 'link')
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
{
$id = $object->array_options['options_'.$key];
if ($id != "")

View File

@ -538,7 +538,6 @@ abstract class CommonInvoice extends CommonObject
}
}
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
}

View File

@ -1889,13 +1889,19 @@ abstract class CommonObject
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
if ($this->table_element == 'actioncomm')
if (! empty($this->fields['fk_project'])) // Common case
{
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
else $sql.= ' SET fk_project = NULL';
$sql.= ' WHERE rowid = '.$this->id;
}
elseif ($this->table_element == 'actioncomm') // Special case for actioncomm
{
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
else $sql.= ' SET fk_project = NULL';
$sql.= ' WHERE id = '.$this->id;
}
else
else // Special case for old architecture objects
{
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
else $sql.= ' SET fk_projet = NULL';
@ -3824,17 +3830,18 @@ abstract class CommonObject
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else {
if ($weight_units == 99) {
// conversion 1 Pound = 0.45359237 KG
$trueWeightUnit = 0.45359237;
$totalWeight += $weight * $qty * $trueWeightUnit;
} elseif ($weight_units == 98) {
// conversion 1 Ounce = 0.0283495 KG
$trueWeightUnit = 0.0283495;
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else
if ($weight_units == 99) {
// conversion 1 Pound = 0.45359237 KG
$trueWeightUnit = 0.45359237;
$totalWeight += $weight * $qty * $trueWeightUnit;
} elseif ($weight_units == 98) {
// conversion 1 Ounce = 0.0283495 KG
$trueWeightUnit = 0.0283495;
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else {
$totalWeight += $weight * $qty; // This may be wrong if we mix different units
}
}
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
{
@ -5563,16 +5570,20 @@ abstract class CommonObject
$type='';
$param = array();
$param['options']=array();
$size =$this->fields[$key]['size'];
$reg=array();
$size = $this->fields[$key]['size'];
// Because we work on extrafields
if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[1].':'.$reg[2]=>'N');
$type ='link';
} elseif(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)) {
$param['options']=array($reg[1].':'.$reg[2]=>'N');
if (preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N');
$type ='link';
} elseif (preg_match('/^(integer|link):(.*):(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type ='link';
} elseif (preg_match('/^(integer|link):(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[2].':'.$reg[3] => 'N');
$type ='link';
} elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N');
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type ='sellist';
} elseif(preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
$param['options']=array();
@ -6085,16 +6096,26 @@ abstract class CommonObject
}
elseif ($type == 'link')
{
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
$param_list_array = explode(':', $param_list[0]);
$showempty=(($required && $default != '')?0:1);
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1);
if (! empty($param_list_array[2])) // If we set to add a create button
{
list($class,$classfile)=explode(':', $param_list[0]);
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);
else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$class.'_card.php', 1);
$out.='<a class="butActionNew" href="'.$url_path.'?action=create&backtopage='.$_SERVER['PHP_SELF'].'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
// TODO Add Javascript code to add input fields contents to new elements urls
if (! GETPOSTISSET('backtopage') && empty($val['disabled'])) // To avoid to open several infinitely the 'Create Object' button and to avoid to have button if field is protected by a "disabled".
{
list($class,$classfile)=explode(':', $param_list[0]);
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);
else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.strtolower($class).'_card.php', 1);
$paramforthenewlink = '';
$paramforthenewlink .= (GETPOSTISSET('action')?'&action='.GETPOST('action', 'aZ09'):'');
$paramforthenewlink .= (GETPOSTISSET('id')?'&id='.GETPOST('id', 'int'):'');
$paramforthenewlink .= '&fk_'.strtolower($class).'=--IDFORBACKTOPAGE--';
// TODO Add Javascript code to add input fields already filled into $paramforthenewlink so we won't loose them when going back to main page
$out.='<a class="butActionNew" title="'.$langs->trans("New").'" href="'.$url_path.'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].($paramforthenewlink ? '?'.$paramforthenewlink : '')).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
}
}
elseif ($type == 'password')
@ -6174,6 +6195,7 @@ abstract class CommonObject
$label = $val['label'];
$type = $val['type'];
$size = $val['css'];
$reg = array();
// Convert var to be able to share same code than showOutputField of extrafields
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
@ -6189,7 +6211,9 @@ abstract class CommonObject
$computed=$val['computed'];
$unique=$val['unique'];
$required=$val['required'];
$param=$val['param'];
$param=array();
$param['options']=array();
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
{

View File

@ -353,6 +353,12 @@ class Conf
$this->propal->dir_output=$rootfordata."/propale";
$this->propal->dir_temp=$rootfordata."/propale/temp";
// For backward compatibility
$this->banque->multidir_output = array($this->entity => $rootfordata."/bank");
$this->banque->multidir_temp = array($this->entity => $rootfordata."/bank/temp");
$this->banque->dir_output=$rootfordata."/bank";
$this->banque->dir_temp=$rootfordata."/bank/temp";
// For medias storage
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");

View File

@ -234,8 +234,6 @@ class CUnits // extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$records=array();
$sql = 'SELECT';
$sql.= " t.rowid,";
$sql.= " t.code,";
@ -249,8 +247,8 @@ class CUnits // extends CommonObject
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key=='t.rowid' || $key=='t.active') {
$sqlwhere[] = $key . '='. $value;
if ($key=='t.rowid' || $key=='t.active' || $key=='t.scale') {
$sqlwhere[] = $key . '='. (int) $value;
}
elseif (strpos($key, 'date') !== false) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
@ -273,6 +271,7 @@ class CUnits // extends CommonObject
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);
if ($resql) {
$this->records=array();

View File

@ -1573,9 +1573,9 @@ class ExtraFields
if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
*/
if (! empty($help)) {
if (! empty($help) && $keyprefix != 'search_options_') {
$out .= $form->textwithpicto('', $help, 1, 'help', '', 0, 3);
}
}
return $out;
}
@ -2088,6 +2088,7 @@ class ExtraFields
else
{
$value_key=GETPOST("options_".$key);
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';
}
$object->array_options["options_".$key]=$value_key;

View File

@ -2425,7 +2425,7 @@ class Form
$outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units!==null) {
@ -2802,7 +2802,7 @@ class Form
$outvalUnits .= ' - ' . $unitToShow;
}
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
$outvalUnits .= ' - ' . $unitToShow;
}
if (!empty($objp->surface) && $objp->surface_units!==null) {
@ -2827,15 +2827,6 @@ class Form
}
}
$opt = '<option value="'.$outkey.'"';
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
{
$opt.= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
}
$opt.= '>';
$objRef = $objp->ref;
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
$objRefFourn = $objp->ref_fourn;
@ -2843,19 +2834,17 @@ class Form
$label = $objp->label;
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1);
$opt.=$objp->ref;
$optlabel = $objp->ref;
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$opt.=' ('.$objp->ref_fourn.')';
$opt.=' - ';
$outval.=$objRef;
$optlabel.=' <span class=\'opacitymedium\'>('.$objp->ref_fourn.')</span>';
$outvallabel = $objRef;
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$outval.=' ('.$objRefFourn.')';
$outval.=' - ';
$opt.=dol_trunc($label, 72);
$outval.=dol_trunc($label, 72);
$outvallabel.=' ('.$objRefFourn.')';
// Units
$opt .= $outvalUnits;
$outval .= $outvalUnits;
$optlabel .= $outvalUnits;
$outvallabel .= $outvalUnits;
if (! empty($objp->idprodfournprice))
{
@ -2880,66 +2869,81 @@ class Form
}
if ($objp->quantity == 1)
{
$opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
$outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Unit");
$optlabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
$outvallabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
$optlabel.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outvallabel.=$langs->transnoentities("Unit");
}
else
{
$opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= ' '.$langs->transnoentities("Units");
$optlabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$outvallabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$optlabel.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outvallabel.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)
if ($objp->quantity > 1)
{
$opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$optlabel.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outvallabel.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
}
if ($objp->remise_percent >= 1)
{
$opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
$outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
$optlabel.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
$outvallabel.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
}
if ($objp->duration)
{
$opt .= " - ".$objp->duration;
$outval.=" - ".$objp->duration;
$optlabel .= " - ".$objp->duration;
$outvallabel.=" - ".$objp->duration;
}
if (! $socid)
{
$opt .= " - ".dol_trunc($objp->name, 8);
$outval.=" - ".dol_trunc($objp->name, 8);
$optlabel .= " - ".dol_trunc($objp->name, 8);
$outvallabel.=" - ".dol_trunc($objp->name, 8);
}
if (! empty($conf->barcode->enabled) && !empty($objp->barcode))
{
$opt .= " - ".$objp->barcode;
$outval.=" - ".$objp->barcode;
//$optlabel .= " - <span class='fa fa-barcode'></span>".$objp->barcode;
$optlabel .= " - ".$objp->barcode;
$outvallabel.=" - ".$objp->barcode;
}
if ($objp->supplier_reputation)
{
//TODO dictionary
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
$opt .= " - ".$reputations[$objp->supplier_reputation];
$outval.=" - ".$reputations[$objp->supplier_reputation];
$optlabel .= " - ".$reputations[$objp->supplier_reputation];
$outvallabel.=" - ".$reputations[$objp->supplier_reputation];
}
}
else
{
if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier
{
$opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
$outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
$optlabel.= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
$outvallabel.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
}
else // No supplier price defined for product, even on other suppliers
{
$opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
$outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
$optlabel.= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
$outvallabel.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
}
}
$opt = '<option value="'.$outkey.'"';
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
{
$opt.= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
}
$opt.= ' data-html="'.dol_escape_htmltag($optlabel).'"';
$opt.= '>';
$opt.=$optlabel;
$outval.=$outvallabel;
$opt .= "</option>\n";
@ -5614,7 +5618,7 @@ class Form
};
var d = new Date();";
}
// Generate the date part, depending on the use or not of the javascript calendar
if($addnowlink==1) // server time expressed in user time setup
{
@ -5815,7 +5819,7 @@ class Form
* Generic method to select a component from a combo list.
* This is the generic method that will replace all specific existing methods.
*
* @param string $objectdesc Objectclassname:Objectclasspath
* @param string $objectdesc ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]
* @param string $htmlname Name of HTML select component
* @param int $preselectedvalue Preselected value (ID of element)
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
@ -5824,10 +5828,11 @@ class Form
* @param string $morecss More CSS
* @param string $moreparams More params provided to ajax call
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $disabled 1=Html component is disabled
* @return string Return HTML string
* @see selectForFormsList() select_thirdparty
*/
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0)
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0)
{
global $conf, $user;
@ -5836,12 +5841,16 @@ class Form
$InfoFieldList = explode(":", $objectdesc);
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
$addcreatebuttonornot=empty($InfoFieldList[2])?0:$InfoFieldList[2];
$filter=empty($InfoFieldList[3])?'':$InfoFieldList[3];
if (! empty($classpath))
{
dol_include_once($classpath);
if ($classname && class_exists($classname))
{
$objecttmp = new $classname($this->db);
$objecttmp->filter = $filter;
}
}
if (! is_object($objecttmp))
@ -5854,12 +5863,12 @@ class Form
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
dol_syslog(get_class($this)."::selectForForms", LOG_DEBUG);
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
$out='';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
{
$objectdesc=$classname.':'.$classpath;
$objectdesc=$classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
// No immediate load of all database
@ -5868,22 +5877,50 @@ class Form
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
}
else
{
// Immediate load of all database
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo);
// Immediate load of table record. Note: filter is inside $objecttmp->filter
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled);
}
return $out;
}
/**
* Function to forge a SQL criteria
*
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
* @return string Forged criteria. Example: "t.field like 'abc%'"
*/
protected static function forgeCriteriaCallback($matches)
{
global $db;
//dol_syslog("Convert matches ".$matches[1]);
if (empty($matches[1])) return '';
$tmp=explode(':', $matches[1]);
if (count($tmp) < 3) return '';
$tmpescaped=$tmp[2];
$regbis = array();
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
{
$tmpescaped = "'".$db->escape($regbis[1])."'";
}
else
{
$tmpescaped = $db->escape($tmpescaped);
}
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped;
}
/**
* Output html form to select an object.
* Note, this function is called by selectForForms or by ajax selectobject.php
*
* @param Object $objecttmp Object
* @param Object $objecttmp Object to knwo the table to scan for combo.
* @param string $htmlname Name of HTML select component
* @param int $preselectedvalue Preselected value (ID of element)
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
@ -5893,13 +5930,16 @@ class Form
* @param string $moreparams More params provided to ajax call
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $disabled 1=Html component is disabled
* @return string Return HTML string
* @see selectForForms()
*/
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0)
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0)
{
global $conf, $langs, $user;
//print "$objecttmp->filter, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled";
$prefixforautocompletemode=$objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
@ -5923,19 +5963,28 @@ class Form
// Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
if ($objecttmp->ismultientitymanaged == 2)
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE 1=1";
if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id))
{
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->societe_id;
else $sql.= " AND t.fk_soc = ".$user->societe_id;
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->socid)) {
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->socid;
else $sql.= " AND t.fk_soc = ".$user->socid;
}
if ($searchkey != '') $sql.=natural_search(explode(',', $fieldstoshow), $searchkey);
if ($objecttmp->ismultientitymanaged == 2)
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND t.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($objecttmp->ismultientitymanaged == 2) {
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND t.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
/*if (! DolibarrApi::_checkFilters($objecttmp->filter))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter);
}*/
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")";
}
$sql.=$this->db->order($fieldstoshow, "ASC");
//$sql.=$this->db->plimit($limit, 0);
//print $sql;
// Build output string
$resql=$this->db->query($sql);
@ -5948,7 +5997,7 @@ class Form
}
// Construct $out and $outarray
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparams?' '.$moreparams:'').' name="'.$htmlname.'">'."\n";
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').($moreparams?' '.$moreparams:'').' name="'.$htmlname.'">'."\n";
// Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
$textifempty='&nbsp;';
@ -7331,11 +7380,16 @@ class Form
else
{
$nophoto='/public/theme/common/nophoto.png';
if (in_array($modulepart, array('userphoto','contact'))) // For module that are "physical" users
if (in_array($modulepart, array('userphoto','contact','memberphoto'))) // For module that are "physical" users
{
$nophoto='/public/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png';
if ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor') !== false) {
$nophoto='/public/theme/common/company.png';
}
else {
$nophoto='/public/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png';
}
}
if (! empty($conf->gravatar->enabled) && $email)

View File

@ -231,10 +231,10 @@ class FormFile
if (empty($usewithoutform))
{
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
}
$out .= '<div class="valignmiddle">';
@ -1078,10 +1078,11 @@ class FormFile
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
* @param int $addfilterfields Add line with filters
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1)
* @return int <0 if KO, nb of files shown if OK
* @see list_of_autoecmfiles()
*/
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1)
{
// phpcs:enable
global $user, $conf, $langs, $hookmanager;
@ -1089,8 +1090,11 @@ class FormFile
global $dolibarr_main_url_root;
global $form;
$disablecrop=1;
if (in_array($modulepart, array('bom','expensereport','holiday','member','project','product','produit','service','societe','tax','ticket','user'))) $disablecrop=0;
if ($disablecrop == -1)
{
$disablecrop=1;
if (in_array($modulepart, array('bank','bom','expensereport','holiday','member','project','product','produit','service','societe','tax','ticket','user'))) $disablecrop=0;
}
// Define relative path used to store the file
if (empty($relativepath))
@ -1168,6 +1172,7 @@ class FormFile
if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline)
{
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="renamefile">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
@ -1485,6 +1490,7 @@ class FormFile
if (! empty($addfilterfields))
{
print '<form action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="module" value="'.$modulepart.'">';
}
@ -1772,10 +1778,13 @@ class FormFile
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
$param .= (isset($object->id)?'&id=' . $object->id : '');
print '<!-- listOfLinks -->'."\n";
// Show list of associated links
print load_fiche_titre($langs->trans("LinkedFiles"));
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table width="100%" class="liste noborder nobottom">';
print '<tr class="liste_titre">';

View File

@ -3900,4 +3900,4 @@ class lessc_formatter_lessjs extends lessc_formatter_classic {
public $breakSelectors = true;
public $assignSeparator = ": ";
public $selectorSeparator = ",";
}
}

View File

@ -496,10 +496,10 @@ class SMTPs
return $_retVal;
}
}
// Default authentication method is LOGIN
if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN';
// Send Authentication to Server
// Check for errors along the way
switch ($conf->global->MAIL_SMTP_AUTH_TYPE) {

View File

@ -586,18 +586,18 @@ class Translate
/**
* Return text translated of text received as parameter (and encode it into HTML)
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML.
* If there is no match for this text, we look in alternative file and if still not found,
* it is returned as it is
* The parameters of this method can contain HTML tags
*
* @param string $key Key to translate
* @param string $param1 chaine de param1
* @param string $param2 chaine de param2
* @param string $param3 chaine de param3
* @param string $param4 chaine de param4
* @param string $param1 param1 string
* @param string $param2 param2 string
* @param string $param3 param3 string
* @param string $param4 param4 string
* @param int $maxsize Max length of text
* @return string Translated string (encoded into HTML entities and UTF8)
*/
*/
public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
{
global $conf;
@ -647,9 +647,9 @@ class Translate
/**
* Return translated value of a text string
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel.
* Parameters of this method must not contains any HTML tags.
* If there is no match for this text, we look in alternative file and if still not found
* it is returned as is.
* Parameters of this method must not contain any HTML tags.
*
* @param string $key Key to translate
* @param string $param1 chaine de param1
@ -667,9 +667,9 @@ class Translate
/**
* Return translated value of a text string
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel.
* No convert to encoding charset of lang object is done.
* If there is no match for this text, we look in alternative file and if still not found,
* it is returned as is.
* No conversion to encoding charset of lang object is done.
* Parameters of this method must not contains any HTML tags.
*
* @param string $key Key to translate
@ -781,7 +781,7 @@ class Translate
if (preg_match('/^[a-z]+_[A-Z]+/i', $dir))
{
$this->load("languages");
if (! empty($conf->global->MAIN_LANGUAGES_ALLOWED) && ! in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED)) ) continue;
if ($usecode == 2)

View File

@ -1732,13 +1732,10 @@ function company_admin_prepare_head()
$head[$h][2] = 'company';
$h++;
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$head[$h][0] = DOL_URL_ROOT."/admin/openinghours.php";
$head[$h][1] = $langs->trans("OpeningHours");
$head[$h][2] = 'openinghours';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/openinghours.php";
$head[$h][1] = $langs->trans("OpeningHours");
$head[$h][2] = 'openinghours';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/accountant.php";
$head[$h][1] = $langs->trans("Accountant");

View File

@ -4652,7 +4652,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
$unit = $forceunitoutput;
}*/
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string(0, $type, $unit);
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuringUnitString(0, $type, $unit);
return $ret;
}
@ -5945,6 +5945,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REF__'] = '__REF__';
$substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__';
$substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__';
$substitutionarray['__NOTE_PUBLIC__'] = '__NOTE_PUBLIC__';
$substitutionarray['__NOTE_PRIVATE__'] = '__NOTE_PRIVATE__';
$substitutionarray['__EXTRAFIELD_XXX__'] = '__EXTRAFIELD_XXX__';
if (! empty($conf->societe->enabled))
@ -5952,7 +5954,21 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = '__THIRDPARTY_NAME_ALIAS__';
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = '__THIRDPARTY_CODE_CLIENT__';
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = '__THIRDPARTY_CODE_FOURNISSEUR__';
$substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__';
$substitutionarray['__THIRDPARTY_PHONE__'] = '__THIRDPARTY_PHONE__';
$substitutionarray['__THIRDPARTY_FAX__'] = '__THIRDPARTY_FAX__';
$substitutionarray['__THIRDPARTY_ADRESSE__'] = '__THIRDPARTY_ADRESSE__';
$substitutionarray['__THIRDPARTY_ZIP__'] = '__THIRDPARTY_ZIP__';
$substitutionarray['__THIRDPARTY_TOWN__'] = '__THIRDPARTY_TOWN__';
$substitutionarray['__THIRDPARTY_SIREN__'] = '__THIRDPARTY_SIREN__';
$substitutionarray['__THIRDPARTY_SIRET__'] = '__THIRDPARTY_SIRET__';
$substitutionarray['__THIRDPARTY_APE__'] = '__THIRDPARTY_APE__';
$substitutionarray['__THIRDPARTY_RCSRM__'] = '__THIRDPARTY_RCSRM__';
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = '__THIRDPARTY_TVAINTRA__';
/*$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = '__THIRDPARTY_NOTE_PUBLIC__';
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = '__THIRDPARTY_NOTE_PRIVATE__';*/
}
if (! empty($conf->adherent->enabled))
{
@ -5960,12 +5976,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
/*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__';
$substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/
}
if (! empty($conf->projet->enabled))
{
$substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__';
$substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__';
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_NAME__';
/*$substitutionarray['__PROJECT_NOTE_PUBLIC__'] = '__PROJECT_NOTE_PUBLIC__';
$substitutionarray['__PROJECT_NOTE_PRIVATE__'] = '__PROJECT_NOTE_PRIVATE__';*/
}
if (! empty($conf->contrat->enabled))
{
@ -5998,13 +6018,17 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REF_SUPPLIER__'] = (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['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
$substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null);
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
// For backward compatibility
$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);
// TODO Remove this
$msgishtml = 0;
$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): '');
$birthday = dol_print_date($object->birth, 'day');
@ -6012,22 +6036,22 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
{
$substitutionarray['__MEMBER_ID__']=$object->id;
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
$substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname;
$substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname;
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($outputlangs)):$object->getFullName($outputlangs);
$substitutionarray['__MEMBER_COMPANY__']=$msgishtml?dol_htmlentitiesbr($object->societe):$object->societe;
$substitutionarray['__MEMBER_ADDRESS__']=$msgishtml?dol_htmlentitiesbr($object->address):$object->address;
$substitutionarray['__MEMBER_ZIP__']=$msgishtml?dol_htmlentitiesbr($object->zip):$object->zip;
$substitutionarray['__MEMBER_TOWN__']=$msgishtml?dol_htmlentitiesbr($object->town):$object->town;
$substitutionarray['__MEMBER_COUNTRY__']=$msgishtml?dol_htmlentitiesbr($object->country):$object->country;
$substitutionarray['__MEMBER_EMAIL__']=$msgishtml?dol_htmlentitiesbr($object->email):$object->email;
$substitutionarray['__MEMBER_BIRTH__']=$msgishtml?dol_htmlentitiesbr($birthday):$birthday;
$substitutionarray['__MEMBER_PHOTO__']=$msgishtml?dol_htmlentitiesbr($object->photo):$object->photo;
$substitutionarray['__MEMBER_LOGIN__']=$msgishtml?dol_htmlentitiesbr($object->login):$object->login;
$substitutionarray['__MEMBER_PASSWORD__']=$msgishtml?dol_htmlentitiesbr($object->pass):$object->pass;
$substitutionarray['__MEMBER_PHONE__']=$msgishtml?dol_htmlentitiesbr($object->phone):$object->phone;
$substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso;
$substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile;
$substitutionarray['__MEMBER_FIRSTNAME__']=$object->firstname;
$substitutionarray['__MEMBER_LASTNAME__']=$object->lastname;
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$object->getFullName($outputlangs);
$substitutionarray['__MEMBER_COMPANY__']=$object->societe;
$substitutionarray['__MEMBER_ADDRESS__']=$object->address;
$substitutionarray['__MEMBER_ZIP__']=$object->zip;
$substitutionarray['__MEMBER_TOWN__']=$object->town;
$substitutionarray['__MEMBER_COUNTRY__']=$object->country;
$substitutionarray['__MEMBER_EMAIL__']=$object->email;
$substitutionarray['__MEMBER_BIRTH__']=$birthday;
$substitutionarray['__MEMBER_PHOTO__']=$object->photo;
$substitutionarray['__MEMBER_LOGIN__']=$object->login;
$substitutionarray['__MEMBER_PASSWORD__']=$object->pass;
$substitutionarray['__MEMBER_PHONE__']=$object->phone;
$substitutionarray['__MEMBER_PHONEPRO__']=$object->phone_perso;
$substitutionarray['__MEMBER_PHONEMOBILE__']=$object->phone_mobile;
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc');
@ -6041,14 +6065,38 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:'');
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object)?$object->name_alias:'');
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object)?$object->code_client:'');
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object)?$object->code_fournisseur:'');
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:'');
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object)?$object->phone:'');
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object)?$object->name_fax:'');
$substitutionarray['__THIRDPARTY_ADRESSE__'] = (is_object($object)?$object->address:'');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object)?$object->zip:'');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object)?$object->town:'');
$substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object)?$object->idprof1:'');
$substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object)?$object->idprof2:'');
$substitutionarray['__THIRDPARTY_APE__'] = (is_object($object)?$object->idprof3:'');
$substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object)?$object->idprof4:'');
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object)?$object->tva_intra:'');
}
elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0)
{
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty)?$object->thirdparty->name_alias:'');
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object->thirdparty)?$object->thirdparty->code_client:'');
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object->thirdparty)?$object->thirdparty->code_fournisseur:'');
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:'');
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object->thirdparty)?$object->phone:'');
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object->thirdparty)?$object->name_fax:'');
$substitutionarray['__THIRDPARTY_ADRESSE__'] = (is_object($object->thirdparty)?$object->address:'');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty)?$object->zip:'');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty)?$object->town:'');
$substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object->thirdparty)?$object->idprof1:'');
$substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object->thirdparty)?$object->idprof2:'');
$substitutionarray['__THIRDPARTY_APE__'] = (is_object($object->thirdparty)?$object->idprof3:'');
$substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object->thirdparty)?$object->idprof4:'');
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty)?$object->tva_intra:'');
}
if (is_object($object->project) && $object->project->id > 0)
@ -8074,7 +8122,7 @@ function roundUpToNextMultiple($n, $x = 5)
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
{
$attr=array(
'class'=>'badge'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
);
if(empty($html)){
@ -8135,26 +8183,12 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
global $conf;
$return = '';
$dolGetBadgeParams = array();
if(!empty($params['badgeParams'])){
if (!empty($params['badgeParams'])){
$dolGetBadgeParams = $params['badgeParams'];
}
// image's filename are still in French
$statusImg=array(
'status0' => 'statut0'
,'status1' => 'statut1'
,'status2' => 'statut2'
,'status3' => 'statut3'
,'status4' => 'statut4'
,'status5' => 'statut5'
,'status6' => 'statut6'
,'status7' => 'statut7'
,'status8' => 'statut8'
,'status9' => 'statut9'
);
// TODO : add a hook
if ($displayMode == 0) {
@ -8164,12 +8198,34 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
}
// use status with images
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)){
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
$return = '';
$htmlLabel = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'</span>':'');
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'</span>':'');
if(!empty($statusImg[$statusType])){
// For small screen, we use the short label instead of long label.
if (! empty($conf->dol_optimize_smallscreen))
{
if ($displayMode == 0) $displayMode = 1;
elseif ($displayMode == 4) $displayMode = 2;
elseif ($displayMode == 6) $displayMode = 5;
}
// image's filename are still in French, so we use this array to convert
$statusImg=array(
'status0' => 'statut0'
,'status1' => 'statut1'
,'status2' => 'statut2'
,'status3' => 'statut3'
,'status4' => 'statut4'
,'status5' => 'statut5'
,'status6' => 'statut6'
,'status7' => 'statut7'
,'status8' => 'statut8'
,'status9' => 'statut9'
);
if (!empty($statusImg[$statusType])){
$htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
}else{
$htmlImg = img_picto($statusLabel, $statusType);

View File

@ -2250,13 +2250,16 @@ function colorValidateHex($color, $allow_white = true)
/**
* Change color to make it less aggressive (ratio is negative) or more aggressive (ratio is positive)
*
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
* @param integer $ratio Default=-50. Note: 0=Component color is unchanged, -100=Component color become 88, +100=Component color become 00 or FF
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
* @param integer $ratio Default=-50. Note: 0=Component color is unchanged, -100=Component color become 88, +100=Component color become 00 or FF
* @param integer $brightness Default=0. Adjust brightness. -100=Decrease brightness by 100%, +100=Increase of 100%.
* @return string New string of color
* @see colorAdjustBrightness()
*/
function colorAgressivity($hex, $ratio = -50)
function colorAgressiveness($hex, $ratio = -50, $brightness = 0)
{
if (empty($ratio)) $ratio = 0; // To avoid null
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$ratio = max(-100, min(100, $ratio));
@ -2277,12 +2280,21 @@ function colorAgressivity($hex, $ratio = -50)
if ($color > 127) $color += ((255 - $color) * ($ratio / 100));
if ($color < 128) $color -= ($color * ($ratio / 100));
}
else // We decrease agressivity
else // We decrease agressiveness
{
if ($color > 128) $color -= (($color - 128) * (abs($ratio) / 100));
if ($color < 127) $color += ((128 - $color) * (abs($ratio) / 100));
}
$color = max(0, min(255, $color)); // Adjust color
if ($brightness > 0)
{
$color = ($color * (100 + abs($brightness)) / 100);
}
else
{
$color = ($color * (100 - abs($brightness)) / 100);
}
$color = max(0, min(255, $color)); // Adjust color to stay into valid range
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
}
@ -2294,7 +2306,7 @@ function colorAgressivity($hex, $ratio = -50)
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
* @param integer $steps Step/offset added to each color component. It should be between -255 and 255. Negative = darker, positive = lighter
* @return string New color with format '#AA1122'
* @see colorAgressivity()
* @see colorAgressiveness()
*/
function colorAdjustBrightness($hex, $steps)
{

View File

@ -136,14 +136,14 @@ function invoice_admin_prepare_head()
$head[$h][1] = $langs->trans("Payments");
$head[$h][2] = 'payment';
$h++;
if($conf->global->INVOICE_USE_SITUATION){
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -40,7 +40,7 @@ function loan_prepare_head($object)
$head[$tab][1] = $langs->trans('Card');
$head[$tab][2] = 'card';
$tab++;
$head[$tab][0] = DOL_URL_ROOT.'/loan/schedule.php?loanid='.$object->id;
$head[$tab][1] = $langs->trans('FinancialCommitment');
$head[$tab][2] = 'FinancialCommitment';

View File

@ -127,7 +127,7 @@ function member_type_prepare_head(AdherentType $object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS))
{

View File

@ -55,7 +55,7 @@ function dol_setcache($memoryid, $data)
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$dolmemcache->add($memoryid, $data); // This fails if key already exists
@ -79,7 +79,7 @@ function dol_setcache($memoryid, $data)
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result=$dolmemcache->add($memoryid, $data); // This fails if key already exists
@ -122,7 +122,7 @@ function dol_getcache($memoryid)
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
//print "Get memoryid=".$memoryid;
@ -149,7 +149,7 @@ function dol_getcache($memoryid)
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data=$m->get($memoryid);

View File

@ -479,6 +479,22 @@ function show_stats_for_company($product, $socid)
return $nblines++;
}
/**
* Return translation label of a unit key.
* Function kept for backward compatibility.
*
* @param string $scale Scale of unit: '0', '-3', '6', ...
* @param string $measuring_style Style of unit: weight, volume,...
* @param int $unit ID of unit (rowid in llx_c_units table)
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
* @return string Unit string
* @see measuringUnitString() formproduct->selectMeasuringUnits()
*/
function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $use_short_label = 0)
{
return measuringUnitString($unit, $measuring_style, $scale, $use_short_label);
}
/**
* Return translation label of a unit key
*
@ -487,9 +503,9 @@ function show_stats_for_company($product, $socid)
* @param string $scale Scale of unit: '0', '-3', '6', ...
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
* @return string Unit string
* @see formproduct->selectMeasuringUnits
* @see formproduct->selectMeasuringUnits()
*/
function measuring_units_string($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
{
global $langs, $db;
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';

View File

@ -113,7 +113,7 @@ class MenuManager
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu);
$this->tabMenu=$tabMenu;
//var_dump($tabMenu);
//if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; }
}
@ -152,7 +152,7 @@ class MenuManager
if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
}
if ($mode == 'topnb')
{
print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
@ -327,7 +327,7 @@ class MenuManager
}
unset($this->menu);
//print 'xx'.$mode;
return 0;
}

View File

@ -65,7 +65,7 @@ class MenuManager
public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
{
global $conf, $user, $langs;
// On sauve en session le menu principal choisi
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];

View File

@ -509,12 +509,12 @@ class pdf_espadon extends ModelePdfExpedition
$weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
{
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
}
$voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
{
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
}

View File

@ -525,12 +525,12 @@ class pdf_rouget extends ModelePdfExpedition
$weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
{
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
}
$voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
{
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
}
if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))

View File

@ -25,7 +25,7 @@
/**
* \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
* \ingroup ficheinter
* \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil
* \brief File of Class to build interventions documents with model Soleil
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -142,7 +142,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->option_condreg = 0; // Display payment terms
$this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
// Get source company
$this->emetteur=$mysoc;
@ -266,7 +266,7 @@ class pdf_soleil extends ModelePDFFicheinter
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
// Display notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
@ -394,7 +394,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@ -573,7 +573,7 @@ class pdf_soleil extends ModelePDFFicheinter
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK);
}
//Prepare la suite
//Prepare next
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -82,7 +82,7 @@ class mod_arctic extends ModeleNumRefFicheinter
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
$tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix
// Setting the prefix
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
// On défini critere recherche compteur
// We define the search criteria of the counter
$mask=$conf->global->FICHINTER_ARTIC_MASK;
if (! $mask)

View File

@ -164,7 +164,12 @@ class modFicheinter extends DolibarrModules
's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",
'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote", 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'InterLineId',
'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote");
$keyforselect='fichinter'; $keyforelement='intervention'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_fields_array[$r]+=array(
'pj.ref'=>'ProjectRef','pj.title'=>'ProjectLabel',
'fd.rowid'=>'InterLineId',
'fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"
);
//$this->export_TypeFields_array[$r]=array(
@ -175,24 +180,30 @@ class modFicheinter extends DolibarrModules
// 'fd.total_ht'=>"Numeric"
//);
$this->export_TypeFields_array[$r]=array(
's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text',
's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",
'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean", 'pj.ref'=>'Text',
'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric"
's.rowid'=>"Numeric",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text',
's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'f.rowid'=>'Numeric','f.ref'=>"Text",'f.datec'=>"Date",
'f.duree'=>"Duree",'f.fk_statut'=>'Numeric','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",
'pj.ref'=>'Text','pj.title'=>'Text',
'fd.rowid'=>"Numeric",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric"
);
$this->export_entities_array[$r]=array(
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company',
's.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",
'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",
'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",
'fd.duree'=>'inter_line','fd.description'=>'inter_line'
);
$this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='fichinterdet'; $keyforelement='inter_line'; $keyforaliasextra='extradet';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter,';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet_extrafields as extradet ON fd.rowid = extradet.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention').')';

View File

@ -85,7 +85,7 @@ class modProduct extends DolibarrModules
$this->const[$r][3] = 'Module to control product codes';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "PRODUCT_PRICE_UNIQ";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
@ -182,7 +182,8 @@ class modProduct extends DolibarrModules
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.length_units'=>"SizeUnits",
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
'p.duration'=>"Duration",
'p.finished' => 'Nature',
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",

View File

@ -198,7 +198,7 @@ class pdf_cyan extends ModelePDFPropales
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Translations
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));

View File

@ -450,12 +450,12 @@ class pdf_squille extends ModelePdfReception
$weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
{
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->weight_units, "weight");
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->product->weight_units);
}
$voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
{
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0, "volume");
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0);
}
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');

View File

@ -55,22 +55,10 @@ elseif ($modulepart == 'project')
}
elseif ($modulepart == 'bom')
{
$result=restrictedArea($user, 'bom', $id, 'bom_bom');
$result=restrictedArea($user, $modulepart, $id, 'bom_bom');
if (! $user->rights->bom->read) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'expensereport')
{
$result=restrictedArea($user, 'expensereport', $id, 'expensereport');
if (! $user->rights->expensereport->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'holiday')
{
$result=restrictedArea($user, 'holiday', $id, 'holiday');
if (! $user->rights->holiday->read) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'member')
{
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
@ -79,26 +67,26 @@ elseif ($modulepart == 'member')
}
elseif ($modulepart == 'user')
{
$result=restrictedArea($user, 'user', $id, 'user');
$result=restrictedArea($user, $modulepart, $id, $modulepart);
if (! $user->rights->user->user->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'societe')
{
$result=restrictedArea($user, 'societe', $id, 'societe');
if (! $user->rights->societe->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'tax')
{
$result=restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
$result=restrictedArea($user, $modulepart, $id, 'chargesociales', 'charges');
if (! $user->rights->tax->charges->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'ticket')
elseif ($modulepart == 'bank')
{
$result=restrictedArea($user, 'ticket', $id, 'ticket');
if (! $user->rights->ticket->read) accessforbidden();
$result=restrictedArea($user, 'banque', $id, 'bank_account');
if (! $user->rights->banque->lire) accessforbidden();
$accessallowed=1;
}
else // ticket, holiday, expensereport, societe...
{
$result=restrictedArea($user, $modulepart, $id, $modulepart);
if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden();
$accessallowed=1;
}
@ -142,7 +130,7 @@ elseif ($modulepart == 'holiday')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->holiday->dir_output; // By default
$dir=$conf->$modulepart->dir_output; // By default
}
}
elseif ($modulepart == 'member')
@ -164,7 +152,7 @@ elseif ($modulepart == 'societe')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->societe->dir_output;
$dir=$conf->$modulepart->dir_output;
}
}
elseif ($modulepart == 'user')
@ -175,7 +163,7 @@ elseif ($modulepart == 'user')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->user->dir_output; // By default
$dir=$conf->$modulepart->dir_output; // By default
}
}
elseif ($modulepart == 'expensereport')
@ -197,7 +185,7 @@ elseif ($modulepart == 'tax')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->tax->dir_output; // By default
$dir=$conf->$modulepart->dir_output; // By default
}
}
elseif ($modulepart == 'ticket')
@ -208,7 +196,7 @@ elseif ($modulepart == 'ticket')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->ticket->dir_output; // By default
$dir=$conf->$modulepart->dir_output; // By default
}
}
elseif ($modulepart == 'bom')
@ -219,7 +207,18 @@ elseif ($modulepart == 'bom')
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->bom->dir_output; // By default
$dir=$conf->$modulepart->dir_output; // By default
}
}
elseif ($modulepart == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object = new Account($db);
if ($id > 0)
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir=$conf->banque->dir_output; // By default
}
}
else {
@ -237,6 +236,7 @@ if (empty($backtourl))
elseif (in_array($modulepart, array('tax'))) $backtourl=DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
elseif (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
elseif (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
elseif (in_array($modulepart, array('bank'))) $backtourl=DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else $backtourl=DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]);
}
@ -422,6 +422,7 @@ print '<br>'."\n";
print '<!-- Form to resize -->'."\n";
print '<form name="redim_file" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<fieldset id="redim_file">';
print '<legend>'.$langs->trans("Resize").'</legend>';
@ -472,7 +473,9 @@ if (! empty($conf->use_javascript_ajax))
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$object->entity.'&file='.urlencode($original_file).'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>';
print '</div>';
print '</div><br>';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '
<div class="jc_coords">
'.$langs->trans("NewSizeAfterCropping").':
<label>X1 <input type="number" class="flat maxwidth50" id="x" name="x" /></label>

View File

@ -50,7 +50,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
$value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1);
//var_dump($value);
}
print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey);
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -23,8 +23,15 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
$align=$extrafields->getAlignFlag($key);
$sortonfield = $extrafieldsobjectprefix.$key;
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
else print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder)."\n";
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
print '<th class="liste_titre thseparator"></th>';
}
else
{
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', 0, $tooltip)."\n";
}
}
}
}

View File

@ -85,6 +85,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
else
{
$value = $object->array_options["options_" . $key];
//var_dump($key.' - '.$value);
}
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
{
@ -178,7 +179,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
}
else
{
//print $key.'-'.$value.'-'.$object->table_element;
//var_dump($key.'-'.$value.'-'.$object->table_element);
print $extrafields->showOutputField($key, $value, '', $object->table_element);
}

View File

@ -138,22 +138,20 @@ if ($nolinesbefore) {
print '<td class="linecolcycleref2 right"></td>';
}
if (! empty($usemargins))
{
if (!empty($user->rights->margins->creer)) {
?>
<td class="margininfos linecolmargin1 right">
<?php
if (empty($user->rights->margins->creer)) {
$colspan++;
}
else {
print '<td class="margininfos linecolmargin1 right">';
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
echo '</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
}
else $colspan++;
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
echo '</td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
}
?>
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td>
@ -438,20 +436,16 @@ if ($nolinesbefore) {
{
if (!empty($user->rights->margins->creer)) {
$coldisplay++;
?>
<td class="nobottom margininfos linecolmargin right">
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select>
<?php } ?>
<!-- For free product -->
<input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
</td>
<?php
}
if ($user->rights->margins->creer)
{
?>
<td class="nobottom margininfos linecolmargin right">
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp" style="display: none;"></select>
<?php } ?>
<!-- For free product -->
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
</td>
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
{
echo '<td class="nobottom nowrap margininfos right"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate", 'alpha', 2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>';

View File

@ -217,10 +217,10 @@ $coldisplay=0;
<td class="margininfos right">
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select>
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp right" style="display: none;"></select>
<?php } ?>
<!-- For free product -->
<input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
<input class="flat maxwidth75 right" type="text" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
</td>
<?php }
@ -232,7 +232,7 @@ $coldisplay=0;
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
@ -242,7 +242,7 @@ $coldisplay=0;
if ($line->subprice < 0)
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
else
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++;
}
}

View File

@ -131,7 +131,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ret = 0;
// First classify billed the order to allow the proposal classify process
if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
{
@ -175,7 +175,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
}
return $ret;
}

View File

@ -6,7 +6,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -62,7 +62,15 @@ class Don extends CommonObject
*/
public $picto = 'generic';
/**
* @var string Date of the donation
*/
public $date;
/**
* amount of donation
* @var double
*/
public $amount;
/**
@ -133,7 +141,7 @@ class Don extends CommonObject
/**
* Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
* Returns the donation status label (draft, valid, abandoned, paid)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
@ -145,7 +153,7 @@ class Don extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/don/class/dontats.class.php
* \file htdocs/don/class/donstats.class.php
* \ingroup donations
* \brief File of class to manage donations statistics
*/
@ -39,11 +39,22 @@ class DonationStats extends Stats
*/
public $table_element;
public $socid;
public $socid;
public $userid;
/**
* @var string FROM
*/
public $from;
/**
* @var string field
*/
public $field;
/**
* @var string WHERE
*/
public $where;

View File

@ -211,7 +211,7 @@ if ($resql)
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "fk_projet", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');

View File

@ -379,7 +379,7 @@ if (empty($reshook))
if (! $error)
{
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
$ret=$object->create($user); // This create shipment (like Odoo picking) and lines of shipments. Stock movement will be done when validating shipment.
if ($ret <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -994,7 +994,7 @@ if ($action == 'create')
print '<tr><td>';
print $langs->trans("Weight");
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'));
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'), 0, 2);
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
print $form->textwithpicto($text, $htmltext);
print '</td></tr>';
@ -1005,7 +1005,7 @@ if ($action == 'create')
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
print ' ';
$text=$formproduct->selectMeasuringUnits("size_units", "size");
$text=$formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
print $form->textwithpicto($text, $htmltext);
print '</td></tr>';
@ -1707,7 +1707,6 @@ elseif ($id || $ref)
// Print form confirm
print $formconfirm;
// Calculate totalWeight and totalVolume for all products
// by adding weight and volume of each product line.
$tmparray=$object->getTotalWeightVolume();
@ -1850,16 +1849,14 @@ elseif ($id || $ref)
else
{
print $object->trueWeight;
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string(0, "weight", $object->weight_units):'';
print ($object->trueWeight && $object->weight_units!='')?' '.measuringUnitString(0, "weight", $object->weight_units):'';
}
// Calculated
if ($totalWeight > 0)
{
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
//print $totalWeight.' '.measuring_units_string(0, "weight");
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
if (!empty($object->trueWeight)) print ')';
}
print '</td></tr>';
@ -1867,7 +1864,7 @@ elseif ($id || $ref)
// Width
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string(0, "size", $object->width_units):'';
print ($object->trueWidth && $object->width_units!='')?' '.measuringUnitString(0, "size", $object->width_units):'';
print '</td></tr>';
// Height
@ -1887,7 +1884,7 @@ elseif ($id || $ref)
else
{
print $object->trueHeight;
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string(0, "size", $object->height_units):'';
print ($object->trueHeight && $object->height_units!='')?' '.measuringUnitString(0, "size", $object->height_units):'';
}
print '</td></tr>';
@ -1895,7 +1892,7 @@ elseif ($id || $ref)
// Depth
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string(0, "size", $object->depth_units):'';
print ($object->trueDepth && $object->depth_units!='')?' '.measuringUnitString(0, "size", $object->depth_units):'';
print '</td></tr>';
// Volume
@ -1915,15 +1912,13 @@ elseif ($id || $ref)
{
if ($volumeUnit < 50)
{
//print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
}
else print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
}
if ($totalVolume > 0)
{
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
//print $totalVolume.' '.measuring_units_string(0, "volume");
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
if ($calculatedVolume) print ')';
@ -2199,6 +2194,20 @@ elseif ($id || $ref)
$product_static->id=$lines[$i]->fk_product;
$product_static->ref=$lines[$i]->ref;
$product_static->status_batch=$lines[$i]->product_tobatch;
$product_static->weight=$lines[$i]->weight;
$product_static->weight_units=$lines[$i]->weight_units;
$product_static->length=$lines[$i]->length;
$product_static->length_units=$lines[$i]->length_units;
$product_static->width=$lines[$i]->width;
$product_static->width_units=$lines[$i]->width_units;
$product_static->height=$lines[$i]->height;
$product_static->height_units=$lines[$i]->height_units;
$product_static->surface=$lines[$i]->surface;
$product_static->surface_units=$lines[$i]->surface_units;
$product_static->volume=$lines[$i]->volume;
$product_static->volume_units=$lines[$i]->volume_units;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$label;
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description));
@ -2252,7 +2261,7 @@ elseif ($id || $ref)
if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0)
{
$warehousestatic->fetch($shipmentline_var['warehouse']);
$htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1);
$htmltext .= '<br>'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
}
print ' '.$form->textwithpicto('', $htmltext, 1);
}
@ -2409,18 +2418,18 @@ elseif ($id || $ref)
// Weight
print '<td class="center linecolweight">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "weight", $lines[$i]->weight_units);
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "weight", $lines[$i]->weight_units);
else print '&nbsp;';
print '</td>';
// Volume
print '<td class="center linecolvolume">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "volume", $lines[$i]->volume_units);
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units);
else print '&nbsp;';
print '</td>';
// Size
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume").'</td>';
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units).'</td>';
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
@ -2433,10 +2442,10 @@ elseif ($id || $ref)
{
// edit-delete buttons
print '<td class="linecoledit center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
print '</td>';
print '<td class="linecoldelete" width="10">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=deleteline&amp;lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=deleteline&amp;lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
print '</td>';
// Display lines extrafields

View File

@ -324,8 +324,8 @@ class Expedition extends CommonObject
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
$sql.= ", ".($this->weight_units>0?$this->weight_units:'NULL');
$sql.= ", ".($this->size_units>0?$this->size_units:'NULL');
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");

View File

@ -42,7 +42,7 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propa
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Load translation files required by the page
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm'));
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm','other'));
$id = GETPOST('id', 'int'); // id of order
$ref = GETPOST('ref', 'alpha');
@ -618,7 +618,9 @@ if ($id > 0 || ! empty($ref))
$sql.= ' cd.date_start,';
$sql.= ' cd.date_end,';
$sql.= ' cd.special_code,';
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc';
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,';
$sql.= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
$sql.= ' p.surface, p.surface_units, p.volume, p.volume_units';
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.fk_commande = ".$object->id;
@ -705,6 +707,20 @@ if ($id > 0 || ! empty($ref))
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->entity = $objp->entity;
$product_static->weight=$objp->weight;
$product_static->weight_units=$objp->weight_units;
$product_static->length=$objp->length;
$product_static->length_units=$objp->length_units;
$product_static->width=$objp->width;
$product_static->width_units=$objp->width_units;
$product_static->height=$objp->height;
$product_static->height_units=$objp->height_units;
$product_static->surface=$objp->surface;
$product_static->surface_units=$objp->surface_units;
$product_static->volume=$objp->volume;
$product_static->volume_units=$objp->volume_units;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'<br>';

View File

@ -57,7 +57,7 @@ $confirm = GETPOST('confirm', 'alpha');
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int'));
$date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int'));
$fk_projet=GETPOST('fk_projet', 'int');
$fk_project=GETPOST('fk_project', 'int');
$vatrate=GETPOST('vatrate', 'alpha');
$ref=GETPOST("ref", 'alpha');
$comments=GETPOST('comments', 'none');
@ -145,7 +145,7 @@ if (empty($reshook))
}
$action='';
$fk_projet='';
$fk_project='';
$date_start='';
$date_end='';
$date='';
@ -1232,7 +1232,7 @@ if (empty($reshook))
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
// Insert line
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_project, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
if ($result > 0)
{
$ret = $object->fetch($object->id); // Reload to get new records
@ -1257,7 +1257,7 @@ if (empty($reshook))
unset($vatrate);
unset($comments);
unset($fk_c_type_fees);
unset($fk_projet);
unset($fk_project);
unset($date);
} else {
@ -1334,7 +1334,7 @@ if (empty($reshook))
$rowid = $_POST['rowid'];
$type_fees_id = GETPOST('fk_c_type_fees', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
$projet_id = $fk_projet;
$projet_id = $fk_project;
$comments = GETPOST('comments', 'none');
$qty = GETPOST('qty', 'int');
$vatrate = GETPOST('vatrate', 'alpha');
@ -2372,7 +2372,7 @@ else
if (! empty($conf->projet->enabled))
{
print '<td>';
$formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
$formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
@ -2527,7 +2527,7 @@ else
if (! empty($conf->projet->enabled))
{
print '<td>';
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
$formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}

View File

@ -136,6 +136,51 @@ class ExpenseReport extends CommonObject
const STATUS_CLOSED = 6;
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20),
'ref_number_int' =>array('type'=>'integer', 'label'=>'Ref number int', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'ref_ext' =>array('type'=>'integer', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'date_debut' =>array('type'=>'date', 'label'=>'Date debut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>60),
'date_fin' =>array('type'=>'date', 'label'=>'Date fin', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>65),
'date_valid' =>array('type'=>'datetime', 'label'=>'Date valid', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'date_refuse' =>array('type'=>'datetime', 'label'=>'Date refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'date_cancel' =>array('type'=>'datetime', 'label'=>'Date cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>100),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'fk_user_valid' =>array('type'=>'integer', 'label'=>'Fk user valid', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'fk_user_validator' =>array('type'=>'integer', 'label'=>'Fk user validator', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
'fk_user_approve' =>array('type'=>'integer', 'label'=>'Fk user approve', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'fk_user_refuse' =>array('type'=>'integer', 'label'=>'Fk user refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'fk_user_cancel' =>array('type'=>'integer', 'label'=>'Fk user cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_c_paiement' =>array('type'=>'integer', 'label'=>'Fk c paiement', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'paid' =>array('type'=>'integer', 'label'=>'Paid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145),
'note_public' =>array('type'=>'text', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150),
'note_private' =>array('type'=>'text', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'detail_refuse' =>array('type'=>'varchar(255)', 'label'=>'Detail refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'detail_cancel' =>array('type'=>'varchar(255)', 'label'=>'Detail cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'integration_compta' =>array('type'=>'integer', 'label'=>'Integration compta', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_bank_account' =>array('type'=>'integer', 'label'=>'Fk bank account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'model_pdf' =>array('type'=>'varchar(50)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>220),
'date_create' =>array('type'=>'datetime', 'label'=>'Date create', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>300),
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305),
'fk_statut' =>array('type'=>'integer', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
);
/**
* Constructor

View File

@ -1198,7 +1198,7 @@ if ($step == 5 && $datatoexport)
}
}
}
print '<td>'.(! empty($list)?$list:$langs->trans("None")).'</td>';
print '<td>'.(! empty($list)?$list:'<span class="opacitymedium">'.$langs->trans("None").'</span>').'</td>';
print '</tr>';
}

View File

@ -158,12 +158,10 @@ if ($action == 'add') {
// on récupère les enregistrements
$object->fetch($id);
// on transfert les données de l'un vers l'autre
if ($object->socid > 0) {
$newinter->socid=$object->socid;
$newinter->fk_projet=$object->fk_projet;
$newinter->fk_project=$object->fk_projet;
$newinter->fk_project=$object->fk_project;
$newinter->fk_contrat=$object->fk_contrat;
} else {
$newinter->socid=GETPOST("socid");

View File

@ -1271,12 +1271,12 @@ elseif ($id > 0 || ! empty($ref))
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Contract');
print '</td>';
if ($action != 'contrat')
{
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=contrat&amp;id='.$object->id.'">';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=contrat&amp;id='.$object->id.'">';
print img_edit($langs->trans('SetContract'), 1);
print '</a></td>';
}

View File

@ -701,51 +701,36 @@ class Fichinter extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the label of a statut
* Returns the label of a status
*
* @param int $statut id statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// Init/load array of translation of status
if (empty($this->statuts) || empty($this->statuts_short))
if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo))
{
global $langs;
$langs->load("fichinter");
$this->statuts[0]=$langs->trans('Draft');
$this->statuts[1]=$langs->trans('Validated');
$this->statuts[2]=$langs->trans('StatusInterInvoiced');
$this->statuts[3]=$langs->trans('Done');
$this->statuts_short[0]=$langs->trans('Draft');
$this->statuts_short[1]=$langs->trans('Validated');
$this->statuts_short[2]=$langs->trans('StatusInterInvoiced');
$this->statuts_short[3]=$langs->trans('Done');
$this->statuts_logo[0]='statut0';
$this->statuts_logo[1]='statut1';
$this->statuts_logo[2]='statut6';
$this->statuts_logo[3]='statut6';
$this->statuts[self::STATUS_DRAFT]=$langs->trans('Draft');
$this->statuts[self::STATUS_VALIDATED]=$langs->trans('Validated');
$this->statuts[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
$this->statuts[self::STATUS_CLOSED]=$langs->trans('Done');
$this->statuts_short[self::STATUS_DRAFT]=$langs->trans('Draft');
$this->statuts_short[self::STATUS_VALIDATED]=$langs->trans('Validated');
$this->statuts_short[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
$this->statuts_short[self::STATUS_CLOSED]=$langs->trans('Done');
$this->statuts_logo[self::STATUS_DRAFT]='status0';
$this->statuts_logo[self::STATUS_VALIDATED]='status1';
$this->statuts_logo[self::STATUS_BILLED]='status6';
$this->statuts_logo[self::STATUS_CLOSED]='status6';
}
if ($mode == 0)
return $this->statuts[$statut];
elseif ($mode == 1)
return $this->statuts_short[$statut];
elseif ($mode == 2)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts_short[$statut];
elseif ($mode == 3)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]);
elseif ($mode == 4)
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts[$statut];
elseif ($mode == 5)
return '<span class="hideonsmartphone">'.$this->statuts_short[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
elseif ($mode == 6)
return '<span class="hideonsmartphone">'.$this->statuts[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
return '';
return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode);
}
/**

View File

@ -116,13 +116,16 @@ $arrayfields=array(
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*

View File

@ -1106,12 +1106,19 @@ if (empty($reshook))
// If creation from another object of another module (Example: origin=propal, originid=1)
if (! empty($origin) && ! empty($originid))
{
if ($origin == 'order' || $origin == 'commande')
if ($origin == 'propal' || $origin == 'proposal')
{
$classname = 'Propal';
$element = 'comm/propal'; $subelement = 'propal';
}
elseif ($origin == 'order' || $origin == 'commande')
{
$classname = 'Commande';
$element = $subelement = 'commande';
}
else
{
$classname = 'SupplierProposal';
$element = 'supplier_proposal';
$subelement = 'supplier_proposal';
}
@ -1131,7 +1138,6 @@ if (empty($reshook))
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = 'SupplierProposal';
$srcobject = new $classname($db);
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
@ -1167,7 +1173,6 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
// trigger used
{
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options;
@ -1442,7 +1447,7 @@ llxHeader('', $langs->trans("Order"), $help_url);
$now=dol_now();
if ($action=='create')
{
print load_fiche_titre($langs->trans('NewOrder'));
print load_fiche_titre($langs->trans('NewOrderSupplier'));
dol_htmloutput_events();
@ -1459,17 +1464,31 @@ if ($action=='create')
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
$regs=array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
$element = $regs[1];
$subelement = $regs[2];
}
$element = 'supplier_proposal';
$subelement = 'supplier_proposal';
if ($origin == 'propal' || $origin == 'proposal')
{
$classname = 'Propal';
$element = 'comm/propal'; $subelement = 'propal';
}
elseif ($origin == 'order' || $origin == 'commande')
{
$classname = 'Commande';
$element = $subelement = 'commande';
}
else
{
$classname = 'SupplierProposal';
$element = 'supplier_proposal';
$subelement = 'supplier_proposal';
}
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = 'SupplierProposal';
$objectsrc = new $classname($db);
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))

View File

@ -376,9 +376,9 @@ if (! $search_all)
$sql.= ' country.code,';
$sql.= " p.rowid, p.ref, p.title";
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) //prevent error with sql_mode=only_full_group_by
{
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
$sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ",ef.".$key : '');
}
}
else

View File

@ -42,15 +42,15 @@ $list = array (
*/
if ($action == 'update') {
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -87,13 +87,13 @@ print "</tr>\n";
foreach ($list as $key) {
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
$label = $langs->trans($key);
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';

View File

@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
-- For v11
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
ALTER TABLE llx_rights_def ADD COLUMN family_position INTEGER NOT NULL DEFAULT 0;
@ -378,3 +380,33 @@ create table llx_fichinterdet_rec
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL AFTER product_type;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL AFTER date_start;
--List of parcels details related to an expedition
create table llx_expedition_package
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_expedition integer NOT NULL,
description varchar(255), --Description of goods in the package (required by the custom)
value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom)
fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other)
height float, -- height
width float, -- width
size float, -- depth
size_units integer, -- unit of all sizes (height, width, depth)
weight float, -- weight
weight_units integer, -- unit of weight
dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough.
tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line.
rang integer DEFAULT 0
)ENGINE=innodb;
--Dictionary of package type
create table llx_c_shipment_package_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(50) NOT NULL, -- Short name
description varchar(255), -- Description
active integer DEFAULT 1 NOT NULL, -- Active or not
entity integer DEFAULT 1 NOT NULL -- Multi company id
)ENGINE=innodb;

View File

@ -0,0 +1,9 @@
--Dictionary of package type
create table llx_c_shipment_package_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(50) NOT NULL, -- Short name
description varchar(255), -- Description
active integer DEFAULT 1 NOT NULL, -- Active or not
entity integer DEFAULT 1 NOT NULL -- Multi company id
)ENGINE=innodb;

View File

@ -0,0 +1,18 @@
--List of parcels details related to an expedition
create table llx_expedition_package
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_expedition integer NOT NULL,
description varchar(255), --Description of goods in the package (required by the custom)
value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom)
fk_package_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other)
height float, -- height
width float, -- width
size float, -- depth
size_units integer, -- unit of all sizes (height, width, depth)
weight float, -- weight
weight_units integer, -- unit of weight
dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough.
tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line.
rang integer DEFAULT 0
)ENGINE=innodb;

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