forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -40,6 +40,7 @@ $langs->loadLangs(array('admin', 'companies'));
|
|||||||
if (!$user->admin) {
|
if (!$user->admin) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
$listofnetworks = getArrayOfSocialNetworks();
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('adminsocialnetworkscompany', 'globaladmin'));
|
$hookmanager->initHooks(array('adminsocialnetworkscompany', 'globaladmin'));
|
||||||
@@ -53,14 +54,26 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
|||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
|
if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FACEBOOK_URL", GETPOST("facebookurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
foreach ($listofnetworks as $key => $value) {
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TWITTER_URL", GETPOST("twitterurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
if (!empty($value['active'])) {
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LINKEDIN_URL", GETPOST("linkedinurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_INSTAGRAM_URL", GETPOST("instagramurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_YOUTUBE_URL", GETPOST("youtubeurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
if (GETPOSTISSET($key.'url') && GETPOST($key.'url', 'alpha') != '') {
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GITHUB_URL", GETPOST("githuburl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $networkconstname, GETPOST($key.'url', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, $networkconstid, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
} elseif (GETPOSTISSET($key) && GETPOST($key, 'alpha') != '') {
|
||||||
|
if (!empty($listofnetworks[$key]['url'])) {
|
||||||
|
$url = str_replace('{socialid}', GETPOST($key, 'alpha'), $listofnetworks[$key]['url']);
|
||||||
|
dolibarr_set_const($db, $networkconstname, $url, 'chaine', 0, '', $conf->entity);
|
||||||
|
}
|
||||||
|
dolibarr_set_const($db, $networkconstid, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
} else {
|
||||||
|
dolibarr_del_const($db, $networkconstname, $conf->entity);
|
||||||
|
dolibarr_del_const($db, $networkconstid, $conf->entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,25 +106,24 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table class="noborder centpercent editmode">';
|
print '<table class="noborder centpercent editmode">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$listofnetworks = array(
|
|
||||||
'facebook'=>'facebook',
|
|
||||||
'twitter'=>'twitter',
|
|
||||||
'linkedin'=>'linkedin',
|
|
||||||
'instagram'=>'instagram',
|
|
||||||
'youtube'=>'youtube',
|
|
||||||
'github'=>'github'
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($listofnetworks as $networkkey => $networkicon) {
|
foreach ($listofnetworks as $key => $value) {
|
||||||
print '<tr class="oddeven"><td>';
|
if (!empty($value['active'])) {
|
||||||
print '<label for="'.$networkkey.'url">'.$langs->trans("SocialNetworks".ucfirst($networkkey)."URL").'</label></td><td>';
|
print '<tr class="oddeven">';
|
||||||
$networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL';
|
print '<td><label for="'.$key.'url">'.$langs->trans(ucfirst($key)).'</label></td>';
|
||||||
print '<span class="fa paddingright fa-'.($networkicon ? $networkicon : 'link').'"></span>';
|
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
|
||||||
print '<input name="'.$networkkey.'url" id="'.$networkkey.'url" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconst).'"></td></tr>';
|
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
|
||||||
print '</td></tr>'."\n";
|
print '<td><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
|
||||||
|
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstname).'">';
|
||||||
|
print '</td><td>';
|
||||||
|
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstid).'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td>'.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).'</td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@@ -694,17 +694,14 @@ abstract class CommonObject
|
|||||||
$contactid = 0;
|
$contactid = 0;
|
||||||
$thirdpartyid = 0;
|
$thirdpartyid = 0;
|
||||||
$elementforaltlanguage = $this->element;
|
$elementforaltlanguage = $this->element;
|
||||||
if ($this->element == 'societe')
|
if ($this->element == 'societe') {
|
||||||
{
|
|
||||||
$thirdpartyid = $this->id;
|
$thirdpartyid = $this->id;
|
||||||
}
|
}
|
||||||
if ($this->element == 'contact')
|
if ($this->element == 'contact') {
|
||||||
{
|
|
||||||
$contactid = $this->id;
|
$contactid = $this->id;
|
||||||
$thirdpartyid = $object->fk_soc;
|
$thirdpartyid = $object->fk_soc;
|
||||||
}
|
}
|
||||||
if ($this->element == 'user')
|
if ($this->element == 'user') {
|
||||||
{
|
|
||||||
$contactid = $this->contact_id;
|
$contactid = $this->contact_id;
|
||||||
$thirdpartyid = $object->fk_soc;
|
$thirdpartyid = $object->fk_soc;
|
||||||
}
|
}
|
||||||
@@ -773,46 +770,51 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if (!empty($this->phone) || !empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) $out .= ($outdone ? '<br>' : '');
|
if (!empty($this->phone) || !empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) $out .= ($outdone ? '<br>' : '');
|
||||||
if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
|
if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
|
||||||
$out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
|
$out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->phone_pro)) {
|
if (!empty($this->phone_pro)) {
|
||||||
$out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
|
$out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->phone_mobile)) {
|
if (!empty($this->phone_mobile)) {
|
||||||
$out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile")); $outdone++;
|
$out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->phone_perso)) {
|
if (!empty($this->phone_perso)) {
|
||||||
$out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso")); $outdone++;
|
$out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->office_phone)) {
|
if (!empty($this->office_phone)) {
|
||||||
$out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
|
$out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->user_mobile)) {
|
if (!empty($this->user_mobile)) {
|
||||||
$out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile")); $outdone++;
|
$out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->fax)) {
|
if (!empty($this->fax)) {
|
||||||
$out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++;
|
$out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->office_fax)) {
|
if (!empty($this->office_fax)) {
|
||||||
$out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++;
|
$out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
|
||||||
|
$outdone++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($out) $out .= '<div style="clear: both;"></div>';
|
if ($out) $out .= '<div style="clear: both;"></div>';
|
||||||
$outdone = 0;
|
$outdone = 0;
|
||||||
if (!empty($this->email))
|
if (!empty($this->email)) {
|
||||||
{
|
|
||||||
$out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
|
$out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
|
||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
if (!empty($this->url))
|
if (!empty($this->url)) {
|
||||||
{
|
|
||||||
//$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
|
//$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
|
||||||
$out .= dol_print_url($this->url, '_blank', 0, 1);
|
$out .= dol_print_url($this->url, '_blank', 0, 1);
|
||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->socialnetworks->enabled))
|
if (!empty($conf->socialnetworks->enabled)) {
|
||||||
{
|
|
||||||
$outsocialnetwork = '';
|
$outsocialnetwork = '';
|
||||||
|
|
||||||
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||||
@@ -823,7 +825,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
} else { // Old code
|
} else { // Old code to remove
|
||||||
if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||||
$outdone++;
|
$outdone++;
|
||||||
if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||||
|
|||||||
@@ -1758,21 +1758,17 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
|||||||
} else {
|
} else {
|
||||||
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
|
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
|
||||||
}
|
}
|
||||||
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan')))
|
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
|
||||||
{
|
|
||||||
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
|
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
|
||||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt = $object->getLibStatut(5, $object->totalpaye);
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt = $object->getLibStatut(5, $object->totalpaye);
|
||||||
$morehtmlstatus .= $tmptxt;
|
$morehtmlstatus .= $tmptxt;
|
||||||
} elseif ($object->element == 'contrat' || $object->element == 'contract')
|
} elseif ($object->element == 'contrat' || $object->element == 'contract') {
|
||||||
{
|
|
||||||
if ($object->statut == 0) $morehtmlstatus .= $object->getLibStatut(5);
|
if ($object->statut == 0) $morehtmlstatus .= $object->getLibStatut(5);
|
||||||
else $morehtmlstatus .= $object->getLibStatut(4);
|
else $morehtmlstatus .= $object->getLibStatut(4);
|
||||||
} elseif ($object->element == 'facturerec')
|
} elseif ($object->element == 'facturerec') {
|
||||||
{
|
|
||||||
if ($object->frequency == 0) $morehtmlstatus .= $object->getLibStatut(2);
|
if ($object->frequency == 0) $morehtmlstatus .= $object->getLibStatut(2);
|
||||||
else $morehtmlstatus .= $object->getLibStatut(5);
|
else $morehtmlstatus .= $object->getLibStatut(5);
|
||||||
} elseif ($object->element == 'project_task')
|
} elseif ($object->element == 'project_task') {
|
||||||
{
|
|
||||||
$object->fk_statut = 1;
|
$object->fk_statut = 1;
|
||||||
if ($object->progress > 0) $object->fk_statut = 2;
|
if ($object->progress > 0) $object->fk_statut = 2;
|
||||||
if ($object->progress >= 100) $object->fk_statut = 3;
|
if ($object->progress >= 100) $object->fk_statut = 3;
|
||||||
@@ -2457,6 +2453,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||||||
|
|
||||||
if (!empty($type)) {
|
if (!empty($type)) {
|
||||||
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
||||||
|
// TODO use dictionary definition for picto $dictsocialnetworks[$type]['icon']
|
||||||
$htmllink .= img_picto($langs->trans(dol_ucfirst($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
$htmllink .= img_picto($langs->trans(dol_ucfirst($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||||
if ($type == 'skype') {
|
if ($type == 'skype') {
|
||||||
$htmllink .= $value;
|
$htmllink .= $value;
|
||||||
@@ -3306,8 +3303,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
$fakey = 'fa-'.$convertarray[$pictowithouttext];
|
$fakey = 'fa-'.$convertarray[$pictowithouttext];
|
||||||
if (preg_match('/selected/', $pictowithouttext)) $facolor = '#888';
|
if (preg_match('/selected/', $pictowithouttext)) $facolor = '#888';
|
||||||
$marginleftonlyshort = 1;
|
$marginleftonlyshort = 1;
|
||||||
} elseif (!empty($arrayconvpictotofa[$pictowithouttext]))
|
} elseif (!empty($arrayconvpictotofa[$pictowithouttext])) {
|
||||||
{
|
|
||||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||||
} else {
|
} else {
|
||||||
$fakey = 'fa-'.$pictowithouttext;
|
$fakey = 'fa-'.$pictowithouttext;
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_t
|
|||||||
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
|
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
|
||||||
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;
|
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;
|
||||||
|
|
||||||
ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
|
ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
|
||||||
|
|
||||||
ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL;
|
ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL;
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ ALTER TABLE llx_projet_task_time MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIM
|
|||||||
ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
|
ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
|
||||||
|
|
||||||
|
|
||||||
DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
|
DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
|
||||||
DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous';
|
DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous';
|
||||||
UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday';
|
UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday';
|
||||||
|
|
||||||
@@ -545,6 +545,7 @@ CREATE TABLE llx_session(
|
|||||||
user_agent varchar(128) NULL
|
user_agent varchar(128) NULL
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'github', 'Github', 'https://github.com/{socialid}', 'fa-github', 1);
|
||||||
|
|
||||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_funnel_of_prospection.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_funnel_of_prospection.php' AND entity = 1);
|
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_funnel_of_prospection.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_funnel_of_prospection.php' AND entity = 1);
|
||||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
|
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
create table llx_intracommreport
|
create table llx_intracommreport
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
|
||||||
ref varchar(30) NOT NULL, -- report reference number
|
ref varchar(30) NOT NULL, -- report reference number
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
type_declaration varchar(32),
|
type_declaration varchar(32),
|
||||||
|
|||||||
@@ -30,54 +30,57 @@ $langs->loadLangs(array("intracommreport"));
|
|||||||
|
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
$exporttype = GETPOST('exporttype'); // DEB ou DES
|
$exporttype = GETPOST('exporttype'); // DEB ou DES
|
||||||
if (empty($exporttype)) $exporttype = 'deb';
|
if (empty($exporttype)) {
|
||||||
|
$exporttype = 'deb';
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$year = GETPOST('year');
|
$year = GETPOST('year');
|
||||||
$month = GETPOST('month');
|
$month = GETPOST('month');
|
||||||
$type_declaration = GETPOST('type');
|
$label = (string) GETPOST('label', 'alphanohtml');
|
||||||
|
$type_declaration = GETPOSTINT('type');
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
$declaration = array(
|
||||||
|
"deb" => $langs->trans("DEB"),
|
||||||
|
"des" => $langs->trans("DES"),
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes')
|
if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||||
{
|
|
||||||
$result = $object->delete($id, $user);
|
$result = $object->delete($id, $user);
|
||||||
if ($result > 0)
|
if ($result > 0) {
|
||||||
{
|
if (!empty($backtopage)) {
|
||||||
if (!empty($backtopage))
|
|
||||||
{
|
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
header("Location: list.php");
|
header("Location: list.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$errmesg = $object->error;
|
$errmesg = $object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->intracommreport->write) {
|
if ($action == 'add' && $user->rights->intracommreport->write) {
|
||||||
$object->label = trim($label);
|
$object->label = trim($label);
|
||||||
$object->type = trim($type);
|
$object->type = trim($exporttype);
|
||||||
$object->type_declaration = (int) $statut;
|
$object->type_declaration = $type_declaration;
|
||||||
$object->subscription = (int) $subscription;
|
$object->subscription = (int) $subscription;
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($object->label)) {
|
if (empty($object->label)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
|
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@@ -90,20 +93,16 @@ if ($action == 'add' && $user->rights->intracommreport->write) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id > 0)
|
if ($id > 0) {
|
||||||
{
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
exit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,15 +112,14 @@ if ($action == 'add' && $user->rights->intracommreport->write) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Creation mode
|
// Creation mode
|
||||||
if ($action == 'create')
|
if ($action == 'create') {
|
||||||
{
|
|
||||||
$title = $langs->trans("IntracommReportTitle");
|
$title = $langs->trans("IntracommReportTitle");
|
||||||
llxHeader("", $title);
|
llxHeader("", $title);
|
||||||
print load_fiche_titre($langs->trans("IntracommReportTitle"));
|
print load_fiche_titre($langs->trans("IntracommReportTitle"));
|
||||||
|
|
||||||
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="export" />';
|
print '<input type="hidden" name="action" value="add" />';
|
||||||
|
|
||||||
print dol_get_fiche_head();
|
print dol_get_fiche_head();
|
||||||
|
|
||||||
@@ -131,10 +129,8 @@ if ($action == 'create')
|
|||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
||||||
|
|
||||||
// Declaration
|
// Declaration
|
||||||
$declaration["deb"] = $langs->trans("DEB");
|
|
||||||
$declaration["des"] = $langs->trans("DES");
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Declaration")."</td><td>\n";
|
print '<tr><td class="fieldrequired">'.$langs->trans("Declaration")."</td><td>\n";
|
||||||
print $form->selectarray("declaration", $declaration, GETPOST('declaration', 'alpha') ?GETPOST('declaration', 'alpha') : $object->declaration, 0);
|
print $form->selectarray("declaration", $declaration, GETPOST('declaration', 'alpha') ? GETPOST('declaration', 'alpha') : $object->declaration, 0);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Analysis period
|
// Analysis period
|
||||||
@@ -179,8 +175,8 @@ if ($id > 0 && $action != 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show tabs
|
* Show tabs
|
||||||
*/
|
*/
|
||||||
$head = intracommreport_prepare_head($object);
|
$head = intracommreport_prepare_head($object);
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, 'user');
|
print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, 'user');
|
||||||
@@ -195,8 +191,15 @@ if ($id > 0 && $action != 'edit') {
|
|||||||
'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])
|
'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("DeleteReport"),
|
print $form->formconfirm(
|
||||||
$langs->trans("ConfirmDeleteReport"), "confirm_delete", $formquestion, 'no', 1);
|
"card.php?rowid=".$id,
|
||||||
|
$langs->trans("DeleteReport"),
|
||||||
|
$langs->trans("ConfirmDeleteReport"),
|
||||||
|
"confirm_delete",
|
||||||
|
$formquestion,
|
||||||
|
'no',
|
||||||
|
1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/intracommreport/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
@@ -229,101 +232,101 @@ if ($id > 0 && $action != 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
switch($action) {
|
switch($action) {
|
||||||
case 'generateXML':
|
case 'generateXML':
|
||||||
$obj = new TDebProdouane($PDOdb);
|
$obj = new TDebProdouane($PDOdb);
|
||||||
$obj->load($PDOdb, GETPOST('id_declaration'));
|
$obj->load($PDOdb, GETPOST('id_declaration'));
|
||||||
$obj->generateXMLFile();
|
$obj->generateXMLFile();
|
||||||
break;
|
break;
|
||||||
case 'list':
|
case 'list':
|
||||||
_liste($exporttype);
|
_liste($exporttype);
|
||||||
break;
|
break;
|
||||||
case 'export':
|
case 'export':
|
||||||
if ($exporttype == 'deb') _export_xml_deb($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
|
if ($exporttype == 'deb') _export_xml_deb($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
|
||||||
else _export_xml_des($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
|
else _export_xml_des($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
|
||||||
default:
|
default:
|
||||||
if ($exporttype == 'deb') _print_form_deb();
|
if ($exporttype == 'deb') _print_form_deb();
|
||||||
else _print_form_des();
|
else _print_form_des();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _print_form_des()
|
function _print_form_des()
|
||||||
{
|
{
|
||||||
global $langs, $formother, $year, $month, $type_declaration;
|
global $langs, $formother, $year, $month, $type_declaration;
|
||||||
|
|
||||||
$title = $langs->trans("IntracommReportDESTitle");
|
$title = $langs->trans("IntracommReportDESTitle");
|
||||||
llxHeader("", $title);
|
llxHeader("", $title);
|
||||||
print load_fiche_titre($langs->trans("IntracommReportDESTitle"));
|
print load_fiche_titre($langs->trans("IntracommReportDESTitle"));
|
||||||
|
|
||||||
print dol_get_fiche_head();
|
print dol_get_fiche_head();
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'" name="save" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" name="save" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="export" />';
|
print '<input type="hidden" name="action" value="export" />';
|
||||||
print '<input type="hidden" name="exporttype" value="des" />';
|
print '<input type="hidden" name="exporttype" value="des" />';
|
||||||
print '<input type="hidden" name="type" value="expedition" />'; // Permet d'utiliser le bon select de la requête sql
|
print '<input type="hidden" name="type" value="expedition" />'; // Permet d'utiliser le bon select de la requête sql
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td colspan="2">';
|
print '<tr class="liste_titre"><td colspan="2">';
|
||||||
print 'Paramètres de l\'export';
|
print 'Paramètres de l\'export';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>Période d\'analyse</td>';
|
print '<td>Période d\'analyse</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$TabMonth = array();
|
$TabMonth = array();
|
||||||
for($i=1;$i<=12;$i++) $TabMonth[$i] = $langs->trans('Month'.str_pad($i, 2, 0, STR_PAD_LEFT));
|
for($i=1;$i<=12;$i++) $TabMonth[$i] = $langs->trans('Month'.str_pad($i, 2, 0, STR_PAD_LEFT));
|
||||||
//print $ATMform->combo('','month', $TabMonth, empty($month) ? date('m') : $month);
|
//print $ATMform->combo('','month', $TabMonth, empty($month) ? date('m') : $month);
|
||||||
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
|
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print '<input class="butAction" type="submit" value="Exporter XML" />';
|
print '<input class="butAction" type="submit" value="Exporter XML" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function _export_xml_deb($type_declaration, $period_year, $period_month) {
|
function _export_xml_deb($type_declaration, $period_year, $period_month) {
|
||||||
|
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj = new TDebProdouane($db);
|
$obj = new TDebProdouane($db);
|
||||||
$obj->entity = $conf->entity;
|
$obj->entity = $conf->entity;
|
||||||
$obj->mode = 'O';
|
$obj->mode = 'O';
|
||||||
$obj->periode = $period_year.'-'.$period_month;
|
$obj->periode = $period_year.'-'.$period_month;
|
||||||
$obj->type_declaration = $type_declaration;
|
$obj->type_declaration = $type_declaration;
|
||||||
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
|
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
|
||||||
$obj->content_xml = $obj->getXML('O', $type_declaration, $period_year.'-'.$period_month);
|
$obj->content_xml = $obj->getXML('O', $type_declaration, $period_year.'-'.$period_month);
|
||||||
if(empty($obj->errors)) {
|
if(empty($obj->errors)) {
|
||||||
$obj->save($PDOdb);
|
$obj->save($PDOdb);
|
||||||
$obj->generateXMLFile();
|
$obj->generateXMLFile();
|
||||||
}
|
}
|
||||||
else setEventMessage($obj->errors, 'warnings');
|
else setEventMessage($obj->errors, 'warnings');
|
||||||
}
|
}
|
||||||
|
|
||||||
function _export_xml_des($type_declaration, $period_year, $period_month) {
|
function _export_xml_des($type_declaration, $period_year, $period_month) {
|
||||||
|
|
||||||
global $PDOdb, $conf;
|
global $PDOdb, $conf;
|
||||||
|
|
||||||
$obj = new TDebProdouane($PDOdb);
|
$obj = new TDebProdouane($PDOdb);
|
||||||
$obj->entity = $conf->entity;
|
$obj->entity = $conf->entity;
|
||||||
$obj->periode = $period_year.'-'.$period_month;
|
$obj->periode = $period_year.'-'.$period_month;
|
||||||
$obj->type_declaration = $type_declaration;
|
$obj->type_declaration = $type_declaration;
|
||||||
$obj->exporttype = 'des';
|
$obj->exporttype = 'des';
|
||||||
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
|
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
|
||||||
$obj->content_xml = $obj->getXMLDes($period_year, $period_month, $type_declaration);
|
$obj->content_xml = $obj->getXMLDes($period_year, $period_month, $type_declaration);
|
||||||
if(empty($obj->errors)) {
|
if(empty($obj->errors)) {
|
||||||
$obj->save($PDOdb);
|
$obj->save($PDOdb);
|
||||||
$obj->generateXMLFile();
|
$obj->generateXMLFile();
|
||||||
}
|
}
|
||||||
else setEventMessage($obj->errors, 'warnings');
|
else setEventMessage($obj->errors, 'warnings');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ class IntracommReport extends CommonObject
|
|||||||
*/
|
*/
|
||||||
const TYPE_DES = 1;
|
const TYPE_DES = 1;
|
||||||
|
|
||||||
static $type = array(
|
public static $type = array(
|
||||||
'introduction'=>'Introduction'
|
'introduction'=>'Introduction',
|
||||||
,'expedition'=>'Expédition'
|
'expedition'=>'Expédition'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,8 +117,11 @@ class IntracommReport extends CommonObject
|
|||||||
$declaration = $enveloppe->addChild('Declaration');
|
$declaration = $enveloppe->addChild('Declaration');
|
||||||
$declaration->addChild('declarationId', $id_declaration);
|
$declaration->addChild('declarationId', $id_declaration);
|
||||||
$declaration->addChild('referencePeriod', $period_reference);
|
$declaration->addChild('referencePeriod', $period_reference);
|
||||||
if ($conf->global->INTRACOMMREPORT_TYPE_ACTEUR === 'PSI') $psiId = $party_id;
|
if ($conf->global->INTRACOMMREPORT_TYPE_ACTEUR === 'PSI') {
|
||||||
else $psiId = 'NA';
|
$psiId = $party_id;
|
||||||
|
} else {
|
||||||
|
$psiId = 'NA';
|
||||||
|
}
|
||||||
$declaration->addChild('PSIId', $psiId);
|
$declaration->addChild('PSIId', $psiId);
|
||||||
$function = $declaration->addChild('Function');
|
$function = $declaration->addChild('Function');
|
||||||
$functionCode = $function->addChild('functionCode', $mode);
|
$functionCode = $function->addChild('functionCode', $mode);
|
||||||
@@ -128,13 +131,16 @@ class IntracommReport extends CommonObject
|
|||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
/**************Ajout des lignes de factures**************************/
|
/**************Ajout des lignes de factures**************************/
|
||||||
$res = self::addItemsFact($declaration, $type, $period_reference);
|
$res = $this->addItemsFact($declaration, $type, $period_reference);
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
$this->errors = array_unique($this->errors);
|
$this->errors = array_unique($this->errors);
|
||||||
|
|
||||||
if (!empty($res)) return $e->asXML();
|
if (!empty($res)) {
|
||||||
else return 0;
|
return $e->asXML();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,18 +169,21 @@ class IntracommReport extends CommonObject
|
|||||||
|
|
||||||
$this->errors = array_unique($this->errors);
|
$this->errors = array_unique($this->errors);
|
||||||
|
|
||||||
if (!empty($res)) return $e->asXML();
|
if (!empty($res)) {
|
||||||
else return 0;
|
return $e->asXML();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add line from invoice
|
* Add line from invoice
|
||||||
*
|
*
|
||||||
* @param int $declaration Reference declaration
|
* @param SimpleXMLElement $declaration Reference declaration
|
||||||
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
|
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
|
||||||
* @param int $period_reference Reference period
|
* @param int $period_reference Reference period
|
||||||
* @param string $exporttype deb=DEB, des=DES
|
* @param string $exporttype deb=DEB, des=DES
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function addItemsFact(&$declaration, $type, $period_reference, $exporttype = 'deb')
|
public function addItemsFact(&$declaration, $type, $period_reference, $exporttype = 'deb')
|
||||||
{
|
{
|
||||||
@@ -201,8 +210,7 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ($res = $this->db->fetch_object($resql)) {
|
while ($res = $this->db->fetch_object($resql)) {
|
||||||
if ($exporttype == 'des')
|
if ($exporttype == 'des') {
|
||||||
{
|
|
||||||
$this->addItemXMlDes($declaration, $res, $i);
|
$this->addItemXMlDes($declaration, $res, $i);
|
||||||
} else {
|
} else {
|
||||||
if (empty($res->fk_pays)) {
|
if (empty($res->fk_pays)) {
|
||||||
@@ -211,16 +219,22 @@ class IntracommReport extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
if ($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) {
|
if ($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) {
|
||||||
$TLinesFraisDePort[] = $res;
|
$TLinesFraisDePort[] = $res;
|
||||||
} else $this->addItemXMl($declaration, $res, $i, '');
|
} else {
|
||||||
|
$this->addItemXMl($declaration, $res, $i, '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($TLinesFraisDePort)) $this->addItemFraisDePort($declaration, $TLinesFraisDePort, $type, $categ_fraisdeport, $i);
|
if (!empty($TLinesFraisDePort)) {
|
||||||
|
$this->addItemFraisDePort($declaration, $TLinesFraisDePort, $type, $categ_fraisdeport, $i);
|
||||||
|
}
|
||||||
|
|
||||||
if (count($this->errors) > 0) return 0;
|
if (count($this->errors) > 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -244,8 +258,7 @@ class IntracommReport extends CommonObject
|
|||||||
$table_extraf = 'facture_extrafields';
|
$table_extraf = 'facture_extrafields';
|
||||||
$tabledet = 'facturedet';
|
$tabledet = 'facturedet';
|
||||||
$field_link = 'fk_facture';
|
$field_link = 'fk_facture';
|
||||||
}
|
} else { // Introduction
|
||||||
else { // Introduction
|
|
||||||
$sql = 'SELECT f.ref_supplier as facnumber, f.total_ht';
|
$sql = 'SELECT f.ref_supplier as facnumber, f.total_ht';
|
||||||
$table = 'facture_fourn';
|
$table = 'facture_fourn';
|
||||||
$table_extraf = 'facture_fourn_extrafields';
|
$table_extraf = 'facture_fourn_extrafields';
|
||||||
@@ -275,21 +288,26 @@ class IntracommReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Add item for DEB
|
* Add item for DEB
|
||||||
*
|
*
|
||||||
* @param int $declaration Reference declaration
|
* @param SimpleXMLElement $declaration Reference declaration
|
||||||
* @param int $res Result of request SQL
|
* @param Resource $res Result of request SQL
|
||||||
* @param int $i Line Id
|
* @param int $i Line Id
|
||||||
* @param string $code_douane_spe Specific customs authorities code
|
* @param string $code_douane_spe Specific customs authorities code
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '')
|
public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '')
|
||||||
{
|
{
|
||||||
$item = $declaration->addChild('Item');
|
$item = $declaration->addChild('Item');
|
||||||
$item->addChild('ItemNumber', $i);
|
$item->addChild('ItemNumber', $i);
|
||||||
$cn8 = $item->addChild('CN8');
|
$cn8 = $item->addChild('CN8');
|
||||||
if (empty($code_douane_spe)) $code_douane = $res->customcode;
|
if (empty($code_douane_spe)) {
|
||||||
else $code_douane = $code_douane_spe;
|
$code_douane = $res->customcode;
|
||||||
|
} else {
|
||||||
|
$code_douane = $code_douane_spe;
|
||||||
|
}
|
||||||
$cn8->addChild('CN8Code', $code_douane);
|
$cn8->addChild('CN8Code', $code_douane);
|
||||||
if (!empty($res->tva_intra)) $item->addChild('partnerId', $res->tva_intra);
|
if (!empty($res->tva_intra)) {
|
||||||
|
$item->addChild('partnerId', $res->tva_intra);
|
||||||
|
}
|
||||||
$item->addChild('MSConsDestCode', $res->code); // code iso pays client
|
$item->addChild('MSConsDestCode', $res->code); // code iso pays client
|
||||||
$item->addChild('netMass', $res->weight * $res->qty); // Poids du produit
|
$item->addChild('netMass', $res->weight * $res->qty); // Poids du produit
|
||||||
$item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
|
$item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
|
||||||
@@ -306,10 +324,10 @@ class IntracommReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Add item for DES
|
* Add item for DES
|
||||||
*
|
*
|
||||||
* @param int $declaration Reference declaration
|
* @param SimpleXMLElement $declaration Reference declaration
|
||||||
* @param int $res Result of request SQL
|
* @param esurce $res Result of request SQL
|
||||||
* @param int $i Line Id
|
* @param int $i Line Id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addItemXMlDes($declaration, &$res, $i)
|
public function addItemXMlDes($declaration, &$res, $i)
|
||||||
{
|
{
|
||||||
@@ -322,12 +340,12 @@ class IntracommReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* This function adds an item by retrieving the customs code of the product with the highest amount in the invoice
|
* This function adds an item by retrieving the customs code of the product with the highest amount in the invoice
|
||||||
*
|
*
|
||||||
* @param int $declaration Reference declaration
|
* @param SimpleXMLElement $declaration Reference declaration
|
||||||
* @param int $TLinesFraisDePort Data of shipping costs line
|
* @param array $TLinesFraisDePort Data of shipping costs line
|
||||||
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
|
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
|
||||||
* @param Categorie $categ_fraisdeport category of shipping costs
|
* @param Categorie $categ_fraisdeport category of shipping costs
|
||||||
* @param int $i Line Id
|
* @param int $i Line Id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
|
public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
|
||||||
{
|
{
|
||||||
@@ -386,7 +404,9 @@ class IntracommReport extends CommonObject
|
|||||||
public function getNextDeclarationNumber()
|
public function getNextDeclarationNumber()
|
||||||
{
|
{
|
||||||
$resql = $this->db->query('SELECT MAX(numero_declaration) as max_declaration_number FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE exporttype="'.$this->exporttype.'"');
|
$resql = $this->db->query('SELECT MAX(numero_declaration) as max_declaration_number FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE exporttype="'.$this->exporttype.'"');
|
||||||
if ($resql) $res = $this->db->fetch_object($resql);
|
if ($resql) {
|
||||||
|
$res = $this->db->fetch_object($resql);
|
||||||
|
}
|
||||||
|
|
||||||
return ($res->max_declaration_number + 1);
|
return ($res->max_declaration_number + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,17 +50,31 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
|
$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortfield) $sortfield = "i.ref";
|
if (!$sortfield) {
|
||||||
if (!$sortorder) $sortorder = "ASC";
|
$sortfield = "i.ref";
|
||||||
|
}
|
||||||
|
if (!$sortorder) {
|
||||||
|
$sortorder = "ASC";
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize context for list
|
// Initialize context for list
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist';
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist';
|
||||||
if ((string) $type == '1') { $contextpage = 'DESlist'; if ($search_type == '') $search_type = '1'; }
|
if ((string) $type == '1') {
|
||||||
if ((string) $type == '0') { $contextpage = 'DEBlist'; if ($search_type == '') $search_type = '0'; }
|
$contextpage = 'DESlist'; if ($search_type == '') {
|
||||||
|
$search_type = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((string) $type == '0') {
|
||||||
|
$contextpage = 'DEBlist'; if ($search_type == '') {
|
||||||
|
$search_type = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
$object = new IntracommReport($db);
|
$object = new IntracommReport($db);
|
||||||
@@ -74,13 +88,14 @@ $extralabels = $extrafields->fetch_name_optionals_label('intracommreport');
|
|||||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($action)) $action = 'list';
|
if (empty($action)) {
|
||||||
|
$action = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
$canvas = GETPOST("canvas");
|
$canvas = GETPOST("canvas");
|
||||||
$objcanvas = null;
|
$objcanvas = null;
|
||||||
if (!empty($canvas))
|
if (!empty($canvas)) {
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||||
$objcanvas = new Canvas($db, $action);
|
$objcanvas = new Canvas($db, $action);
|
||||||
$objcanvas->getCanvas('product', 'list', $canvas);
|
$objcanvas->getCanvas('product', 'list', $canvas);
|
||||||
@@ -114,11 +129,11 @@ $arrayfields = array(
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
@@ -130,21 +145,25 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
if (GETPOST('cancel', 'alpha')) {
|
||||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
$action = 'list'; $massaction = '';
|
||||||
|
}
|
||||||
|
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||||
|
$massaction = '';
|
||||||
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$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');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook)) {
|
||||||
{
|
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||||
{
|
|
||||||
$sall = "";
|
$sall = "";
|
||||||
$search_ref = "";
|
$search_ref = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
@@ -156,8 +175,12 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass = 'Product';
|
$objectclass = 'Product';
|
||||||
if ((string) $search_type == '1') { $objectlabel = 'Services'; }
|
if ((string) $search_type == '1') {
|
||||||
if ((string) $search_type == '0') { $objectlabel = 'Products'; }
|
$objectlabel = 'Services';
|
||||||
|
}
|
||||||
|
if ((string) $search_type == '0') {
|
||||||
|
$objectlabel = 'Products';
|
||||||
|
}
|
||||||
|
|
||||||
$permtoread = $user->rights->produit->lire;
|
$permtoread = $user->rights->produit->lire;
|
||||||
$permtodelete = $user->rights->produit->supprimer;
|
$permtodelete = $user->rights->produit->supprimer;
|
||||||
@@ -173,11 +196,11 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
$title = $langs->trans('IntracommReportList'.$type);
|
$title = $langs->trans('IntracommReportList'.$type);
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT i.rowid, i.type_declaration, i.type_export, i.period, i.mode, i.entity';
|
$sql = 'SELECT DISTINCT i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity';
|
||||||
/*
|
/*
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@@ -191,12 +214,16 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i';
|
|||||||
|
|
||||||
$sql .= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
|
$sql .= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
|
||||||
|
|
||||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
if ($sall) {
|
||||||
|
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
|
}
|
||||||
// if the type is not 1, we show all products (type = 0,2,3)
|
// if the type is not 1, we show all products (type = 0,2,3)
|
||||||
if (dol_strlen($search_type) && $search_type != '-1')
|
if (dol_strlen($search_type) && $search_type != '-1') {
|
||||||
{
|
if ($search_type == 1) {
|
||||||
if ($search_type == 1) $sql .= " AND i.type = 1";
|
$sql .= " AND i.type = 1";
|
||||||
else $sql .= " AND i.type = 0";
|
} else {
|
||||||
|
$sql .= " AND i.type = 0";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -222,7 +249,7 @@ $sql .= " GROUP BY i.rowid";
|
|||||||
/*
|
/*
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -234,12 +261,10 @@ $sql .= $hookmanager->resPrint;
|
|||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
{
|
|
||||||
$page = 0;
|
$page = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
@@ -249,8 +274,7 @@ $sql .= $db->plimit($limit + 1, $offset);
|
|||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
@@ -264,11 +288,21 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
$param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($sall) $param .= "&sall=".urlencode($sall);
|
}
|
||||||
if ($search_ref) $param = "&search_ref=".urlencode($search_ref);
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
if ($search_label) $param .= "&search_label=".urlencode($search_label);
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
|
if ($sall) {
|
||||||
|
$param .= "&sall=".urlencode($sall);
|
||||||
|
}
|
||||||
|
if ($search_ref) {
|
||||||
|
$param = "&search_ref=".urlencode($search_ref);
|
||||||
|
}
|
||||||
|
if ($search_label) {
|
||||||
|
$param .= "&search_label=".urlencode($search_label);
|
||||||
|
}
|
||||||
|
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
@@ -279,18 +313,23 @@ if ($resql)
|
|||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
);
|
);
|
||||||
if ($user->rights->intracommreport->delete) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
if ($user->rights->intracommreport->delete) {
|
||||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
$arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
||||||
|
}
|
||||||
|
if (in_array($massaction, array('presend', 'predelete'))) {
|
||||||
|
$arrayofmassactions = array();
|
||||||
|
}
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
$newcardbutton = '';
|
$newcardbutton = '';
|
||||||
if ($user->rights->intracommreport->write)
|
if ($user->rights->intracommreport->write) {
|
||||||
{
|
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&type='.$type);
|
$newcardbutton .= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&type='.$type);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') {
|
||||||
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
}
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
@@ -298,7 +337,9 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
if (empty($arrayfields['i.fk_product_type']['checked'])) print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
|
if (empty($arrayfields['i.fk_product_type']['checked'])) {
|
||||||
|
print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
|
||||||
|
}
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
@@ -308,19 +349,22 @@ if ($resql)
|
|||||||
$trackid = 'prod'.$object->id;
|
$trackid = 'prod'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall)
|
if ($sall) {
|
||||||
{
|
foreach ($fieldstosearchall as $key => $val) {
|
||||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
$fieldstosearchall[$key] = $langs->trans($val);
|
||||||
|
}
|
||||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
if (empty($reshook)) {
|
||||||
else $moreforfilter = $hookmanager->resPrint;
|
$moreforfilter .= $hookmanager->resPrint;
|
||||||
|
} else {
|
||||||
|
$moreforfilter = $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
if ($moreforfilter)
|
if ($moreforfilter) {
|
||||||
{
|
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print $moreforfilter;
|
print $moreforfilter;
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@@ -328,37 +372,37 @@ if ($resql)
|
|||||||
|
|
||||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
if ($massactionbutton) {
|
||||||
|
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
}
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
|
|
||||||
// Lines with input filters
|
// Lines with input filters
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
if (!empty($arrayfields['i.ref']['checked']))
|
if (!empty($arrayfields['i.ref']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre left">';
|
print '<td class="liste_titre left">';
|
||||||
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
|
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['i.label']['checked']))
|
if (!empty($arrayfields['i.label']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre left">';
|
print '<td class="liste_titre left">';
|
||||||
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
|
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Type
|
// Type
|
||||||
// Type (customer/prospect/supplier)
|
// Type (customer/prospect/supplier)
|
||||||
if (!empty($arrayfields['customerorsupplier']['checked']))
|
if (!empty($arrayfields['customerorsupplier']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">';
|
if ($type != '') {
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
}
|
||||||
print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
|
print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
|
||||||
print '</select></td>';
|
print '</select></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['i.fk_product_type']['checked']))
|
if (!empty($arrayfields['i.fk_product_type']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre left">';
|
print '<td class="liste_titre left">';
|
||||||
$array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
|
$array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
|
||||||
print $form->selectarray('search_type', $array, $search_type);
|
print $form->selectarray('search_type', $array, $search_type);
|
||||||
@@ -366,22 +410,20 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
*/
|
*/
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters = array('arrayfields'=>$arrayfields);
|
$parameters = array('arrayfields'=>$arrayfields);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Date creation
|
// Date creation
|
||||||
if (!empty($arrayfields['i.datec']['checked']))
|
if (!empty($arrayfields['i.datec']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date modification
|
// Date modification
|
||||||
if (!empty($arrayfields['i.tms']['checked']))
|
if (!empty($arrayfields['i.tms']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@@ -404,9 +446,9 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
*/
|
*/
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
@@ -426,8 +468,7 @@ if ($resql)
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit)) {
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$intracommreport_static->id = $obj->rowid;
|
$intracommreport_static->id = $obj->rowid;
|
||||||
@@ -443,35 +484,41 @@ if ($resql)
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
if (!empty($arrayfields['i.ref']['checked']))
|
if (!empty($arrayfields['i.ref']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="tdoverflowmax200">';
|
print '<td class="tdoverflowmax200">';
|
||||||
print $intracommreport_static->getNomUrl(1);
|
print $intracommreport_static->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Label
|
// Label
|
||||||
if (!empty($arrayfields['i.label']['checked']))
|
if (!empty($arrayfields['i.label']['checked'])) {
|
||||||
{
|
|
||||||
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
|
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Type
|
// Type
|
||||||
if (!empty($arrayfields['i.fk_product_type']['checked']))
|
if (!empty($arrayfields['i.fk_product_type']['checked'])) {
|
||||||
{
|
|
||||||
print '<td>'.$obj->fk_product_type.'</td>';
|
print '<td>'.$obj->fk_product_type.'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Action
|
// Action
|
||||||
print '<td class="nowrap center">';
|
print '<td class="nowrap center">';
|
||||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
{
|
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
if (in_array($obj->rowid, $arrayofselected)) {
|
||||||
|
$selected = 1;
|
||||||
|
}
|
||||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@@ -482,8 +529,7 @@ if ($resql)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print "</div>";
|
print "</div>";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user