Merge remote-tracking branch 'Dolibarr/12.0' into 12

This commit is contained in:
Francis Appels 2020-06-11 17:16:58 +02:00
commit 4202a71381
95 changed files with 1188 additions and 654 deletions

View File

@ -1,10 +0,0 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@ -19,6 +19,7 @@ NEW: Accountancy - Add possibility to manage a short alternative label for accou
NEW: Accountancy - General ledger - Add an option to search not reconciled lines
NEW: Add accountancy code of thirdparty in contact and supplier export
NEW: support webp image format
NEW: Add checkbox "overwrite if exists" into ECM/DMS module
NEW: add a link to notes in members list
NEW: add a parameter to group same products in TakePOS
NEW: add a parameter to sort product by label in TakePOS

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -259,6 +259,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -335,10 +336,11 @@ $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
} else {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
}
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
@ -411,10 +413,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
} else {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
}
dol_syslog('htdocs/accountancy/customer/index.php');
@ -463,10 +466,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_SITUATION.")";
} else {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
}
dol_syslog('htdocs/accountancy/customer/index.php');

View File

@ -245,7 +245,7 @@ else
{
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print $langs->trans("Module10Desc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n";
}
// End of page

View File

@ -248,6 +248,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ff
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -318,6 +319,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ff
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -388,6 +390,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/supplier/index.php');

View File

@ -243,18 +243,16 @@ if (empty($reshook))
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$birthdate = '';
if (isset($_POST["birthday"]) && $_POST["birthday"]
&& isset($_POST["birthmonth"]) && $_POST["birthmonth"]
&& isset($_POST["birthyear"]) && $_POST["birthyear"])
if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int'))
{
$birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
$birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
}
$lastname = $_POST["lastname"];
$firstname = $_POST["firstname"];
$gender = $_POST["gender"];
$societe = $_POST["societe"];
$morphy = $_POST["morphy"];
$login = $_POST["login"];
$lastname = GETPOST("lastname", 'alphanohtml');
$firstname = GETPOST("firstname", 'alphanohtml');
$gender = GETPOST("gender", 'alphanohtml');
$societe = GETPOST("societe", 'alphanohtml');
$morphy = GETPOST("morphy", 'alphanohtml');
$login = GETPOST("login", 'alphanohtml');
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
@ -284,19 +282,19 @@ if (empty($reshook))
$object->oldcopy = clone $object;
// Change values
$object->civility_id = trim(GETPOST("civility_id", 'alpha'));
$object->firstname = trim(GETPOST("firstname", 'alpha'));
$object->lastname = trim(GETPOST("lastname", 'alpha'));
$object->gender = trim(GETPOST("gender", 'alpha'));
$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
$object->firstname = trim(GETPOST("firstname", 'alphanohtml'));
$object->lastname = trim(GETPOST("lastname", 'alphanohtml'));
$object->gender = trim(GETPOST("gender", 'alphanohtml'));
$object->login = trim(GETPOST("login", 'alpha'));
$object->pass = trim(GETPOST("pass", 'alpha'));
$object->societe = trim(GETPOST("societe", 'alpha')); // deprecated
$object->company = trim(GETPOST("societe", 'alpha'));
$object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated
$object->company = trim(GETPOST("societe", 'alphanohtml'));
$object->address = trim(GETPOST("address", 'alpha'));
$object->zip = trim(GETPOST("zipcode", 'alpha'));
$object->town = trim(GETPOST("town", 'alpha'));
$object->address = trim(GETPOST("address", 'alphanohtml'));
$object->zip = trim(GETPOST("zipcode", 'alphanohtml'));
$object->town = trim(GETPOST("town", 'alphanohtml'));
$object->state_id = GETPOST("state_id", 'int');
$object->country_id = GETPOST("country_id", 'int');
@ -442,14 +440,14 @@ if (empty($reshook))
}
$typeid = GETPOST("typeid", 'int');
$civility_id = GETPOST("civility_id", 'alpha');
$lastname = GETPOST("lastname", 'alpha');
$firstname = GETPOST("firstname", 'alpha');
$gender = GETPOST("gender", 'alpha');
$societe = GETPOST("societe", 'alpha');
$address = GETPOST("address", 'alpha');
$zip = GETPOST("zipcode", 'alpha');
$town = GETPOST("town", 'alpha');
$civility_id = GETPOST("civility_id", 'alphanohtml');
$lastname = GETPOST("lastname", 'alphanohtml');
$firstname = GETPOST("firstname", 'alphanohtml');
$gender = GETPOST("gender", 'alphanohtml');
$societe = GETPOST("societe", 'alphanohtml');
$address = GETPOST("address", 'alphanohtml');
$zip = GETPOST("zipcode", 'alphanohtml');
$town = GETPOST("town", 'alphanohtml');
$state_id = GETPOST("state_id", 'int');
$country_id = GETPOST("country_id", 'int');
@ -465,9 +463,8 @@ if (empty($reshook))
$pass = GETPOST("password", 'alpha');
$photo = GETPOST("photo", 'alpha');
//$comment=GETPOST("comment",'none');
$morphy = GETPOST("morphy", 'alpha');
$subscription = GETPOST("subscription", 'alpha');
$public = GETPOST("public", 'alpha');
$morphy = GETPOST("morphy", 'alphanohtml');
$public = GETPOST("public", 'alphanohtml');
$userid = GETPOST("userid", 'int');
$socid = GETPOST("socid", 'int');
@ -976,7 +973,7 @@ else
print "</td>\n";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe', 'alpha') ?GETPOST('societe', 'alpha') : $object->company).'"></td></tr>';
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $object->company).'"></td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -984,39 +981,39 @@ else
print '</tr>';
// Lastname
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOST('lastname', 'alpha') ?GETPOST('lastname', 'alpha') : $object->lastname).'"></td>';
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET('lastname') ? GETPOST('lastname', 'alphanohtml') : $object->lastname).'"></td>';
print '</tr>';
// Firstname
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOST('firstname', 'alpha') ?GETPOST('firstname', 'alpha') : $object->firstname).'"></td>';
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET('firstname') ? GETPOST('firstname', 'alphanohtml') : $object->firstname).'"></td>';
print '</tr>';
// Gender
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1);
print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1);
print '</td></tr>';
// EMail
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>';
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="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
// Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOST('address', 'alphanohtml') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((GETPOST('zipcode', 'alphanohtml') ?GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' ';
print $formcompany->select_ziptown((GETPOST('town', 'alphanohtml') ?GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>';
// Country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
print $form->select_country(GETPOST('country_id', 'alpha') ?GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -1026,7 +1023,7 @@ else
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($object->country_id)
{
print $formcompany->select_state(GETPOST('state_id', 'int') ?GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
}
else
{
@ -1036,18 +1033,18 @@ else
}
// Pro phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
// Personal phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
// Mobile phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) break;
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOST('member_'.$key, 'alpha') ?GETPOST('member_'.$key, 'alpha') : $object->socialnetworks[$key]).'"></td></tr>';
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOSTISSET('member_'.$key) ? GETPOST('member_'.$key, 'alpha') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
@ -1196,14 +1193,14 @@ else
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ?GETPOST("morphy", 'alpha') : $object->morphy));
print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ? GETPOST("morphy", 'alpha') : $object->morphy));
print "</td></tr>";
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
if ($user->rights->adherent->creer)
{
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ?GETPOST("typeid", 'int') : $object->typeid));
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $object->typeid));
}
else
{
@ -1213,27 +1210,27 @@ else
print "</td></tr>";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"]) ?GETPOST("societe", '', 2) : $object->company).'"></td></tr>';
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET("societe") ? GETPOST("societe", 'alphanohtml', 2) : $object->company).'"></td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
print $formcompany->select_civility(isset($_POST["civility_id"]) ? $_POST["civility_id"] : $object->civility_id)."\n";
print $formcompany->select_civility(GETPOSTISSET("civility_id") ? GETPOST("civility_id", 'alpha') : $object->civility_id)."\n";
print '</td>';
print '</tr>';
// Lastname
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(isset($_POST["lastname"]) ?GETPOST("lastname", '', 2) : $object->lastname).'"></td>';
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET("lastname") ? GETPOST("lastname", 'alphanohtml', 2) : $object->lastname).'"></td>';
print '</tr>';
// Firstname
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(isset($_POST["firstname"]) ?GETPOST("firstname", '', 3) : $object->firstname).'"></td>';
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET("firstname") ? GETPOST("firstname", 'alphanohtml', 3) : $object->firstname).'"></td>';
print '</tr>';
// Gender
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
print $form->selectarray('gender', $arraygender, GETPOSTISSET('gender') ? GETPOST('gender', 'alphanohtml') : $object->gender, 1);
print '</td></tr>';
// Photo
@ -1256,14 +1253,14 @@ else
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(isset($_POST["address"]) ?GETPOST("address", '', 2) : $object->address).'</textarea>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml', 2) : $object->address).'</textarea>';
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((isset($_POST["zipcode"]) ?GETPOST("zipcode", '', 2) : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode", 'alphanohtml', 2) : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' ';
print $formcompany->select_ziptown((isset($_POST["town"]) ?GETPOST("town", '', 2) : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town", 'alphanohtml', 2) : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>';
// Country
@ -1282,18 +1279,18 @@ else
}
// Pro phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
// Personal phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
// Mobile phone
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>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) break;
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(isset($_POST[$key]) ?GETPOST($key) : $object->socialnetworks[$key]).'"></td></tr>';
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
@ -1304,7 +1301,7 @@ else
// Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public", (isset($_POST["public"]) ?GETPOST("public", '', 2) : $object->public), 1);
print $form->selectyesno("public", (GETPOSTISSET("public") ? GETPOST("public", 'alphanohtml', 2) : $object->public), 1);
print "</td></tr>\n";
// Categories

View File

@ -185,7 +185,7 @@ if ($action == 'delete')
$form = new Form($db);
$formadmin = new FormAdmin($db);
$wikihelp = 'EN:Setup|FR:Paramétrage|ES:Configuración';
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode;

View File

@ -168,6 +168,7 @@ if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->tran
if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject');
if ($conf->ticket->enabled) $elementList['ticket_send'] = $langs->trans('MailToTicket');
$elementList['user'] = $langs->trans('MailToUser');
$parameters = array('elementList'=>$elementList);

View File

@ -118,6 +118,7 @@ if ($action == 'install')
// $original_file should match format module_modulename-x.y[.z].zip
$original_file = basename($_FILES["fileinstall"]["name"]);
$original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file);
$newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
if (!$original_file)

View File

@ -383,10 +383,13 @@ print '</table>';
print '<br>';
$virtualdiffersfromphysical = 0;
if (
!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
) {
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled))
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}

View File

@ -197,7 +197,7 @@ if ($action == 'delete')
$form = new Form($db);
$formadmin = new FormAdmin($db);
$wikihelp = 'EN:Setup|FR:Paramétrage|ES:Configuración';
$wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode;
@ -358,9 +358,9 @@ if ($mode == 'overwrite')
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
{
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '<input type="submit" class="button buttongen" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '<input type="submit" class="button buttongen" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
}
else
{

View File

@ -46,7 +46,7 @@ function blockedlogadmin_prepare_head()
$b = new BlockedLog($db);
if ($b->alreadyUsed())
{
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">...</span>' : '');
}
$head[$h][2] = 'fingerprints';
$h++;

View File

@ -90,7 +90,7 @@ function bomPrepareHead($object)
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note';
$h++;
}
@ -102,7 +102,7 @@ function bomPrepareHead($object)
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
$head[$h][2] = 'document';
$h++;

View File

@ -430,7 +430,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$s .= '</script>'."\n";
// Local calendar
$s .= '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
$s .= '<div class="nowrap inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
// External calendars
if (is_array($showextcals) && count($showextcals) > 0)

View File

