Skip to content

Commit 5272685

Browse files
authored
Merge pull request #441 from Hystepik/new-ticket-creation-on-support-fill
New ticket creation on support fill
2 parents 745efec + 8c47ac1 commit 5272685

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

admin/setup_other.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,22 @@
591591
}
592592
}
593593

594+
print '<tr class="oddeven"><td>'.$langs->trans("SELLYOURSAAS_SUPPORT_TICKET_CREATE").'</td>';
595+
print '<td>';
596+
if ($conf->use_javascript_ajax) {
597+
print ajax_constantonoff('SELLYOURSAAS_SUPPORT_TICKET_CREATE', array(), null, 0, 0, 0);
598+
} else {
599+
if (!getDolGlobalString('SELLYOURSAAS_SUPPORT_TICKET_CREATE')) {
600+
print '<a href="'.$_SERVER['PHP_SELF'].'?action=SELLYOURSAAS_SUPPORT_TICKET_CREATE">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
601+
} else {
602+
print '<a href="'.$_SERVER['PHP_SELF'].'?action=SELLYOURSAAS_SUPPORT_TICKET_CREATE">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
603+
}
604+
}
605+
print '</td>';
606+
print '<td><span class="opacitymedium small"></span></td>';
607+
print '</tr>';
608+
609+
594610
print '</table>';
595611
print '</div>';
596612

langs/en_US/sellyoursaas.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,3 +969,4 @@ ModulesToIgnoreForAutoUpgrade=Modules to ignore for auto-upgrade
969969
PleaseFillContactInfoFirst=Please fill your contact an dorganization information first
970970
GoToYourResellerMenuTogetInformation=Go to menu "%s" for more information
971971
AccessIsReservedTofinalCustomerOnly=Access is reserved to final customer only (ask him if yo need it)
972+
SELLYOURSAAS_SUPPORT_TICKET_CREATE=Enable automatic ticket creation when the contact form is used

langs/fr_FR/sellyoursaas.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,3 +965,4 @@ SaveAndPay=Économisez et payez
965965
ModulesToIgnoreForAutoUpgrade=Modules à ignorer pour la mise à jour automatique
966966
PleaseFillContactInfoFirst=Veuillez d'abord remplir vos coordonnées.
967967
GoToYourResellerMenuTogetInformation=Accédez au menu « %s » pour plus d'informations.
968+
SELLYOURSAAS_SUPPORT_TICKET_CREATE=Activer la création automatique de tickets lorsque le formulaire de contact est utilisé

myaccount/index.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
111111
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
112112
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
113+
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
113114
//require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
114115
require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
115116
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
@@ -904,6 +905,24 @@
904905
if (is_object($tmpcontract)) {
905906
$trackid = 'con'.$tmpcontract->id;
906907
}
908+
if (getDolGlobalInt("SELLYOURSAAS_SUPPORT_TICKET_CREATE")) {
909+
$tickettocreate = new Ticket($db);
910+
$tickettocreate->ref = $tickettocreate->getDefaultRef();
911+
$tickettocreate->subject = $topic;
912+
$tickettocreate->message = $content;
913+
$tickettocreate->fk_soc = $mythirdpartyaccount->id;
914+
$tickettocreate->socid = $mythirdpartyaccount->id;
915+
$tickettocreate->origin_replyto = $replyto;
916+
$tickettocreate->origin_email = $emailfrom;
917+
$tickettocreate->ip = $ipaddress;
918+
if (is_object($tmpcontract)) {
919+
$tickettocreate->fk_contract = $tmpcontract->id;
920+
}
921+
$res = $tickettocreate->create($user);
922+
if ($res > 0) {
923+
$trackid = $tickettocreate->track_id;
924+
}
925+
}
907926

908927
// Send email
909928
$cmailfile = new CMailFile($topic, $emailto, $emailfrom, $content, $arr_file, $arr_mime, $arr_name, '', '', 0, 1, '', '', $trackid, '', 'standard', $replyto);

0 commit comments

Comments
 (0)