@ -333,7 +333,6 @@ class Account extends CommonObject
public function __toString()
{
$string = '';
foreach ($this->getFieldsToShow() as $val) {
if ($val == 'BankCode') {
$string .= $this->code_banque.' ';

View File

@ -422,7 +422,11 @@ class PaymentVarious extends CommonObject
$sign * abs($this->amount),
$this->num_payment,
($this->category_transaction > 0 ? $this->category_transaction : 0),
$user
$user,
'',
'',
'',
$this->datev
);
// Update fk_bank into llx_paiement.

View File

@ -1137,6 +1137,11 @@ if (empty($reshook))
}
$id = $object->create($user);
// NOTE: Pb with situation invoice
// NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total
// NOTE: fields total on credit note are stored as delta both on total of lines and on invoice total (good)
// NOTE: fields situation_percent on situation invoice are stored as cumulative values on lines (bad)
// NOTE: fields situation_percent on credit note are stored as delta on lines (good)
if (GETPOST('invoiceAvoirWithLines', 'int') == 1 && $id > 0)
{
if (!empty($facture_source->lines))
@ -1157,17 +1162,17 @@ if (empty($reshook))
}
if ($facture_source->type == Facture::TYPE_SITUATION)
{
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
$line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from
$line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from
if (!empty($facture_source->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
// search the last standard invoice in cycle and the possible credit note between this last and facture_source
// TODO Move this out of loop of $facture_source->lines
$tab_jumped_credit_notes = array();
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while ($searchPreviousInvoice)
{
@ -1178,11 +1183,13 @@ if (empty($reshook))
}
else
{
if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) {
$tab_jumped_credit_notes[$lineIndex] = $facture_source->tab_previous_situation_invoice[$lineIndex]->id;
}
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach ($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
@ -1206,6 +1213,36 @@ if (empty($reshook))
// prorata
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
//print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
// If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta)
$maxPrevSituationPercent = 0;
foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
foreach ($facture_source->tab_previous_situation_invoice[$index]->lines as $prevLine)
{
if ($prevLine->fk_prev_id == $source_fk_prev_id)
{
$maxPrevSituationPercent = $prevLine->situation_percent;
$line->total_ht -= $prevLine->total_ht;
$line->total_tva -= $prevLine->total_tva;
$line->total_ttc -= $prevLine->total_ttc;
$line->total_localtax1 -= $prevLine->total_localtax1;
$line->total_localtax2 -= $prevLine->total_localtax2;
$line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
$line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
$line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
$line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
}
}
}
// prorata
$line->situation_percent += $maxPrevSituationPercent;
//print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
}
}

View File

@ -1784,7 +1784,8 @@ class Facture extends CommonInvoice
}
/**
* Fetch previous and next situations invoices
* Fetch previous and next situations invoices.
* Return all previous and next invoices (both standard and credit notes).
*
* @return void
*/
@ -1795,7 +1796,7 @@ class Facture extends CommonInvoice
$this->tab_previous_situation_invoice = array();
$this->tab_next_situation_invoice = array();
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture';
$sql = 'SELECT rowid, type, situation_cycle_ref, situation_counter FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE rowid <> '.$this->id;
$sql .= ' AND entity = '.$this->entity;
$sql .= ' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref;

View File

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
if (!$user->rights->facture->lire) accessforbidden();
@ -44,6 +45,8 @@ $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
$type = GETPOST('type', 'aZ09');
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
@ -397,7 +400,13 @@ if ($object->id > 0)
print '</tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="3">';
print $object->thirdparty->display_rib();
$bac = new CompanyBankAccount($db);
$bac->fetch(0, $object->thirdparty->id);
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
print '</td></tr>';
print '</table>';
@ -493,7 +502,11 @@ if ($object->id > 0)
$sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$sql .= " ORDER BY pfd.date_demande DESC";
@ -508,11 +521,15 @@ if ($object->id > 0)
dol_print_error($db);
}
// For wich amount ?
// For which amount ?
$sql = "SELECT SUM(pfd.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$result_sql = $db->query($sql);
@ -543,10 +560,11 @@ if ($object->id > 0)
$remaintopaylesspendingdebit = $resteapayer - $pending;
print '<form method="POST" action="">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="id" value="'.$object->id.'" />';
print '<input type="hidden" name="action" value="new" />';
print '<label for="withdraw_request_amount">'.$langs->trans('WithdrawRequestAmount').' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="10" />';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
print '</form>';
}
@ -593,13 +611,17 @@ if ($object->id > 0)
print '<td>&nbsp;</td>';
print '</tr>';
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite, pfd.amount,";
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
$sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 0";
$sql .= " ORDER BY pfd.date_demande DESC";
@ -649,7 +671,11 @@ if ($object->id > 0)
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
$sql .= " WHERE fk_facture = ".$object->id;
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".$object->id;
} else {
$sql .= " WHERE fk_facture = ".$object->id;
}
$sql .= " AND pfd.traite = 1";
$sql .= " ORDER BY pfd.date_demande DESC";

View File

@ -174,35 +174,40 @@ if ($result)
$directdebitorder = new BonPrelevement($db);
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec;
$directdebitorder->amount = $obj->amount;
$directdebitorder->statut = $obj->statut;
$directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec;
$directdebitorder->amount = $obj->amount;
$directdebitorder->statut = $obj->statut;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td class="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td class="right"></td>'."\n";
print '<td class="right"></td>'."\n";
print "</tr>\n";
$i++;
print "</tr>\n";
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
}
print "</table>";
print '</div>';

View File

@ -292,7 +292,7 @@ if ($id > 0 || $ref)
print $form->selectDate('', '', '', '', '', "infocredit", 1, 1);
print '</td></tr>';
print '</table>';
print '<br>'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice");
print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("ClassCredited")).'"></div>';
print '</form>';
print '<br>';
@ -405,7 +405,7 @@ if ($id > 0 || $ref)
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>';
print '<td class="right">';
if ($obj->statut == 3)
{
@ -413,7 +413,24 @@ if ($id > 0 || $ref)
}
else
{
print "&nbsp;";
if ($object->statut == BonPrelevement::STATUS_CREDITED)
{
if ($obj->statut == 2) {
if ($user->rights->prelevement->bons->credit)
{
//print '<a class="butActionDelete" href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
print '<a href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
}
else
{
//print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
}
else
{
//print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
print '</td></tr>';

View File

@ -288,7 +288,7 @@ class BonPrelevement extends CommonObject
$sql .= ", p.method_trans, p.fk_user_trans";
$sql .= ", p.date_credit as date_credit";
$sql .= ", p.fk_user_credit";
$sql .= ", p.statut";
$sql .= ", p.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
if ($rowid > 0) $sql .= " AND p.rowid = ".$rowid;
@ -315,7 +315,8 @@ class BonPrelevement extends CommonObject
$this->date_credit = $this->db->jdate($obj->date_credit);
$this->user_credit = $obj->fk_user_credit;
$this->statut = $obj->statut;
$this->status = $obj->status;
$this->statut = $obj->status; // For backward compatibility
$this->fetched = 1;

View File

@ -66,14 +66,14 @@ class LignePrelevement
/**
* Recupere l'objet prelevement
*
* @param int $rowid id de la facture a recuperer
* @return integer
* @param int $rowid Id de la facture a recuperer
* @return integer <0 if KO, >=0 if OK
*/
public function fetch($rowid)
{
global $conf;
$result = 0;
$error = 0;
$sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
$sql .= ", pl.statut, pl.fk_soc";
@ -99,7 +99,7 @@ class LignePrelevement
}
else
{
$result++;
$error++;
dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
}
@ -107,12 +107,12 @@ class LignePrelevement
}
else
{
$result++;
$error++;
dol_syslog("LignePrelevement::Fetch rowid=$rowid");
dol_syslog($this->db->error());
}
return $result;
return $error;
}
/**

View File

@ -99,6 +99,9 @@ if (empty($reshook))
else
{
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
exit;
}
}
}
@ -141,8 +144,8 @@ print load_fiche_titre($title);
dol_fiche_head();
$nb = $bprev->NbFactureAPrelever();
$pricetowithdraw = $bprev->SommeAPrelever();
$nb = $bprev->nbOfInvoiceToPay($type);
$pricetowithdraw = $bprev->SommeAPrelever($type);
if ($nb < 0)
{
dol_print_error($bprev->error);
@ -178,19 +181,34 @@ if ($nb) {
if ($pricetowithdraw) {
print $langs->trans('ExecutionDate').' ';
print $form->selectDate();
if ($mysoc->isInEEC()) {
$title = $langs->trans("CreateForSepa");
print '<select name="format"><option value="FRST">'.$langs->trans('SEPAFRST').'</option><option value="RCUR">'.$langs->trans('SEPARCUR').'</option></select>';
print '<input class="butAction" type="submit" value="'.$langs->trans("CreateForSepa").'"/>';
print '<input class="butAction" type="submit" value="'.$title.'"/>';
} else {
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL">'.$langs->trans("CreateAll")."</a>\n";
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL&type='.$type.'">'.$title."</a>\n";
}
}
else
{
if ($mysoc->isInEEC())
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
$title = $langs->trans("CreateForSepaFRST");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
}
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
if ($type != 'bank-transfer') {
$title = $langs->trans("CreateForSepaRCUR");
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
}
}
else
{
@ -204,7 +222,13 @@ if ($nb) {
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
$titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$titlefortab = $langs->transnoentitiesnoconv("PaymentByBankTransfers");
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">'.$title."</a>\n";
}
print "</form>\n";
@ -236,9 +260,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
$sql .= " AND f.total_ttc > 0";
$sql .= " AND pfd.traite = 0";
if ($type == 'bank-transfer') {
$sql .= " AND pfd.fk_facture = f.rowid";
} else {
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pfd.fk_facture = f.rowid";
}
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
@ -299,23 +323,29 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
$bac->fetch(0, $obj->socid);
print '<tr class="oddeven">';
// Ref invoice
print '<td>';
$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
print $invoicestatic->getNomUrl(1, 'withdraw');
print '</td>';
// Thirdparty
print '<td>';
$thirdpartystatic->fetch($obj->socid);
print $thirdpartystatic->getNomUrl(1, 'ban');
print '</td>';
// RIB
print '<td>';
print $thirdpartystatic->display_rib();
$bac->fetch(0, $obj->socid);
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
print '</td>';
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');

View File

@ -199,14 +199,14 @@ print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'class="right"');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'class="center"');
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
print_liste_field_titre('');
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_facture" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column

View File

@ -38,7 +38,7 @@ $langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bill
if ($user->socid > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
@ -68,9 +68,9 @@ $thirdpartytmp = new Societe($db);
llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id > 0 || $ref)
if ($id > 0 || $ref)
{
if ($object->fetch($prev_id, $ref) >= 0)
if ($object->fetch($id, $ref) >= 0)
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
@ -183,7 +183,7 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$param = "&amp;id=".$prev_id;
$param = "&id=".$id;
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -195,7 +195,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
$massactionbutton = '';

View File

@ -124,11 +124,18 @@ if ($action == 'confirm_rejet')
$invoicestatic = new Facture($db);
llxHeader('', $langs->trans("StandingOrder"));
$title = $langs->trans("WithdrawalsLine");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLine");
}
llxHeader('', $title);
$head = array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id;
$head[$h][1] = $langs->trans("StandingOrder");
$head[$h][1] = $title;
$hselected = $h;
$h++;
@ -136,20 +143,24 @@ if ($id)
{
$lipre = new LignePrelevement($db);
if ($lipre->fetch($id) == 0)
if ($lipre->fetch($id) >= 0)
{
$bon = new BonPrelevement($db);
$bon->fetch($lipre->bon_rowid);
dol_fiche_head($head, $hselected, $langs->trans("StandingOrder"));
dol_fiche_head($head, $hselected, $title);
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
print '<tr><td width="20%">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $id.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
print $bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
if ($lipre->statut == 3)
{
@ -157,8 +168,8 @@ if ($id)
$resf = $rej->fetch($lipre->id);
if ($resf == 0)
{
print '<tr><td width="20%">'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("RefusedData").'</td><td>';
print '<tr><td>'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
print '<tr><td>'.$langs->trans("RefusedData").'</td><td>';
if ($rej->date_rejet == 0)
{
/* Historique pour certaines install */
@ -169,11 +180,11 @@ if ($id)
print dol_print_date($rej->date_rejet, 'day');
}
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
print '<tr><td>'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
}
else
{
print '<tr><td width="20%">'.$resf.'</td></tr>';
print '<tr><td>'.$resf.'</td></tr>';
}
}
@ -197,7 +208,7 @@ if ($id)
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_rejet">';
print '<table class="border centpercent">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>';
@ -217,13 +228,13 @@ if ($id)
//Reason
print '<tr><td class="fieldrequired valid">'.$langs->trans("RefusedReason").'</td>';
print '<td class="valid">';
print $form->selectarray("motif", $rej->motifs);
print $form->selectarray("motif", $rej->motifs, GETPOSTISSET('motif') ? GETPOST('motif', 'int') : '');
print '</td></tr>';
//Facturer
print '<tr><td class="valid">'.$langs->trans("RefusedInvoicing").'</td>';
print '<td class="valid" colspan="2">';
print $form->selectarray("facturer", $rej->facturer);
print $form->selectarray("facturer", $rej->facturer, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '');
print '</td></tr>';
print '</table><br>';
@ -242,20 +253,22 @@ if ($id)
if ($action == '')
{
if ($bon->statut == 2 && $lipre->statut == 2)
if ($bon->statut == BonPrelevement::STATUS_CREDITED)
{
if ($user->rights->prelevement->bons->credit)
{
print "<a class=\"butAction\" href=\"line.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
}
else
{
print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")."</a>";
if ($lipre->statut == 2) {
if ($user->rights->prelevement->bons->credit)
{
print '<a class="butActionDelete" href="line.php?action=rejet&id='.$lipre->id.'">'.$langs->trans("StandingOrderReject").'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}
}
else
{
print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")."</a>";
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine").'">'.$langs->trans("StandingOrderReject").'</a>';
}
}

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/compta/prelevement/list.php
* \ingroup prelevement
* \brief Page liste des prelevements
* \brief Page list of direct debit orders or credit transfers orders
*/
require '../../main.inc.php';
@ -96,23 +96,35 @@ $form = new Form($db);
llxHeader('', $langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec";
$sql .= " ,f.rowid as facid, f.ref as invoiceref, f.total_ttc";
$sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email";
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
}
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pf.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pf.fk_facture = f.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pf.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pf.fk_facture = f.rowid";
}
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql .= " AND s.rowid = ".$socid;
if ($search_line) $sql .= " AND pl.rowid = '".$db->escape($search_line)."'";
if ($search_bon) $sql .= natural_search("p.ref", $search_bon);
if ($search_code) $sql .= natural_search("s.code_client", $search_code);
if ($type == 'bank-transfer') {
if ($search_code) $sql .= natural_search("s.code_fourn", $search_code);
} else {
if ($search_code) $sql .= natural_search("s.code_client", $search_code);
}
if ($search_company) $sql .= natural_search("s.nom", $search_company);
$sql .= $db->order($sortfield, $sortorder);
@ -152,7 +164,11 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
$title = $langs->trans("WithdrawalsLines");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLines");
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
$moreforfilter = '';
@ -173,9 +189,14 @@ if ($result)
print '</td>';
print '</tr>';
$columntitle= "WithdrawalsReceipts";
if ($type == 'bank-transfer') {
$columntitle= "BankTransferReceipts";
}
print '<tr class="liste_titre">';
print_liste_field_titre($columntitle, $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center ');
@ -184,53 +205,58 @@ if ($result)
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$bon->ref = $obj->ref;
$bon->statut = $obj->status;
$bon->id = $obj->rowid;
$bon->ref = $obj->ref;
$bon->statut = $obj->status;
$company->id = $obj->socid;
$company->name = $obj->name;
$company->email = $obj->email;
$company->code_client = $obj->code_client;
$company->id = $obj->socid;
$company->name = $obj->name;
$company->email = $obj->email;
$company->code_client = $obj->code_client;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"), "bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->invoiceref."</a></td>\n";
print '</a>';
print '</td>';
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"), "bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->invoiceref."</a></td>\n";
print '</a>';
print '</td>';
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="8">'.$langs->trans("None").'</td></tr>';
}
print "</table>";
print '</div>';

View File

@ -55,7 +55,12 @@ $pagenext = $page + 1;
* View
*/
llxHeader('', $langs->trans("WithdrawsRefused"));
$title = $langs->trans("WithdrawsRefused");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransfersRefused");
}
llxHeader('', $title);
if ($sortorder == "") $sortorder = "DESC";
if ($sortfield == "") $sortfield = "p.datec";
@ -80,9 +85,14 @@ $sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pl.fk_soc = s.rowid";
$sql .= " AND p.entity = ".$conf->entity;
if ($type == 'bank-transfer') {
$sql .= " AND p.type = 'bank-transfer'";
} else {
$sql .= " AND p.type = 'debit-order'";
}
if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql .= " ".$db->order($sortfield, $sortorder);
$sql .= " ".$db->plimit($conf->liste_limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
@ -90,33 +100,39 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
$param = '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder tagtable liste" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], "p.ref", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
print_liste_field_titre("Reason", $_SERVER["PHP_SELF"], "pr.motif", "", $urladd);
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], "p.ref", '', $param);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param);
print_liste_field_titre("Reason", $_SERVER["PHP_SELF"], "pr.motif", "", $param);
print "</tr>\n";
$total = 0;
if ($num) {
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
while ($i < min($num, $conf->liste_limit))
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
print '<tr class="oddeven"><td>';
print $line->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print '<td>';
print $line->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6)."</a></td>";
print substr('000000'.$obj->rowid, -6)."</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->nom."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print "</tr>\n";
print "</tr>\n";
$i++;
$i++;
}
} else {
print '<tr><td class="opacitymedium" colspan="3">'.$langs->trans("None").'</td></tr>';
}
print "</table>";

View File

@ -43,15 +43,25 @@ $type = GETPOST('type', 'aZ09');
* View
*/
llxHeader('', $langs->trans("WithdrawStatistics"));
$title = $langs->trans("WithdrawStatistics");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferStatistics");
}
print load_fiche_titre($langs->trans("Statistics"));
llxHeader('', $title);
print load_fiche_titre($title);
// Define total and nbtotal
$sql = "SELECT sum(pl.amount), count(pl.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " AND pb.entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
@ -73,7 +83,7 @@ if ($resql)
*/
print '<br>';
print load_fiche_titre($langs->trans("WithdrawStatistics"), '', '');
print load_fiche_titre($langs->trans("ByStatus"), '', '');
$ligne = new LignePrelevement($db);
@ -82,6 +92,11 @@ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " GROUP BY pl.statut";
$resql = $db->query($sql);
@ -139,7 +154,7 @@ else
*/
print '<br>';
print load_fiche_titre($langs->trans("WithdrawRejectStatistics"), '', '');
print load_fiche_titre($langs->trans("Rejects"), '', '');
// Define total and nbtotal
@ -149,6 +164,11 @@ $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
$sql .= " AND pl.statut = 3";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$resql = $db->query($sql);
if ($resql)
{
@ -166,6 +186,7 @@ if ($resql)
/*
* Stats sur les rejets
*/
$sql = "SELECT sum(pl.amount), count(pl.amount) as cc, pr.motif";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
@ -174,6 +195,11 @@ $sql .= " WHERE pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
$sql .= " AND pl.statut = 3";
$sql .= " AND pr.fk_prelevement_lignes = pl.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pb.type = 'bank-transfer'";
} else {
$sql .= " AND pb.type = 'debit-order'";
}
$sql .= " GROUP BY pr.motif";
$sql .= " ORDER BY cc DESC";

View File

@ -159,7 +159,7 @@ class PaymentSocialContribution extends CommonObject
if ($totalamount != 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
$sql .= " fk_typepaiement, num_paiement as num_payment, note, fk_user_creat, fk_bank)";
$sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datepaye)."',";
$sql .= " ".$totalamount.",";
@ -516,6 +516,9 @@ class PaymentSocialContribution extends CommonObject
{
global $conf;
// Clean data
$this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement);
$error = 0;
if (!empty($conf->banque->enabled))
@ -534,7 +537,7 @@ class PaymentSocialContribution extends CommonObject
$this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
$label,
$total,
$this->num_paiement,
$this->num_payment,
'',
$user,
$emetteur_nom,

View File

@ -275,7 +275,9 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")";
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label, cc.code ";
$sql .= " ORDER BY country, product_type, vatrate";
dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG);
$resql = $db->query($sql);
@ -356,7 +358,8 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " AND ff.type IN (0,1,2,3,5)";
}
$sql2 .= " AND ff.entity IN (".getEntity("facture_fourn", 0).")";
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label, cc.code ";
$sql2 .= " ORDER BY country, product_type, vatrate";
//print $sql2;
dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG);

View File

@ -403,6 +403,7 @@ if (empty($reshook))
//$object->twitter = GETPOST("twitter", 'alpha');
//$object->facebook = GETPOST("facebook", 'alpha');
//$object->linkedin = GETPOST("linkedin", 'alpha');
$object->socialnetworks = array();
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {

View File

@ -1081,9 +1081,6 @@ class Contact extends CommonObject
$error = 0;
//$this->old_lastname = $obj->lastname;
//$this->old_firstname = $obj->firstname;
$this->db->begin();
if (!$error)
@ -1095,7 +1092,7 @@ class Contact extends CommonObject
$sql .= " WHERE ec.fk_socpeople=".$this->id;
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.source='external'";
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -1108,7 +1105,7 @@ class Contact extends CommonObject
$sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sqldel .= " WHERE rowid = ".$obj->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sqldel);
if (!$result)
{
@ -1130,7 +1127,7 @@ class Contact extends CommonObject
{
// Remove Roles
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
@ -1144,7 +1141,7 @@ class Contact extends CommonObject
{
// Remove category
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
@ -1158,7 +1155,7 @@ class Contact extends CommonObject
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople";
$sql .= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result)
{

View File

@ -332,7 +332,7 @@ if ($type == 'directory')
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
//var_dump("title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
//var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
}
}

View File

@ -146,15 +146,6 @@ if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLI
$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
{
$langs->load("hrm");
$searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user'));
}
*/
// Execute hook addSearchEntry
$parameters = array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult);
$reshook = $hookmanager->executeHooks('addSearchEntry', $parameters);

View File

@ -443,10 +443,20 @@ abstract class CommonObject
public $next_prev_filter;
/**
* @var array List of child tables. To test if we can delete object.
*/
protected $childtables = array();
/**
* @var array List of child tables. To know object to delete on cascade.
* If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
* call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
*/
protected $childtablesoncascade = array();
// No constructor as it is an abstract class
/**
* Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
@ -3121,7 +3131,12 @@ abstract class CommonObject
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('A rounding difference was detected into TOTAL but is too high to be corrected', LOG_WARNING); exit; }
if (abs($diff) > 0.1) {
$errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your line may be corrupted. Try to edit each line manually.';
dol_syslog($errmsg, LOG_WARNING);
dol_print_error('', $errmsg);
exit;
}
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix = $this->db->query($sqlfix);
@ -8297,18 +8312,43 @@ abstract class CommonObject
}
// Delete cascade first
if (!empty($this->childtablesoncascade)) {
if (is_array($this->childtablesoncascade) && !empty($this->childtablesoncascade)) {
foreach ($this->childtablesoncascade as $table)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$this->db->rollback();
return -1;
}
$deleteFromObject = explode(':', $table);
if (count($deleteFromObject)>=2) {
$className = str_replace('@', '', $deleteFromObject[0]);
$filePath = $deleteFromObject[1];
$columnName = $deleteFromObject[2];
if (dol_include_once($filePath)) {
$childObject = new $className($this->db);
if (method_exists($childObject, 'deleteByParentField')) {
$result = $childObject->deleteByParentField($this->id, $columnName);
if ($result < 0) {
$error++;
$this->errors[] = $childObject->error;
break;
}
} else {
$error++;
$this->errors[] = "You defined a cascade delete on an object $childObject but there is no method deleteByParentField for it";
break;
}
} else {
$error++;
$this->errors[] = 'Cannot include child class file ' .$filePath;
break;
}
} else {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $table . ' WHERE ' . $this->fk_element . ' = ' . $this->id;
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
break;
}
}
}
}
@ -8348,6 +8388,62 @@ abstract class CommonObject
}
}
/**
* Delete all child object from a parent ID
*
* @param int $parentId Parent Id
* @param string $parentField Name of Foreign key parent column
* @return int <0 if KO, >0 if OK
* @throws Exception
*/
public function deleteByParentField($parentId = 0, $parentField = '')
{
global $user;
$error = 0;
$deleted = 0;
if (!empty($parentId) && !empty($parentField)) {
$this->db->begin();
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE '.$parentField.' = ' . (int) $parentId;
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->lasterror();
$error++;
} else {
while ($obj = $this->db->fetch_object($resql)) {
$result = $this->fetch($obj->rowid);
if ($result < 0) {
$error++;
$this->errors[] = $this->error;
} else {
$result = $this->delete($user);
if ($result < 0) {
$error++;
$this->errors[] = $this->error;
} else {
$deleted++;
}
}
}
}
if (empty($error)) {
$this->db->commit();
return $deleted;
} else {
$this->error = implode(', ', $this->errors);
$this->db->rollback();
return $error * -1;
}
}
return $deleted;
}
/**
* Delete a line of object in database
*

View File

@ -7050,7 +7050,8 @@ class Form
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),

View File

@ -168,7 +168,8 @@ class FormFile
}
$out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
//$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD)) ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
$out .= (!empty($capture) ? ' capture="capture"' : '');
@ -1310,7 +1311,7 @@ class FormFile
{
if ($useinecm == 5 || $useinecm == 6)
{
$smallfile = getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image
$smallfile = getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image. TODO Change this it is slow on image dir.
}
else
{
@ -1376,10 +1377,14 @@ class FormFile
// Delete or view link
// ($param must start with &)
print '<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
if ($useinecm == 1 || $useinecm == 5) // ECM manual tree
if ($useinecm == 1 || $useinecm == 5) // ECM manual tree only
{
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
// $section is inside $param
$newparam.=preg_replace('/&file=.*$/', '', $param); // We don't need param file=
$backtopage = DOL_URL_ROOT.'/ecm/index.php?&section_dir='.urlencode($relativepath).$newparam;
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'&backtopage='.urlencode($backtopage).'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}
if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) // 6=Media file manager
{
$newmodulepart = $modulepart;

View File

@ -52,7 +52,7 @@ class Menu
* Add a menu entry into this->liste (at end)
*
* @param string $url Url to follow on click (does not include DOL_URL_ROOT)
* @param string $titre Label of menu to add
* @param string $titre Label of menu to add. The value must already be translated.
* @param integer $level Level of menu to add
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
* @param string $target Target link
@ -75,7 +75,7 @@ class Menu
*
* @param int $idafter Array key after which inserting new entry
* @param string $url Url to follow on click
* @param string $titre Label of menu to add
* @param string $titre Label of menu to add. The value must already be translated.
* @param integer $level Level of menu to add
* @param int $enabled Menu active or not
* @param string $target Target link

View File

@ -725,9 +725,9 @@ class Menubase
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
$tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
$tabMenu[$b]['perms'] = $perms;
$tabMenu[$b]['langs'] = $menu['langs']; // Note that this should not be used, lang file should be already loaded.
$tabMenu[$b]['enabled'] = $enabled;
$tabMenu[$b]['type'] = $menu['type'];
//$tabMenu[$b]['langs'] = $menu['langs'];
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
$tabMenu[$b]['position'] = (int) $menu['position'];

View File

@ -663,7 +663,7 @@ function security_prepare_head()
$head[$h][0] = DOL_URL_ROOT."/admin/perms.php";
$head[$h][1] = $langs->trans("DefaultRights");
if ($nbPerms > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbPerms.'</span>';
if ($nbPerms > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbPerms.'</span>' : '');
$head[$h][2] = 'default';
$h++;

View File

@ -481,7 +481,7 @@ function actions_prepare_head($object)
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
$nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0);
$head[$h][1] = $langs->trans("Resources");
if ($nbResources > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbResources).'</span>';
if ($nbResources > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbResources).'</span>' : '');
$head[$h][2] = 'resources';
$h++;
}
@ -494,7 +494,7 @@ function actions_prepare_head($object)
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
$head[$h][1] = $langs->trans("Documents");
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
$head[$h][2] = 'documents';
$h++;

View File

@ -2986,20 +2986,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
exit;
}
/*$perm = GETPOST('perm', 'aZ09');
$subperm = GETPOST('subperm', 'aZ09');
if ($perm || $subperm)
{
if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1;
}
else
{*/
// Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read
$partsofdirinoriginalfile = explode('/', $original_file);
$partofdirinoriginalfile = $partsofdirinoriginalfile[0];
if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1;
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
//}
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
}

View File

@ -601,7 +601,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('"', '../'), '', trim($out));
$out = dol_string_nohtmltag($out);
$out = dol_string_nohtmltag($out, 1);
}
break;
case 'restricthtml': // Recommended for most html textarea
@ -1216,7 +1216,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{
$limittitle = 30;
$out .= '<a class="tabTitle">';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
if ($picto && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
$out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
$out .= '</a>';
}
@ -2246,6 +2246,8 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail = $email;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto = 0;
if (empty($email)) return '&nbsp;';
if (!empty($addlink))
@ -2279,7 +2281,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
}
//$rep = '<div class="nospan" style="margin-right: 10px">';
$rep = ($withpicto ?img_picto($langs->trans("EMail").' : '.$email, 'object_email.png').' ' : '').$newemail;
$rep = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, 'object_email.png').' ' : '').$newemail;
//$rep .= '</div>';
if ($hookmanager) {
$parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);
@ -3959,7 +3961,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= $langs->trans("InformationToHelpDiagnose").":<br>\n";
$out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n";
$out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";
$out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION." - https://www.dolibarr.org<br>\n";
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";
if (function_exists("phpversion"))
{
@ -7715,23 +7717,6 @@ function printCommonFooter($zone = 'private')
print '});'."\n";
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
print "\n";
print "/* JS CODE TO ENABLE for google analtics tag */\n";
print ' var _gaq = _gaq || [];'."\n";
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
print ' _gaq.push([\'_trackPageview\']);'."\n";
print ''."\n";
print ' (function() {'."\n";
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
print ' })();'."\n";
}
// End of tuning
if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO']) || !empty($conf->global->MAIN_SHOW_TUNING_INFO))
{
@ -7760,6 +7745,28 @@ function printCommonFooter($zone = 'private')
}
print "\n".'</script>'."\n";
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
}
}
}
// Add Xdebug coverage of code

View File

@ -474,7 +474,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'project') $feature = 'projet';
if ($feature == 'task') $feature = 'projet_task';
$check = array('adherent', 'banque', 'bom', 'don', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday'); // Test on entity only (Objects with no link to company)
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object

View File

@ -64,7 +64,7 @@ function user_prepare_head($object)
if ($canreadperms)
{
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("Rights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>';
$head[$h][1] = $langs->trans("Rights").(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
$head[$h][2] = 'rights';
$h++;
}

View File

@ -732,45 +732,51 @@ function getSocialNetworkSharingLinks()
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
$fullurl = $website->alias.'/'.$websitepage->pageurl.'.php';
$hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords))));
$out = '<!-- section for social network sharing of page -->'."\n";
$out .= '<div class="dol-social-share">'."\n";
// Twitter
$out .= '<div class="dol-social-share-tw">'."\n";
$out .= '<a href="https://twitter.com/share" class="twitter-share-button" data-url="'.$fullurl.'" data-text="'.dol_escape_htmltag($websitepage->description).'" data-lang="'.$websitepage->lang.'" data-size="small" data-related="" data-hashtags="'.preg_replace('/^#/', '', $hashtags).'" data-count="horizontal">Tweet</a>';
$out .= '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\'://platform.twitter.com/widgets.js\';fjs.parentNode.insertBefore(js,fjs);}}(document, \'script\', \'twitter-wjs\');</script>';
$out .= '</div>'."\n";
if ($website->virtualhost) {
$fullurl = $website->virtualhost.'/'.$websitepage->pageurl.'.php';
$hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords))));
// Reddit
$out .= '<div class="dol-social-share-reddit">'."\n";
$out .= '<a href="https://www.reddit.com/submit" target="_blank" onclick="window.location = \'https://www.reddit.com/submit?url='.$fullurl.'\'; return false">';
$out .= '<img src="https://www.reddit.com/static/spreddit7.gif" alt="Submit to reddit" border="0" /> </a>';
$out .= '</div>'."\n";
$out .= '<div class="dol-social-share">'."\n";
// Facebook
$out .= '<div class="dol-social-share-fbl">'."\n";
$out .= '<div id="fb-root"></div>'."\n";
$out .= '<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0&amp;appId=dolibarr.org";
fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>
<fb:like
href="'.$fullurl.'"
layout="button_count"
show_faces="false"
width="90"
colorscheme="light"
share="1"
action="like" ></fb:like>'."\n";
$out .= '</div>'."\n";
// Twitter
$out .= '<div class="dol-social-share-tw">'."\n";
$out .= '<a href="https://twitter.com/share" class="twitter-share-button" data-url="'.$fullurl.'" data-text="'.dol_escape_htmltag($websitepage->description).'" data-lang="'.$websitepage->lang.'" data-size="small" data-related="" data-hashtags="'.preg_replace('/^#/', '', $hashtags).'" data-count="horizontal">Tweet</a>';
$out .= '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\'://platform.twitter.com/widgets.js\';fjs.parentNode.insertBefore(js,fjs);}}(document, \'script\', \'twitter-wjs\');</script>';
$out .= '</div>'."\n";
$out .= "\n</div>\n";
// Reddit
$out .= '<div class="dol-social-share-reddit">'."\n";
$out .= '<a href="https://www.reddit.com/submit" target="_blank" onclick="window.location = \'https://www.reddit.com/submit?url='.$fullurl.'\'; return false">';
$out .= '<img src="https://www.reddit.com/static/spreddit7.gif" alt="Submit to reddit" border="0" /> </a>';
$out .= '</div>'."\n";
// Facebook
$out .= '<div class="dol-social-share-fbl">'."\n";
$out .= '<div id="fb-root"></div>'."\n";
$out .= '<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0&amp;appId=dolibarr.org";
fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>
<fb:like
href="'.$fullurl.'"
layout="button_count"
show_faces="false"
width="90"
colorscheme="light"
share="1"
action="like" ></fb:like>'."\n";
$out .= '</div>'."\n";
$out .= "\n</div>\n";
}
else {
$out .= '<!-- virtual host not defined in CMS. No way to add sharing buttons -->'."\n";
}
$out .= '<!-- section end for social network sharing of page -->'."\n";
return $out;

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param DoliDB $db Database handler
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database.
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout 1=Disable output (Initialise &$menu only).
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
@ -49,6 +49,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$mainmenu = (empty($_SESSION["mainmenu"]) ? '' : $_SESSION["mainmenu"]);
$leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]);
$id = 'mainmenu';
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);

View File

@ -79,6 +79,7 @@ else
{
$usedbyinclude = 1; // Used into next include
$showtitlebefore = GETPOST('showtitlebefore', 'int');
$arrayresult = array();
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$i = 0;
@ -95,7 +96,8 @@ else
$accesskey = $val['label'][0];
$accesskeyalreadyassigned[$accesskey] = $accesskey;
}
$searchform .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('', $val['img'], '', 0, 1), $showtitlebefore, ($i > 0 ? 0 : 1));
$searchform .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1));
$i++;
}

View File

@ -133,7 +133,7 @@ print '</div>';
// Start left area
// Confirmation de la suppression d'une ligne categorie
// Ask confirmation of deletion of directory
if ($action == 'delete_section')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);

View File

@ -54,6 +54,7 @@ $titleofloginpage = $langs->trans('Login').' @ '.$titletruedolibarrversion; // $
$disablenofollow = 1;
if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $disablenofollow = 0;
print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
@ -336,23 +337,25 @@ elseif (!empty($moreloginextracontent)) {
echo $moreloginextracontent;
}
// Google Analytics (need Google module)
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
if (empty($conf->dol_use_jmobile))
{
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
print '<script type="text/javascript">'."\n";
print ' var _gaq = _gaq || [];'."\n";
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
print ' _gaq.push([\'_trackPageview\']);'."\n";
print ''."\n";
print ' (function() {'."\n";
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
print ' })();'."\n";
print '</script>'."\n";
}
}

View File

@ -285,13 +285,19 @@ if ($line->special_code == 3) { ?>
$tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
$tooltiponprice .= '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva);
if (!$senderissupplier && is_object($object->thirdparty)) {
if ($object->thirdparty->useLocalTax(1)) {
if (price2num($line->total_localtax1)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1);
else $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
if ($mysoc->useLocalTax(1)) {
if (($mysoc->country_code == $object->thirdparty->country_code) || $object->thirdparty->useLocalTax(1)) {
$tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1);
} else {
$tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
}
}
if ($object->thirdparty->useLocalTax(1)) {
if (price2num($line->total_localtax2)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2);
else $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
if ($mysoc->useLocalTax(2)) {
if (($mysoc->country_code == $object->thirdparty->country_code) || $object->thirdparty->useLocalTax(2)) {
$tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2);
} else {
$tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
}
}
}
$tooltiponprice .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc);

View File

@ -206,7 +206,13 @@ if (!empty($morelogincontent)) {
</div>
<?php } ?>
<?php if (!empty($morelogincontent) && is_array($morelogincontent)) {
<!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
<?php
if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
if (!empty($morelogincontent) && is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option)
{
if ($format == 'js') {
@ -219,8 +225,53 @@ elseif (!empty($moreloginextracontent)) {
echo '<!-- Javascript by hook -->';
echo $moreloginextracontent;
}
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
}
}
// Google Adsense
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT))
{
if (empty($conf->dol_use_jmobile))
{
?>
<div class="center"><br>
<script type="text/javascript"><!--
google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<?php
}
}
?>
</div>
</div> <!-- end of center -->

View File

@ -121,7 +121,7 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') // If we browsing
else
{
$newpageref = $obj->pageurl;
header("Location: ".$newpageref.'.php?l='.GETPOST('l', 'aZ09'));
header("Location: ".(($obj->lang && $obj->lang != $website->lang) ? '/'.$obj->lang.'/' : '/').$newpageref.'.php?l='.GETPOST('l', 'aZ09'));
exit;
}
}

View File

@ -33,6 +33,7 @@ $langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal'
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
if (!$user->rights->ecm->setup) accessforbidden();
@ -282,10 +283,13 @@ $s = img_picto('', 'object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$l
if ($action == 'edit') $s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfiletoshow.'">';
else $s .= $urlfiletoshow;
$morehtml = '';
$linkback = '';
if ($backtopage) {
$linkback = '<a href="'.$backtopage.'">'.$langs->trans("BackToTree").'</a>';
}
$object->ref = ''; // Force to hide ref
dol_banner_tab($object, '', $morehtml, 0, '', '', $s);
dol_banner_tab($object, '', $linkback, 0, '', '', $s);
print '<div class="fichecenter">';

View File

@ -57,7 +57,7 @@ if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "fullname";
$ecmdir = new EcmDirectory($db);
if ($section)
if ($section > 0)
{
$result = $ecmdir->fetch($section);
if (!$result > 0)
@ -170,7 +170,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
}
// Remove directory
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
if ($action == 'confirm_deletesection' && GETPOST('confirm', 'alpha') == 'yes')
{
$result = $ecmdir->delete($user);
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');

View File

@ -75,21 +75,17 @@ if (!empty($section))
}
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
/*
* Actions
*/
// None
/*******************************************************************
* PAGE
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
/*
* View
*/
llxHeader();
@ -138,10 +134,10 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="nobordernopadding" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="2">'.$langs->trans("ECMSearchByKeywords").'</td></tr>';
print "<tr ".$bc[false]."><td>".$langs->trans("Ref").':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
print "<tr ".$bc[false]."><td>".$langs->trans("Title").':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
print "<tr ".$bc[false]."><td>".$langs->trans("Keyword").':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
print "<tr ".$bc[false].'><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print '<tr class="impair"><td>'.$langs->trans("Ref").':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
print '<tr class="impair"><td>'.$langs->trans("Title").':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
print '<tr class="impair"><td>'.$langs->trans("Keyword").':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
print '<tr class="impair"><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print "</table></form>";
//print $langs->trans("ECMSectionManualDesc");
@ -158,21 +154,16 @@ $butshown = 0;
foreach ($sectionauto as $sectioncur)
{
if (!$sectioncur['test']) continue;
//if ($butshown % 2 == 0)
print '<tr '.$bc[false].'>';
print '<tr class="impair">';
print "<td>".$sectioncur['label'].':</td>';
print '<td';
//if ($butshown % 2 == 1)
print ' class="right"';
print ' class="right"';
print '>';
print '<input type="text" name="search_'.$sectioncur['module'].'" class="flat" size="14">';
print '</td>';
//if ($butshown % 2 == 1)
print '</tr>';
print '</tr>';
$butshown++;
}
//if ($butshown % 2 == 1)
// print '<td>&nbsp;</td><td>&nbsp;</td></tr>';
print '<tr '.$bc[false].'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print "</table></form>";
@ -192,11 +183,6 @@ $param = '&amp;section='.$section;
$textifempty = ($section ? $langs->trans("NoFileFound") : $langs->trans("ECMSelectASection"));
$formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->rights->ecm->upload, 1, $textifempty);
// print '<table width="100%" class="border">';
// print '<tr><td> </td></tr></table>';
print '</td></tr>';

View File

@ -31,7 +31,7 @@
*/
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('EURO')) define('EURO', chr(128));

View File

@ -898,10 +898,10 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
$boxstat .= '<!-- Database statistics -->'."\n";
$boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
$boxstat .= '<tr class="liste_titre">';
$boxstat .= '<th class="liste_titre">';
$boxstat .= '<tr class="liste_titre box_titre">';
$boxstat .= '<td class="liste_titre">';
$boxstat .= '<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
$boxstat .= '</th>';
$boxstat .= '</td>';
$boxstat .= '</tr>';
$boxstat .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer">';

View File

@ -165,6 +165,8 @@ ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT;
ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, entity, title);
ALTER TABLE llx_societe_rib MODIFY COLUMN owner_address varchar(255);
ALTER TABLE llx_societe_rib MODIFY COLUMN default_rib smallint NOT NULL DEFAULT 0;
ALTER TABLE llx_societe_rib ADD COLUMN stripe_account varchar(128);

View File

@ -495,8 +495,8 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;
-- Test inconsistency of data into situation invoices: If it differs, it may be the total_ht that is wrong and situation_percent that is good.
-- select f.rowid, f.type, qty, subprice, situation_percent, fd.total_ht, fd.total_ttc, fd.total_tva, fd.multicurrency_total_ht, fd.multicurrency_total_tva, fd.multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100)))
-- from llx_facturedet as fd, llx_facture as f where fd.fk_facture = f.rowid AND (fd.total_ht - situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) > 0.01 and f.type = 5;
-- select f.rowid, f.type, fd.qty, fd.subprice, fd.situation_percent, fd.total_ht, fd.total_ttc, fd.total_tva, fd.multicurrency_total_ht, fd.multicurrency_total_tva, fd.multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100)))
-- from llx_facturedet as fd, llx_facture as f where fd.fk_facture = f.rowid AND (total_ht - situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) > 0.01 and f.type = 5;
-- Note to make all deposit as payed when there is already a discount generated from it.
@ -519,3 +519,7 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
-- update llx_societe set code_compta_fournisseur = concat('401', substr(code_fournisseur, 3, 2),substr(code_fournisseur, 8, 5)) where fournisseur in (1,2,3) and code_fournisseur is not null;
-- To fix a table with error 'ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs'
--ALTER TABLE llx_tablename ROW_FORMAT=DYNAMIC;

View File

@ -1847,6 +1847,7 @@ MailToThirdparty=Third parties
MailToMember=Members
MailToUser=Users
MailToProject=Projects page
MailToTicket=Tickets
ByDefaultInList=Show by default on list view
YouUseLastStableVersion=You use the latest stable version
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)
@ -1999,6 +2000,7 @@ EmailTemplate=Template for email
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book.
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
RssNote=Note: Each RSS feed definition provides a widget that you must enable to have it available in dashboard
JumpToBoxes=Jump to Setup -> Widgets
MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight", "time"

View File

@ -664,6 +664,7 @@ Owner=Owner
FollowingConstantsWillBeSubstituted=The following constants will be replaced with the corresponding value.
Refresh=Refresh
BackToList=Back to list
BackToTree=Back to tree
GoBack=Go back
CanBeModifiedIfOk=Can be modified if valid
CanBeModifiedIfKo=Can be modified if not valid
@ -1034,3 +1035,5 @@ DeleteFileText=Do you really want delete this file?
ShowOtherLanguages=Show other languages
SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language
NotUsedForThisCustomer=Not used for this customer
AmountMustBePositive=Amount must be positive
ByStatus=By status

View File

@ -265,3 +265,4 @@ NewInvoice=New invoice
OneLinePerTask=One line per task
OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task
ProfitIsCalculatedWith=Profit is calculated using

View File

@ -123,6 +123,7 @@ WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decreas
WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase
ForThisWarehouse=For this warehouse
ReplenishmentStatusDesc=This is a list of all products with a stock lower than desired stock (or lower than alert value if checkbox "alert only" is checked). Using the checkbox, you can create purchase orders to fill the difference.
ReplenishmentStatusDescPerWarehouse=If you want a replenishment based on desired quantity defined per warehouse, you must add a filter on the warehouse.
ReplenishmentOrdersDesc=This is a list of all open purchase orders including predefined products. Only open orders with predefined products, so orders that may affect stocks, are visible here.
Replenishments=Replenishments
NbOfProductBeforePeriod=Quantity of product %s in stock before selected period (< %s)

View File

@ -16,6 +16,7 @@ WEBSITE_ROBOT=Robot file (robots.txt)
WEBSITE_HTACCESS=Website .htaccess file
WEBSITE_MANIFEST_JSON=Website manifest.json file
WEBSITE_README=README.md file
WEBSITE_KEYWORDSDesc=Use a comma to separate values
EnterHereLicenseInformation=Enter here meta data or license information to fille a README.md file. if you distribute your website as a template, the file will be included into the temptate package.
HtmlHeaderPage=HTML header (specific to this page only)
PageNameAliasHelp=Name or alias of the page.<br>This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "<strong>%s</strong>" to edit this alias.
@ -129,4 +130,5 @@ PublicAuthorAlias=Public author alias
AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties
ReplacementDoneInXPages=Replacement done in %s pages or containers
RSSFeed=RSS Feed
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
PagesRegenerated=%s page(s)/container(s) regenerated

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - withdrawals
CustomersStandingOrdersArea=Direct debit payment orders area
SuppliersStandingOrdersArea=Direct credit payment orders area
CustomersStandingOrdersArea=Payments by Direct debit orders
SuppliersStandingOrdersArea=Payments by Credit transfer
StandingOrdersPayment=Direct debit payment orders
StandingOrderPayment=Direct debit payment order
NewStandingOrder=New direct debit order
@ -10,26 +10,34 @@ PaymentByBankTransferReceipts=Credit transfer orders
PaymentByBankTransferLines=Credit transfer order lines
WithdrawalsReceipts=Direct debit orders
WithdrawalReceipt=Direct debit order
BankTransferReceipts=Credit transfer receipts
BankTransferReceipt=Credit transfer receipt
LatestBankTransferReceipts=Latest %s credit transfer orders
LastWithdrawalReceipts=Latest %s direct debit files
WithdrawalsLine=Direct debit order line
CreditTransferLine=Credit transfer line
WithdrawalsLines=Direct debit order lines
RequestStandingOrderToTreat=Request for direct debit payment order to process
RequestStandingOrderTreated=Request for direct debit payment order processed
CreditTransferLines=Credit transfer lines
RequestStandingOrderToTreat=Requests for direct debit payment order to process
RequestStandingOrderTreated=Requests for direct debit payment order processed
RequestPaymentsByBankTransferToTreat=Requests for credit transfer to process
RequestPaymentsByBankTransferTreated=Requests for credit transfer processed
NotPossibleForThisStatusOfWithdrawReceiptORLine=Not yet possible. Withdraw status must be set to 'credited' before declaring reject on specific lines.
NbOfInvoiceToWithdraw=No. of qualified customer invoices with waiting direct debit order
NbOfInvoiceToWithdrawWithInfo=No. of customer invoice with direct debit payment orders having defined bank account information
NbOfInvoiceToPayByBankTransfer=No. of qualified supplier invoices waiting for a payment by credit transfer
SupplierInvoiceWaitingWithdraw=Vendor invoice waiting for payment by credit transfer
InvoiceWaitingWithdraw=Invoice waiting for direct debit
InvoiceWaitingPaymentByBankTransfer=Invoice waiting for credit transfer
AmountToWithdraw=Amount to withdraw
WithdrawsRefused=Direct debit refused
NoInvoiceToWithdraw=No customer invoice with open 'Direct debit requests' is waiting. Go on tab '%s' on invoice card to make a request.
NoInvoiceToWithdraw=No invoice open for '%s' is waiting. Go on tab '%s' on invoice card to make a request.
NoSupplierInvoiceToWithdraw=No supplier invoice with open 'Direct credit requests' is waiting. Go on tab '%s' on invoice card to make a request.
ResponsibleUser=User Responsible
WithdrawalsSetup=Direct debit payment setup
CreditTransferSetup=Crebit transfer setup
WithdrawStatistics=Direct debit payment statistics
WithdrawRejectStatistics=Direct debit payment reject statistics
CreditTransferStatistics=Credit transfer statistics
Rejects=Rejects
LastWithdrawalReceipt=Latest %s direct debit receipts
MakeWithdrawRequest=Make a direct debit payment request
WithdrawRequestsDone=%s direct debit payment requests recorded
@ -42,7 +50,9 @@ TransMetod=Transmission method
Send=Send
Lines=Lines
StandingOrderReject=Issue a rejection
WithdrawsRefused=Direct debit refused
WithdrawalRefused=Withdrawal refused
CreditTransfersRefused=Credit transfers refused
WithdrawalRefusedConfirm=Are you sure you want to enter a withdrawal rejection for society
RefusedData=Date of rejection
RefusedReason=Reason for rejection
@ -66,6 +76,8 @@ StatusMotif8=Other reason
CreateForSepaFRST=Create direct debit file (SEPA FRST)
CreateForSepaRCUR=Create direct debit file (SEPA RCUR)
CreateAll=Create direct debit file (all)
CreateFileForPaymentByBankTransfer=Create credit transfer (all)
CreateSepaFileForPaymentByBankTransfer=Create credit transfer file (SEPA)
CreateGuichet=Only office
CreateBanque=Only bank
OrderWaiting=Waiting for treatment
@ -83,7 +95,7 @@ IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also record payments to invoices and will classify them as "Paid" if remain to pay is null
ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null
StatisticsByLineStatus=Statistics by status of lines
RUM=UMR
DateRUM=Mandate signature date

View File

@ -257,6 +257,12 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover = 1;
}
// Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part)
if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) // If we must enable text browser
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
}
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on'))
@ -343,7 +349,6 @@ if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VE
}
}
// Creation of a token against CSRF vulnerabilities
if (!defined('NOTOKENRENEWAL'))
{
@ -868,7 +873,6 @@ if (GETPOST('theme', 'alpha'))
$conf->css = "/theme/".$conf->theme."/style.css.php";
}
// Set javascript option
if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL
{
@ -876,19 +880,14 @@ if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL
{
$conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
}
}
else $conf->use_javascript_ajax = 0;
// Set MAIN_OPTIMIZEFORTEXTBROWSER
if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) // If we must enable text browser
{
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
}
elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
{
} else $conf->use_javascript_ajax = 0;
// Set MAIN_OPTIMIZEFORTEXTBROWSER for user (must be after login part)
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
}
// set MAIN_OPTIMIZEFORCOLORBLIND
// set MAIN_OPTIMIZEFORCOLORBLIND for user
$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
// Set terminal output option according to conf->browser.

View File

@ -181,7 +181,7 @@ class MyObject extends CommonObject
//public $table_element_line = 'mymodule_myobjectline';
/**
* @var int Field with ID of parent key if this field has a parent
* @var int Field with ID of parent key if this object has a parent
*/
//public $fk_element = 'fk_myobject';
@ -193,12 +193,14 @@ class MyObject extends CommonObject
/**
* @var array List of child tables. To test if we can delete object.
*/
//protected $childtables=array();
//protected $childtables = array();
/**
* @var array List of child tables. To know object to delete on cascade.
* @var array List of child tables. To know object to delete on cascade.
* If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
* call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
*/
//protected $childtablesoncascade=array('mymodule_myobjectdet');
//protected $childtablesoncascade = array('mymodule_myobjectdet');
/**
* @var MyObjectLine[] Array of subtable lines

View File

@ -269,7 +269,7 @@ class modMyModule extends DolibarrModules
$this->menu[$r++] = array(
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top', // This is a Top menu entry
'titre'=>'MyModule',
'titre'=>'ModuleMyModuleName',
'mainmenu'=>'mymodule',
'leftmenu'=>'',
'url'=>'/mymodule/mymoduleindex.php',

View File

@ -48,7 +48,7 @@ function myobjectPrepareHead($object)
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note';
$h++;
}

View File

@ -654,7 +654,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline')))
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" class="'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? 'formconsumeproduce' : '').'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_'.$action.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
@ -666,7 +666,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog');
$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
print '<div class="center">';
print '<div class="center'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? ' formconsumeproduce' : '').'">';
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></span>';
print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"> &nbsp; ';
print $langs->trans("InventoryCode").': <input type="text" class="maxwidth200" name="inventorycode" value="'.$defaultstockmovementcode.'"><br><br>';
@ -674,7 +674,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<input class="button" type="submit" value="'.$langs->trans("Confirm").'" name="confirm">';
print ' &nbsp; ';
print '<input class="button" type="submit" value="'.$langs->trans("Cancel").'" name="cancel">';
print '<br><br>';
print '</div>';
print '<br>';
}
}

View File

@ -193,7 +193,7 @@ if (empty($reshook))
{
$error = 0;
if (!GETPOST('label'))
if (!GETPOST('label', 'alphanohtml'))
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Label')), null, 'errors');
$action = "create";
@ -217,8 +217,8 @@ if (empty($reshook))
$units = GETPOST('units', 'int');
$object->ref = $ref;
$object->label = GETPOST('label');
$object->price_base_type = GETPOST('price_base_type');
$object->label = GETPOST('label', 'alphanohtml');
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
if ($object->price_base_type == 'TTC')
$object->price_ttc = GETPOST('price');
@ -293,7 +293,7 @@ if (empty($reshook))
$object->url = GETPOST('url');
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private', 'none'));
$object->note = $object->note_private; // deprecated
$object->customcode = GETPOST('customcode', 'alpha');
$object->customcode = GETPOST('customcode', 'alphanohtml');
$object->country_id = GETPOST('country_id', 'int');
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
@ -398,7 +398,7 @@ if (empty($reshook))
$object->oldcopy = clone $object;
$object->ref = $ref;
$object->label = GETPOST('label');
$object->label = GETPOST('label', 'alphanohtml');
$object->description = dol_htmlcleanlastbr(GETPOST('desc', 'none'));
$object->url = GETPOST('url');
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB))
@ -989,7 +989,7 @@ else
print '<tr>';
$tmpcode = '';
if (!empty($modCodeProduct->code_auto)) $tmpcode = $modCodeProduct->getNextValue($object, $type);
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref') ?GETPOST('ref') : $tmpcode).'">';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alphanohtml') : $tmpcode).'">';
if ($refalreadyexists)
{
print $langs->trans("RefAlreadyExists");
@ -997,7 +997,7 @@ else
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label', 'alphanohtml')).'"></td></tr>';
// On sell
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';

View File

@ -129,7 +129,12 @@ else $result = restrictedArea($user, 'produit|service', '', '', '', '', '', $obj
// Define virtualdiffersfromphysical
$virtualdiffersfromphysical = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION))
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled))
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}

View File

@ -78,7 +78,12 @@ if (!empty($canvas))
// Define virtualdiffersfromphysical
$virtualdiffersfromphysical = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION))
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled))
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}

View File

@ -714,6 +714,8 @@ class Entrepot extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto = 0;
$result = '';
$label = '<u>'.$langs->trans("Warehouse").'</u>';

View File

@ -909,6 +909,7 @@ if (!$variants) {
print "\n".'<tr>';
print '<td colspan="9">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="pdluoid" value="'.$pdluo->id.'"><input type="hidden" name="action" value="updateline"><input type="hidden" name="id" value="'.$id.'"><table class="noborder centpercent"><tr><td width="10%"></td>';
print '<td class="right" width="10%"><input type="text" name="batch_number" value="'.$pdluo->batch.'"></td>';
print '<td class="center" width="10%">';
@ -976,6 +977,7 @@ if (!$variants) {
if (!empty($user->rights->produit->creer)) {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="addlimitstockwarehouse">';
print '<input type="hidden" name="id" value="'.$id.'">';
}

View File

@ -82,10 +82,11 @@ if (!$sortorder) {
// Define virtualdiffersfromphysical
$virtualdiffersfromphysical = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled))
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
@ -98,6 +99,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*
* Actions
*/
@ -106,7 +108,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
{
$sref = '';
$snom = '';
$sal = '';
$sall = '';
$salert = '';
$draftorder = '';
}
@ -303,7 +305,6 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
$sqlalertstock = 'p.seuil_stock_alerte';
}
$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
$sql .= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
$sql .= ' p.tms as datem, p.duration, p.tobuy,';
@ -376,8 +377,11 @@ if ($usevirtualstock)
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commande as c2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2";
$sqlExpeditionsCli .= " WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_origin_line AND e2.entity IN (".getEntity('expedition').")";
$sqlExpeditionsCli .= " AND cd2.fk_commande = c2.rowid";
$sqlExpeditionsCli .= " AND c2.fk_statut IN (1,2)";
$sqlExpeditionsCli .= " AND cd2.fk_product = p.rowid";
$sqlExpeditionsCli .= " AND e2.fk_statut IN (1,2))";
} else {
@ -491,6 +495,9 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock');
dol_fiche_head($head, 'replenish', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span><br>'."\n";
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."<br>\n";
}
if ($usevirtualstock == 1)
{
print $langs->trans("CurentSelectionMode").': ';

View File

@ -526,7 +526,7 @@ $listofreferent = array(
*/
);
// Change rules for benefit calculation
// Change rules for profit/benefit calculation
if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) {
foreach($listofreferent as $key => $element) {
if ($listofreferent[$key]['margin'] == 'add') {
@ -624,7 +624,28 @@ print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="left" width="200">'.$langs->trans("Element").'</td>';
print '<td class="left" width="200">';
$tooltiponprofit = $langs->trans("ProfitIsCalculatedWith")."<br>\n";
$tooltiponprofitplus = $tooltiponprofitminus = '';
foreach($listofreferent as $key => $value)
{
$name = $langs->trans($value['name']);
$qualified = $value['test'];
$margin = $value['margin'];
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add')
{
if ($margin == 'add') {
$tooltiponprofitplus.=' + '.$name."<br>\n";
}
if ($margin == 'minus') {
$tooltiponprofitminus.=' - '.$name."<br>\n";
}
}
}
$tooltiponprofit .= $tooltiponprofitplus;
$tooltiponprofit .= $tooltiponprofitminus;
print $form->textwithpicto($langs->trans("Element"), $tooltiponprofit);
print '</td>';
print '<td class="right" width="100">'.$langs->trans("Number").'</td>';
print '<td class="right" width="100">'.$langs->trans("AmountHT").'</td>';
print '<td class="right" width="100">'.$langs->trans("AmountTTC").'</td>';
@ -640,7 +661,7 @@ foreach ($listofreferent as $key => $value)
$qualified = $value['test'];
$margin = $value['margin'];
$project_field = $value['project_field'];
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus')
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add')
{
$element = new $classname($db);

View File

@ -396,23 +396,23 @@ if (empty($reshook))
if (GETPOST("private", 'int') == 1) // Ask to create a contact
{
$object->particulier = GETPOST("private");
$object->particulier = GETPOST("private", 'int');
$object->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('name', 'alpha'));
$object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int
$object->name = dolGetFirstLastname(GETPOST('firstname', 'alphanohtml'), GETPOST('name', 'alphanohtml'));
$object->civility_id = GETPOST('civility_id', 'alphanohtml'); // Note: civility id is a code, not an int
// Add non official properties
$object->name_bis = GETPOST('name', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha');
$object->name_bis = GETPOST('name', 'alphanohtml');
$object->firstname = GETPOST('firstname', 'alphanohtml');
}
else
{
$object->name = GETPOST('name', 'alpha');
$object->name = GETPOST('name', 'alphanohtml');
}
$object->entity = (GETPOSTISSET('entity') ?GETPOST('entity', 'int') : $conf->entity);
$object->name_alias = GETPOST('name_alias');
$object->address = GETPOST('address');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : $conf->entity);
$object->name_alias = GETPOST('name_alias', 'alphanohtml');
$object->address = GETPOST('address', 'alphanohtml');
$object->zip = GETPOST('zipcode', 'alphanohtml');
$object->town = GETPOST('town', 'alphanohtml');
$object->country_id = GETPOST('country_id', 'int');
$object->state_id = GETPOST('state_id', 'int');
//$object->skype = GETPOST('skype', 'alpha');
@ -431,19 +431,19 @@ if (empty($reshook))
$object->fax = GETPOST('fax', 'alpha');
$object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL));
$object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
$object->idprof1 = trim(GETPOST('idprof1', 'alpha'));
$object->idprof2 = trim(GETPOST('idprof2', 'alpha'));
$object->idprof3 = trim(GETPOST('idprof3', 'alpha'));
$object->idprof4 = trim(GETPOST('idprof4', 'alpha'));
$object->idprof5 = trim(GETPOST('idprof5', 'alpha'));
$object->idprof6 = trim(GETPOST('idprof6', 'alpha'));
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');
$object->idprof1 = trim(GETPOST('idprof1', 'alphanohtml'));
$object->idprof2 = trim(GETPOST('idprof2', 'alphanohtml'));
$object->idprof3 = trim(GETPOST('idprof3', 'alphanohtml'));
$object->idprof4 = trim(GETPOST('idprof4', 'alphanohtml'));
$object->idprof5 = trim(GETPOST('idprof5', 'alphanohtml'));
$object->idprof6 = trim(GETPOST('idprof6', 'alphanohtml'));
$object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
$object->code_client = GETPOSTISSET('customer_code') ?GETPOST('customer_code', 'alpha') : GETPOST('code_client', 'alpha');
$object->code_fournisseur = GETPOSTISSET('supplier_code') ?GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha');
$object->capital = GETPOST('capital', 'alpha');
$object->barcode = GETPOST('barcode', 'alpha');
$object->capital = GETPOST('capital', 'alphanohtml');
$object->barcode = GETPOST('barcode', 'alphanohtml');
$object->tva_intra = GETPOST('tva_intra', 'alpha');
$object->tva_intra = GETPOST('tva_intra', 'alphanohtml');
$object->tva_assuj = GETPOST('assujtva_value', 'alpha');
$object->status = GETPOST('status', 'alpha');
@ -978,16 +978,16 @@ else
if (GETPOST("type") == 'p') { $object->client = 2; }
if (!empty($conf->fournisseur->enabled) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; }
$object->name = GETPOST('name', 'alpha');
$object->name_alias = GETPOST('name_alias', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha');
$object->name = GETPOST('name', 'alphanohtml');
$object->name_alias = GETPOST('name_alias', 'alphanohtml');
$object->firstname = GETPOST('firstname', 'alphanohtml');
$object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');
$object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
$object->client = GETPOST('client', 'int') ?GETPOST('client', 'int') : $object->client;
if (empty($duplicate_code_error)) {
$object->code_client = GETPOST('customer_code', 'alpha');
$object->fournisseur = GETPOST('fournisseur') ?GETPOST('fournisseur') : $object->fournisseur;
$object->fournisseur = GETPOST('fournisseur') ? GETPOST('fournisseur', 'int') : $object->fournisseur;
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
}
else {
@ -995,9 +995,9 @@ else
}
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->address = GETPOST('address', 'alphanohtml');
$object->zip = GETPOST('zipcode', 'alphanohtml');
$object->town = GETPOST('town', 'alphanohtml');
$object->state_id = GETPOST('state_id', 'int');
//$object->skype = GETPOST('skype', 'alpha');
//$object->twitter = GETPOST('twitter', 'alpha');
@ -1015,14 +1015,14 @@ else
$object->fax = GETPOST('fax', 'alpha');
$object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
$object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL);
$object->capital = GETPOST('capital', 'alpha');
$object->barcode = GETPOST('barcode', 'alpha');
$object->idprof1 = GETPOST('idprof1', 'alpha');
$object->idprof2 = GETPOST('idprof2', 'alpha');
$object->idprof3 = GETPOST('idprof3', 'alpha');
$object->idprof4 = GETPOST('idprof4', 'alpha');
$object->idprof5 = GETPOST('idprof5', 'alpha');
$object->idprof6 = GETPOST('idprof6', 'alpha');
$object->capital = GETPOST('capital', 'alphanohtml');
$object->barcode = GETPOST('barcode', 'alphanohtml');
$object->idprof1 = GETPOST('idprof1', 'alphanohtml');
$object->idprof2 = GETPOST('idprof2', 'alphanohtml');
$object->idprof3 = GETPOST('idprof3', 'alphanohtml');
$object->idprof4 = GETPOST('idprof4', 'alphanohtml');
$object->idprof5 = GETPOST('idprof5', 'alphanohtml');
$object->idprof6 = GETPOST('idprof6', 'alphanohtml');
$object->typent_id = GETPOST('typent_id', 'int');
$object->effectif_id = GETPOST('effectif_id', 'int');
$object->civility_id = GETPOST('civility_id', 'alpha');
@ -1037,7 +1037,7 @@ else
$object->localtax1_value = GETPOST('lt1', 'int');
$object->localtax2_value = GETPOST('lt2', 'int');
$object->tva_intra = GETPOST('tva_intra', 'alpha');
$object->tva_intra = GETPOST('tva_intra', 'alphanohtml');
$object->commercial_id = GETPOST('commercial_id', 'int');
$object->default_lang = GETPOST('default_lang');
@ -1268,7 +1268,7 @@ else
print '<td>'.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).'</td><td>';
$default = -1;
if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default = 1;
print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ?GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0));
print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ? GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0));
print '</td>';
@ -1640,15 +1640,15 @@ else
if (GETPOSTISSET('name'))
{
// We overwrite with values if posted
$object->name = GETPOST('name', 'alpha');
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');
$object->name = GETPOST('name', 'alphanohtml');
$object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
$object->client = GETPOST('client', 'int');
$object->code_client = GETPOST('customer_code', 'alpha');
$object->fournisseur = GETPOST('fournisseur', 'int');
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->address = GETPOST('address', 'alphanohtml');
$object->zip = GETPOST('zipcode', 'alphanohtml');
$object->town = GETPOST('town', 'alphanohtml');
$object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id;
$object->state_id = GETPOST('state_id', 'int');
//$object->skype = GETPOST('skype', 'alpha');
@ -1667,21 +1667,21 @@ else
$object->fax = GETPOST('fax', 'alpha');
$object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
$object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL);
$object->capital = GETPOST('capital', 'alpha');
$object->idprof1 = GETPOST('idprof1', 'alpha');
$object->idprof2 = GETPOST('idprof2', 'alpha');
$object->idprof3 = GETPOST('idprof3', 'alpha');
$object->idprof4 = GETPOST('idprof4', 'alpha');
$object->idprof5 = GETPOST('idprof5', 'alpha');
$object->idprof6 = GETPOST('idprof6', 'alpha');
$object->capital = GETPOST('capital', 'alphanohtml');
$object->idprof1 = GETPOST('idprof1', 'alphanohtml');
$object->idprof2 = GETPOST('idprof2', 'alphanohtml');
$object->idprof3 = GETPOST('idprof3', 'alphanohtml');
$object->idprof4 = GETPOST('idprof4', 'alphanohtml');
$object->idprof5 = GETPOST('idprof5', 'alphanohtml');
$object->idprof6 = GETPOST('idprof6', 'alphanohtml');
$object->typent_id = GETPOST('typent_id', 'int');
$object->effectif_id = GETPOST('effectif_id', 'int');
$object->barcode = GETPOST('barcode', 'alpha');
$object->barcode = GETPOST('barcode', 'alphanohtml');
$object->forme_juridique_code = GETPOST('forme_juridique_code', 'int');
$object->default_lang = GETPOST('default_lang', 'alpha');
$object->tva_assuj = GETPOST('assujtva_value', 'int');
$object->tva_intra = GETPOST('tva_intra', 'alpha');
$object->tva_intra = GETPOST('tva_intra', 'alphanohtml');
$object->status = GETPOST('status', 'int');
// Webservices url/key

View File

@ -83,7 +83,8 @@ class Societe extends CommonObject
);
/**
* @var array List of child tables. To know object to delete on cascade.
* @var array List of child tables. To know object to delete on cascade.
* if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object
*/
protected $childtablesoncascade = array(
"societe_prices",
@ -91,7 +92,7 @@ class Societe extends CommonObject
"product_fournisseur_price",
"product_customer_price_log",
"product_customer_price",
"socpeople",
"@Contact:/contact/class/contact.class.php:fk_soc",
"adherent",
"societe_account",
"societe_rib",
@ -1762,16 +1763,36 @@ class Societe extends CommonObject
}
}
foreach ($this->childtablesoncascade as $tabletodelete)
if (!$error)
{
if (!$error)
foreach ($this->childtablesoncascade as $tabletodelete)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabletodelete;
$sql .= " WHERE fk_soc = ".$id;
if (!$this->db->query($sql))
{
$error++;
$this->errors[] = $this->db->lasterror();
$deleteFromObject=explode(':', $tabletodelete);
if (count($deleteFromObject)>=2) {
$className=str_replace('@', '', $deleteFromObject[0]);
$filepath=$deleteFromObject[1];
$columnName=$deleteFromObject[2];
if (dol_include_once($filepath)) {
$child_object = new $className($this->db);
$result = $child_object->deleteByParentField($id, $columnName);
if ($result < 0) {
$error++;
$this->errors[] = $child_object->error;
break;
}
} else {
$error++;
$this->errors[] = 'Cannot include child class file ' .$filepath;
break;
}
} else {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete;
$sql .= " WHERE fk_soc = " . $id;
if (!$this->db->query($sql)) {
$error++;
$this->errors[] = $this->db->lasterror();
break;
}
}
}
}
@ -3860,7 +3881,6 @@ class Societe extends CommonObject
elseif ($localTaxNum == 1) $sql .= " AND t.localtax1_type <> '0'";
elseif ($localTaxNum == 2) $sql .= " AND t.localtax2_type <> '0'";
dol_syslog("useLocalTax", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -1660,6 +1660,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
// Show fields of bank account
foreach ($companybankaccount->getFieldsToShow(1) as $val) {
$require = false;
$tooltip = '';
if ($val == 'BankCode') {
$name = 'code_banque';
$size = 8;
@ -1681,14 +1682,22 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
$size = 30;
$content = $companybankaccount->iban;
if ($companybankaccount->needIBAN()) $require = true;
$tooltip = $langs->trans("Example").':<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
} elseif ($val == 'BIC') {
$name = 'bic';
$size = 12;
$content = $companybankaccount->bic;
if ($companybankaccount->needIBAN()) $require = true;
$tooltip = $langs->trans("Example").': LIABLT2XXXX';
}
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>'.$langs->trans($val).'</td>';
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>';
if ($tooltip) {
print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name);
} else {
print $langs->trans($val);
}
print '</td>';
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
print '</tr>';
}

View File

@ -1,5 +1,6 @@
<?php
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet');
?>
/* Badge style is based on boostrap framework */
.badge {

View File

@ -186,11 +186,9 @@ a.top-menu-dropdown-link {
}
.dropdown-menu > .user-header{
background: rgb(<?php echo $colorbackhmenu1 ?>);
background: var(--colorbackhmenu1);
}
.dropdown-menu .dropdown-header{
padding: 8px 8px 8px 8px;
}

View File

@ -155,6 +155,9 @@ input[name=duration_value]
input[type=submit], input[type=submit]:hover {
margin-left: 5px;
}
input[type=checkbox], input[type=radio] {
margin: 0 3px 0 3px;
}
input, input.flat, form.flat select, select, select.flat, .dataTables_length label select {
border: none;
}
@ -419,8 +422,8 @@ hr { border: 0; border-top: 1px solid #ccc; }
.tabBar hr { margin-top: 20px; margin-bottom: 17px; }
.button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) {
margin-bottom: 0;
margin-top: 0;
margin-bottom: 3px;
margin-top: 3px;
margin-left: 5px;
margin-right: 5px;
font-family: <?php print $fontlist ?>;
@ -1158,6 +1161,10 @@ table[summary="list_of_modules"] .fa-cog {
width: calc(100% - 30px) !important;
display: inline-block;
}
/*img.photoref, div.photoref {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}*/
}
/* Force values for small screen 570 */
@ -1270,9 +1277,9 @@ table[summary="list_of_modules"] .fa-cog {
padding-bottom: 5px;
}
img.photoref, div.photoref {
border: none;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
padding: 4px;
height: 20px;
width: 20px;
@ -1369,7 +1376,7 @@ td.showDragHandle {
.side-nav {
display: table-cell;
border-<?php echo $right; ?>: 1px solid #d0d0d0;
border-<?php echo $right; ?>: 1px solid #E0E0E0;
box-shadow: 3px 0 6px -2px #eee;
background: var(--colorbackvmenu1);
transition: left 0.5s ease;
@ -4309,7 +4316,7 @@ span[phptag] {
}
.websitebar .button, .websitebar .buttonDelete
{
padding: 2px 5px 3px 5px !important;
padding: 4px 5px 4px 5px !important;
margin: 2px 4px 2px 4px !important;
line-height: normal;
background: #f5f5f5 !important;

View File

@ -146,11 +146,11 @@ div.mainmenu.generic4::before {
/* Define color of some picto */
.fa-phone, .fa-mobile-alt, .fa-fax {
opacity: 0.5;
opacity: 0.7;
color: #440;
}
.fa-at, .fa-external-link-alt {
opacity: 0.5;
opacity: 0.7;
color: #304;
}
.fa-trash {

View File

@ -140,6 +140,7 @@ if (empty($reshook)) {
header("Location: " . $backtopage);
exit;
}
$action = 'view';
}
@ -147,11 +148,11 @@ if (empty($reshook)) {
if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
$error = 0;
if (!GETPOST("subject", 'alpha')) {
if (!GETPOST("subject", 'alphanohtml')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")), null, 'errors');
$action = 'create';
} elseif (!GETPOST("message", 'alpha')) {
} elseif (!GETPOST("message", 'restricthtml')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
$action = 'create';
@ -160,10 +161,10 @@ if (empty($reshook)) {
if (!$error) {
$db->begin();
$object->ref = GETPOST("ref", 'alpha');
$object->ref = GETPOST("ref", 'alphanohtml');
$object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0;
$object->subject = GETPOST("subject", 'alpha');
$object->message = GETPOST("message", 'none');
$object->subject = GETPOST("subject", 'alphanohtml');
$object->message = GETPOST("message", 'restricthtml');
$object->type_code = GETPOST("type_code", 'alpha');
$object->category_code = GETPOST("category_code", 'alpha');
@ -288,7 +289,7 @@ if (empty($reshook)) {
$error++;
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")));
$action = 'edit';
} elseif (!GETPOST("subject")) {
} elseif (!GETPOST("subject", 'alphanohtml')) {
$error++;
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
$action = 'edit';
@ -298,7 +299,7 @@ if (empty($reshook)) {
$db->begin();
$object->label = GETPOST("label", 'alphanohtml');
$object->description = GETPOST("description", 'none');
$object->description = GETPOST("description", 'restricthtml');
//...
$ret = $object->update($user);
@ -470,7 +471,7 @@ if (empty($reshook)) {
if ($action == 'setsubject') {
if ($object->fetch(GETPOST('id', 'int'))) {
if ($action == 'setsubject') {
$object->subject = trim(GETPOST('subject', 'alpha'));
$object->subject = trim(GETPOST('subject', 'alphanohtml'));
}
if ($action == 'setsubject' && empty($object->subject)) {
@ -523,7 +524,7 @@ if (empty($reshook)) {
if (!GETPOST('cancel')) {
$object->fetch('', '', GETPOST('track_id', 'alpha'));
$oldvalue_message = $object->message;
$fieldtomodify = GETPOST('message_initial');
$fieldtomodify = GETPOST('message_initial', 'restricthtml');
$object->message = $fieldtomodify;
$ret = $object->update($user);

View File

@ -1635,32 +1635,36 @@ else
print "</tr>\n";
// Expense report validator
print '<tr><td>';
$text = $langs->trans("ForceUserExpenseValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if (!empty($object->fk_user_expense_validator)) {
$evuser = new User($db);
$evuser->fetch($object->fk_user_expense_validator);
print $evuser->getNomUrl(1);
if (!empty($conf->expensereport->enabled)) {
print '<tr><td>';
$text = $langs->trans("ForceUserExpenseValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if (!empty($object->fk_user_expense_validator)) {
$evuser = new User($db);
$evuser->fetch($object->fk_user_expense_validator);
print $evuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
}
print '</td>';
print "</tr>\n";
// Holiday request validator
print '<tr><td>';
$text = $langs->trans("ForceUserHolidayValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if (!empty($object->fk_user_holiday_validator)) {
$hvuser = new User($db);
$hvuser->fetch($object->fk_user_holiday_validator);
print $hvuser->getNomUrl(1);
if (!empty($conf->holiday->enabled)) {
print '<tr><td>';
$text = $langs->trans("ForceUserHolidayValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if (!empty($object->fk_user_holiday_validator)) {
$hvuser = new User($db);
$hvuser->fetch($object->fk_user_holiday_validator);
print $hvuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
}
print '</td>';
print "</tr>\n";
// Default warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->USER_DEFAULT_WAREHOUSE)) // TODO What is goal of this. How it is used ?
@ -2362,44 +2366,42 @@ else
print "</tr>\n";
// Expense report validator
print '<tr><td class="titlefield">';
$text = $langs->trans("ForceUserExpenseValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if ($caneditfield)
{
print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
if (!empty($conf->expensereport->enabled)) {
print '<tr><td class="titlefield">';
$text = $langs->trans("ForceUserExpenseValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if ($caneditfield) {
print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
} else {
print '<input type="hidden" name="fk_user_expense_validator" value="' . $object->fk_user_expense_validator . '">';
$evuser = new User($db);
$evuser->fetch($object->fk_user_expense_validator);
print $evuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
}
else
{
print '<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.'">';
$evuser = new User($db);
$evuser->fetch($object->fk_user_expense_validator);
print $evuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
// Holiday request validator
print '<tr><td class="titlefield">';
$text = $langs->trans("ForceUserHolidayValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if ($caneditfield)
{
print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
if (!empty($conf->holiday->enabled)) {
print '<tr><td class="titlefield">';
$text = $langs->trans("ForceUserHolidayValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
print '<td>';
if ($caneditfield) {
print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
} else {
print '<input type="hidden" name="fk_user_holiday_validator" value="' . $object->fk_user_holiday_validator . '">';
$hvuser = new User($db);
$hvuser->fetch($object->fk_user_holiday_validator);
print $hvuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
}
else
{
print '<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.'">';
$hvuser = new User($db);
$hvuser->fetch($object->fk_user_holiday_validator);
print $hvuser->getNomUrl(1);
}
print '</td>';
print "</tr>\n";
print '</table><hr><table class="border centpercent">';

View File

@ -1274,7 +1274,7 @@ class Website extends CommonObject
* Rebuild all files of a containers of a website. TODO Add other files too.
* Note: Files are already regenerated during importWebSite so this function is useless when importing a website.
*
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >=0 if OK
*/
public function rebuildWebSiteFiles()
{
@ -1344,7 +1344,7 @@ class Website extends CommonObject
}
else
{
return 1;
return $num;
}
}
@ -1459,6 +1459,7 @@ class Website extends CommonObject
$url = preg_replace('/(\?|&)l=([a-zA-Z_]*)/', '', $url); // We remove param l from url
//$url = preg_replace('/(\?|&)lang=([a-zA-Z_]*)/', '', $url); // We remove param lang from url
$url .= (preg_match('/\?/', $url) ? '&' : '?').'l=';
if (! preg_match('/^\//', $url)) $url = '/'.$url;
$HEIGHTOPTION = 40;
$MAXHEIGHT = 4 * $HEIGHTOPTION;
@ -1498,7 +1499,7 @@ class Website extends CommonObject
$countrycode = strtolower(substr($languagecodeselected, -2));
$label = $weblangs->trans("Language_".$languagecodeselected);
if ($countrycode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
$out .= '<a href="'.$url.substr($languagecodeselected, 0, 2).'"><li><img height="12px" src="medias/image/common/flags/'.$countrycode.'.png" style="margin-right: 5px;"/><span class="websitecomponentlilang">'.$label.'</span>';
$out .= '<a href="'.$url.substr($languagecodeselected, 0, 2).'"><li><img height="12px" src="/medias/image/common/flags/'.$countrycode.'.png" style="margin-right: 5px;"/><span class="websitecomponentlilang">'.$label.'</span>';
$out .= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
$out .= '</li></a>';
}
@ -1517,7 +1518,7 @@ class Website extends CommonObject
$countrycode = strtolower(substr($languagecode, -2));
$label = $weblangs->trans("Language_".$languagecode);
if ($countrycode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
$out .= '<a href="'.$url.substr($languagecode, 0, 2).'"><li><img height="12px" src="medias/image/common/flags/'.$countrycode.'.png" style="margin-right: 5px;"/><span class="websitecomponentlilang">'.$label.'</span>';
$out .= '<a href="'.$url.substr($languagecode, 0, 2).'"><li><img height="12px" src="/medias/image/common/flags/'.$countrycode.'.png" style="margin-right: 5px;"/><span class="websitecomponentlilang">'.$label.'</span>';
if (empty($i) && empty($languagecodeselected)) $out .= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
$out .= '</li></a>';
$i++;

View File

@ -49,6 +49,7 @@ class WebsitePage extends CommonObject
*/
public $picto = 'file-code';
/**
* @var int ID
*/
@ -164,6 +165,35 @@ class WebsitePage extends CommonObject
// END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines
/**
* @var int Name of subtable line
*/
//public $table_element_line = 'mymodule_myobjectline';
/**
* @var int Field with ID of parent key if this object has a parent
*/
public $fk_element = 'fk_website';
/**
* @var int Name of subtable class that manage subtable lines
*/
//public $class_element_line = 'MyObjectline';
/**
* @var array List of child tables. To test if we can delete object.
*/
//protected $childtables=array();
/**
* @var array List of child tables. To know object to delete on cascade.
*/
protected $childtablesoncascade = array('categorie_website_page');
/**
* Constructor
*
@ -523,9 +553,33 @@ class WebsitePage extends CommonObject
*/
public function delete(User $user, $notrigger = false)
{
$result = $this->deleteCommon($user, $trigger);
$error = 0;
if ($result > 0)
// Delete all child tables
if (!$error) {
foreach ($this->childtablesoncascade as $table)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
$sql .= " WHERE fk_website_page = ".(int) $this->id;
$result = $this->db->query($sql);
if (!$result) {
$error++;
$this->errors[] = $this->db->lasterror();
break;
}
}
}
if (!$error) {
$result = $this->deleteCommon($user, $trigger);
if ($result > 0)
{
$error++;
}
}
if (!$error)
{
$websiteobj = new Website($this->db);
$result = $websiteobj->fetch($this->fk_website);

View File

@ -884,15 +884,15 @@ if ($action == 'addcontainer')
}
else
{
$objectpage->title = GETPOST('WEBSITE_TITLE', 'alphanohtml');
$objectpage->title = str_replace(array('<', '>'), '', GETPOST('WEBSITE_TITLE', 'alphanohtml'));
$objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'aZ09');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha');
$objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alphanohtml');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml');
$objectpage->aliasalt = str_replace(array('<', '>'), '', GETPOST('WEBSITE_ALIASALT', 'alphanohtml'));
$objectpage->description = str_replace(array('<', '>'), '', GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'));
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
$objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma');
$objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha');
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml');
$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
$objectpage->htmlheader = GETPOST('htmlheader', 'none');
$objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml');
@ -1561,22 +1561,31 @@ if ($action == 'updatemeta')
$websitepagetemp = new WebsitePage($db);
foreach ($arrayofaliastotest as $aliastotest)
{
$result = $websitepagetemp->fetch(-1 * $objectpage->id, $object->id, $aliastotest);
if ($result < 0)
{
// Disallow alias name pageX (already used to save the page with id)
if (preg_match('/^page\d+/i', $aliastotest)) {
$error++;
$langs->load("errors");
setEventMessages($websitepagetemp->error, $websitepagetemp->errors, 'errors');
$action = 'editmeta';
break;
}
if ($result > 0)
{
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorAPageWithThisNameOrAliasAlreadyExists", $websitepagetemp->pageurl), null, 'errors');
setEventMessages("Alias 'pageX' is not allowed", null, 'errors');
$action = 'editmeta';
break;
} else {
$result = $websitepagetemp->fetch(-1 * $objectpage->id, $object->id, $aliastotest);
if ($result < 0)
{
$error++;
$langs->load("errors");
setEventMessages($websitepagetemp->error, $websitepagetemp->errors, 'errors');
$action = 'editmeta';
break;
}
if ($result > 0)
{
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorAPageWithThisNameOrAliasAlreadyExists", $websitepagetemp->pageurl), null, 'errors');
$action = 'editmeta';
break;
}
}
}
}
@ -1585,15 +1594,15 @@ if ($action == 'updatemeta')
{
$objectpage->old_object = clone $objectpage;
$objectpage->title = GETPOST('WEBSITE_TITLE', 'alphanohtml');
$objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alphanohtml');
$objectpage->title = str_replace(array('<', '>'), '', GETPOST('WEBSITE_TITLE', 'alphanohtml'));
$objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'aZ09');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha');
$objectpage->aliasalt = GETPOST('WEBSITE_ALIASALT', 'alpha');
$objectpage->aliasalt = str_replace(array('<', '>'), '', GETPOST('WEBSITE_ALIASALT', 'alphanohtml'));
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
$objectpage->otherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml');
$objectpage->description = str_replace(array('<', '>'), '', GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'));
$objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha');
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml');
$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
$objectpage->htmlheader = trim(GETPOST('htmlheader', 'none'));
$objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0);
$objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'));
@ -2023,7 +2032,7 @@ if ($action == 'regeneratesite')
$result = $object->rebuildWebSiteFiles();
if ($result > 0)
{
setEventMessages($langs->trans("PagesRegenerated"), null, 'mesgs');
setEventMessages($langs->trans("PagesRegenerated", $result), null, 'mesgs');
$action = 'preview';
}
else
@ -2532,9 +2541,12 @@ if (!GETPOST('hide_websitemenu'))
// Confirmation to clone
if ($action == 'createpagefromclone') {
// Create an array for form
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
$preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ''; // Dy default, we do not force any language on pages
$onlylang = array();
if ($website->otherlang) {
if (! empty($website->lang)) {
$onlylang[$website->lang] = $website->lang;
}
foreach (explode(',', $website->otherlang) as $langkey) {
$onlylang[$langkey] = $langkey;
}
@ -2627,11 +2639,11 @@ if (!GETPOST('hide_websitemenu'))
//print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
if (empty($conf->global->WEBSITE_EDITINLINE))
{
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
else
{
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
}
@ -2640,11 +2652,11 @@ if (!GETPOST('hide_websitemenu'))
print $langs->trans("ShowSubcontainers");
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
else
{
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
/*}*/
print '</div>';
@ -3287,14 +3299,14 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pageauthoralias = '';
$pagestatus = 1;
}
if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha');
if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = str_replace(array('<', '>'), '', GETPOST('WEBSITE_TITLE', 'alphanohtml'));
if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha');
if (GETPOST('WEBSITE_ALIASALT', 'alpha')) $pagealiasalt = GETPOST('WEBSITE_ALIASALT', 'alpha');
if (GETPOST('WEBSITE_DESCRIPTION', 'alpha')) $pagedescription = GETPOST('WEBSITE_DESCRIPTION', 'alpha');
if (GETPOST('WEBSITE_ALIASALT', 'alpha')) $pagealiasalt = str_replace(array('<', '>'), '', GETPOST('WEBSITE_ALIASALT', 'alphanohtml'));
if (GETPOST('WEBSITE_DESCRIPTION', 'alpha')) $pagedescription = str_replace(array('<', '>'), '', GETPOST('WEBSITE_DESCRIPTION', 'alphanohtml'));
if (GETPOST('WEBSITE_IMAGE', 'alpha')) $pageimage = GETPOST('WEBSITE_IMAGE', 'alpha');
if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09');
if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none');
if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none');
// Type of container
print '<tr><td class="titlefield fieldrequired">';
@ -3339,8 +3351,10 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_IMAGE" value="'.dol_escape_htmltag($pageimage).'">';
print '</td></tr>';
// Keywords
print '<tr><td>';
print $langs->trans('WEBSITE_KEYWORDS');
$htmlhelp = $langs->trans("WEBSITE_KEYWORDSDesc");
print $form->textwithpicto($langs->trans('WEBSITE_KEYWORDS'), $htmlhelp, 1, 'help', '', 0, 2, 'keywordtooltip');
print '</td><td>';
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_KEYWORDS" value="'.dol_escape_htmltag($pagekeywords).'">';
print '</td></tr>';

View File

@ -46,7 +46,7 @@ function websiteaccountPrepareHead($object)
if(!empty($object->fields['note_public'])) $nbNote++;
$head[$h][0] = dol_buildpath('/monmodule/websiteaccount_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
if ($nbNote > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
$head[$h][2] = 'note';
$h++;
}*/
@ -59,7 +59,7 @@ function websiteaccountPrepareHead($object)
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/monmodule/websiteaccount_document.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>' : '');
$head[$h][2] = 'document';
$h++;

View File

@ -67,7 +67,7 @@ $websitepagestatic = new WebsitePage($db);
$db->begin();
$listofpages = $websitepagestatic->fetchAll($website->id, '', $max);
$listofpages = $websitepagestatic->fetchAll($website->id, '', '', $max);
global $dolibarr_main_data_root;
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref;