diff --git a/dev/examples/mail/source_email_ticket_1_to_create.txt b/dev/examples/mail/source_email_ticket_1_to_create.txt new file mode 100644 index 00000000000..94d4cb620b9 --- /dev/null +++ b/dev/examples/mail/source_email_ticket_1_to_create.txt @@ -0,0 +1,89 @@ +Delivered-To: testldrdev@gmail.com +Received: by 2002:a2e:9b9a:0:0:0:0:0 with SMTP id z26csp1425223lji; + Thu, 20 Aug 2020 08:29:02 -0700 (PDT) +X-Received: by 2002:a05:620a:1292:: with SMTP id w18mr2938234qki.158.1597937342304; + Thu, 20 Aug 2020 08:29:02 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1597937342; cv=none; + d=google.com; s=arc-20160816; + b=FhT/+rJ/zNYgVQ5Nt/rLZJycGd/Ntkhm6LwI16YUfmEmxeGrP/cXXQULrqQ1LhBr9B + oRKweltTdnpyA14gm0kzbs1vUkf5HxLUuGk8IqqJWAPMUZoN8oUPkzq2BuKNQGxPiE+y + Hsg/fnYp8WzcAlZOLsEP2kcFIdA95Dyy5LkM8HgphI1jSS1d6gkx6nDGIMIpDD9D+w4X + ISxRUXp5JlDwFCUMOPoAvHIBUdJ3jpLsjesbMEnU4ssFqhxU21pBq+Fc+csSPeY5DL0M + HR1o+ChEAXIdDOrDqa0ohHfqR216juGCzH8YuEQ88LT0Qbst9IkOYWiAQv4TIh7vHtvQ + TMvA== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; + h=to:subject:message-id:date:from:mime-version:dkim-signature; + bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=; + b=CRlrRPfoGkfmz6iXKy4HdxKQ4SeJTiIxjC2jNkgQPSnIDFJgDkJcwASJVpcjTmlVmH + Z9WnHKVUPRIHGDEoMRlx6eUx9QfelWqPYu3BBQGFry9sgth0BR/1s6tmQ+P+bAj23ryo + aL3UkF6KCSx4GhEk3MfHA5Ex81YDFHvHL3BZ2kb3XCVSlPiBq2szw1ETmRAsDdS5Gbu+ + ZlzBbl4pRtUWgi1fB5H4Wcv7e90F4Et1SBP8IKSCa23qu2nV9xefgjfMw2ndxCj1zgCL + c3l7Ul6pw32nqf6+vxfZTstwIwgu6dXZXCHDqJqesI2g8RGxeba+LfKZEDpBuSeINS9r + GMvw== +ARC-Authentication-Results: i=1; mx.google.com; + dkim=pass header.i=@destailleur.fr header.s=google header.b=IPMz90Yj; + spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr; + dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr +Return-Path: +Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) + by mx.google.com with SMTPS id w14sor2138230qtb.9.2020.08.20.08.29.00 + for + (Google Transport Security); + Thu, 20 Aug 2020 08:29:01 -0700 (PDT) +Received-SPF: pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; +Authentication-Results: mx.google.com; + dkim=pass header.i=@destailleur.fr header.s=google header.b=IPMz90Yj; + spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr; + dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=destailleur.fr; s=google; + h=mime-version:from:date:message-id:subject:to; + bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=; + b=IPMz90Yjw1Mf57/rYWUYGtpc+IazEWcy6/bqxf1j0h6rxDH/wjhxsCWzfARgqqlfVj + ACg4IbPpZZlKFIYDSCbfMlWF65rbKfNre56HldfQgy0Tq3LC434zHz2ZZMOVCM52w3J9 + VGBpASUlSL1o+YRmzOpRtHVu7I9aNwGxHuA070Yka8XLV76vV3P0vdL8PcoHq0jUUEoi + +dCZ9NCPuAFtGK2IavNoM2qQrLdfYIi+RwgWBtqjTwzyvDEJR+p5fIPK142ynMbHgWYO + RVtMqAgxjvL4sfyKZ5KuzKXkQNM3zyzMinWK89scBl+QLFCcWA4Qqc0dJjqLCBhh8lmq + n67g== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:mime-version:from:date:message-id:subject:to; + bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=; + b=H0GsrFAi9JmRTKQ2budtDeLBqCaTisHKYCVVziyxmv+/tIcrSZBA4tdKwm+wR80r50 + zMJXmyVS2DMDWfnIlOv39wcwQjYN3WK1aRJfV0bVuEWrQuzt5MMWbskf6xbzo201nhr9 + ZlqATsEV7v1u5EHmfYwRhR8+AOmENdnm0g9RXPJVrFS58WNEJUSotS5Y5rZPjnT943y0 + 62Kf4Bd6uWvXhPFXWQoZLtWrPpkbcYPWIBmpftKhD0PD9c6rKaVduV0WhbigYsDoxb3F + iIafGPOyq91hiHR2gTLHiMmTDm+IDQ4n6gSkS7HKpZlLQhHoBMnpqJZYoxMJTxdpAbSy + mY+A== +X-Gm-Message-State: AOAM5325RcN4/ThWbYCO3vWRMFFBrfzJUHC1bd1Z9VB3/2Q3RuF9lmIJ +SjshEErhK68Of2pHDZQ3aPU4rzDfV8ozbvRsgChdfZg8aA= +X-Google-Smtp-Source: ABdhPJxUOUdurKEQfLldtiQGRkgC/h8gKQG1zhS+8k93p6N1SsOn517+GeRyT3E+/Uw536pmReO29la3EIAS6VT33SE= +X-Received: by 2002:aed:3e8e:: with SMTP id n14mr3191190qtf.67.1597937340509; Thu, 20 Aug 2020 08:29:00 -0700 (PDT) +MIME-Version: 1.0 +From: John Tester +Date: Thu, 20 Aug 2020 17:28:34 +0200 +Message-ID: +Subject: Support besoin +To: testldrdev@gmail.com +Content-Type: multipart/alternative; boundary="0000000000008e099705ad50c772" + +--0000000000008e099705ad50c772 +Content-Type: text/plain; charset="UTF-8" + +adfsdfsdfds + +-- +Laurent. +------------------------------------------------------------------------------------ +Twitter: https://www.twitter.com/eldy10 + +--0000000000008e099705ad50c772 +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +
adfsdfsdfds

--
Laur= +ent.
-------------------------------------------------------------------= +-----------------
Twitter: https://www.twitter.com/eldy10
+ +--0000000000008e099705ad50c772-- diff --git a/dev/examples/mail/source_email_ticket_2_answer_from_ticket.txt b/dev/examples/mail/source_email_ticket_2_answer_from_ticket.txt new file mode 100644 index 00000000000..350b9a93cad --- /dev/null +++ b/dev/examples/mail/source_email_ticket_2_answer_from_ticket.txt @@ -0,0 +1,57 @@ +Return-Path: +Received: from smtp.gmail.com ([2a01:e0a:7e:4ae0:329c:23ff:feb8:dc8d]) + by smtp.gmail.com with ESMTPSA id 32sm5811196wrh.18.2020.08.20.09.31.37 + for + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 20 Aug 2020 09:31:37 -0700 (PDT) +From: testldrdev@gmail.com +X-Google-Original-From: +To: customer@customercompany.fr +Subject: [MyBigCompany - Ticket #TS2008-0040] Nouveau message +Date: Thu, 20 Aug 2020 18:31:37 +0200 +Message-ID: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62> +References: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62> +X-Dolibarr-TRACKID: tic58@83b5bc91f83a56e458db71e0adac2b62 +X-RemoteAddr: 127.0.0.1 +X-Mailer: Dolibarr version 13.0.0-alpha (using SMTPs Mailer) +X-Dolibarr-Option: MAIN_MAIL_USE_MULTI_PART +Mime-Version: 1.0 +Content-Type: multipart/mixed; boundary="multipart_x.1597941097.x_boundary" +Content-Transfer-Encoding: 8bit + +--multipart_x.1597941097.x_boundary +Content-Type: multipart/alternative; boundary="mul_872cdd6a64216735955664484832b075" + +--mul_872cdd6a64216735955664484832b075 +Content-Type: text/plain; charset=UTF-8 + +Bonjour + + +Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici +le message :PredefinedMailContentTicket_send + + +Vous pouvez voir la progression du ticket en cliquant sur le lien +ci-dessus. : fr5uw2yospypn2rz + Cordialement, + +-- +--mul_872cdd6a64216735955664484832b075 +Content-Type: text/html; charset=UTF-8 + +Bonjour
+ +
+Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici +le message :PredefinedMailContentTicket_send
+
+
+Vous pouvez voir la progression du ticket en cliquant sur le lien +ci-dessus. : fr5uw2yospypn2rz
+
Cordialement,
+
+-- +--mul_872cdd6a64216735955664484832b075-- +--multipart_x.1597941097.x_boundary-- diff --git a/dev/examples/mail/source_email_ticket_3_answer_from_mailer.txt b/dev/examples/mail/source_email_ticket_3_answer_from_mailer.txt new file mode 100644 index 00000000000..6c2ac1bb2af --- /dev/null +++ b/dev/examples/mail/source_email_ticket_3_answer_from_mailer.txt @@ -0,0 +1,48 @@ +MIME-Version: 1.0 +Date: Thu, 20 Aug 2020 18:34:01 +0200 +References: +In-Reply-To: +Message-ID: +Subject: Re: Support besoin +From: John Tester +To: John Tester +Content-Type: multipart/alternative; boundary="0000000000001620dd05ad51b075" + +--0000000000001620dd05ad51b075 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +Merci pour votre question. +Voici la rep. + +Le jeu. 20 ao=C3=BBt 2020 =C3=A0 17:29, John Tester +a =C3=A9crit : + +> adfsdfsdfds +> +> -- +> Laurent. +> +> -------------------------------------------------------------------------= +----------- +> Twitter: https://www.twitter.com/eldy10 +> + +--0000000000001620dd05ad51b075 +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +
Merci pour votre question.
Voici la rep.
Le=C2=A0= +jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A017:29, John Tester <customer@customercompany.fr> a =C3=A9c= +rit=C2=A0:
adfsdfsdfds

--
Laurent.
----------------------------------------------------------= +--------------------------
Twitter: https://www.twitter.com/eldy10
+
+ +--0000000000001620dd05ad51b075-- diff --git a/dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt b/dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt new file mode 100644 index 00000000000..314e9cda20f --- /dev/null +++ b/dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt @@ -0,0 +1,134 @@ +Delivered-To: testldrdev@gmail.com +Received: by 2002:a2e:9b9a:0:0:0:0:0 with SMTP id z26csp1483607lji; + Thu, 20 Aug 2020 09:56:03 -0700 (PDT) +X-Received: by 2002:ac8:3868:: with SMTP id r37mr3301993qtb.95.1597942563252; + Thu, 20 Aug 2020 09:56:03 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1597942563; cv=none; + d=google.com; s=arc-20160816; + b=skUGL+keim3FdNXfKGgQokCfj85gnhYhuLbMM61qY5W6ixSH9s8I6uoNh3gzVy89XM + NGbZiajjDiPMBryl87PhD+ACBjv8WoZAQiojAga0ELPPmVDnhrtWKANLbRrkUI3Xtfoj + b1o2iHP2Q12Vqs6xiAy86yxURlIKGM3tw91WryWiIPiAL7bRZPn49N3XbO2ULE0QKTBq + BI5YnOxt9NfTj0xhKaLLIJ9M1qa4e1QyOHl56WuEv3Gx6uHDAQDYz+C5G0VgdjBvwRzH + pJaiAulc1uW/V9TcRMwvwIWtI7eWygvU2PiuI/c05G1KVKibAubHE55IjOJCn2O2UaH4 + WMNQ== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; + h=to:subject:message-id:date:from:in-reply-to:references:mime-version + :dkim-signature; + bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=; + b=Ps5kk+tBGQzMP6ugDCwKf4hzn8fn3DU4AFz1dJvkHdDestLZWN99Qtr6iNMdslsHJm + ov378c+8oCfcV7shyBYjlAFfikFi7o4RM/evh3yqqjAnhyVfcYH7c9cexVvDo/AXUAZ7 + N7Mh7EOvyDXXsaHK2l89XiAxZx/hZh/O+/HR2EoVEGre1eYRYwI/aEfPN8d4/fL2VtCD + 0wzAwnUrINuXmcaUDT30Twjk9kwGjjTsM6Z531vKM6L3y48a7f3GTE7V+vo2QxHdUT54 + fQVue9OO7b4VKTEj/x/dmNr+92sHRAMMS7dj/VXMmzM+WttUCAPNxZ27/bvt4bBc5oBp + QPEA== +ARC-Authentication-Results: i=1; mx.google.com; + dkim=pass header.i=@destailleur.fr header.s=google header.b=SEYSmxbT; + spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr; + dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr +Return-Path: +Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) + by mx.google.com with SMTPS id q3sor2285165qtn.34.2020.08.20.09.56.02 + for + (Google Transport Security); + Thu, 20 Aug 2020 09:56:03 -0700 (PDT) +Received-SPF: pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; +Authentication-Results: mx.google.com; + dkim=pass header.i=@destailleur.fr header.s=google header.b=SEYSmxbT; + spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr; + dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=destailleur.fr; s=google; + h=mime-version:references:in-reply-to:from:date:message-id:subject:to; + bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=; + b=SEYSmxbTKCuc1baQZzjIJwm7WXvgjt/nEGhMLqWxQCU3beM3qhH8wYlSeMyB8Z/9pi + tszZFZhZ3cjnIbbJnjzsMYJgBnYbkf6hz14+BsFwyPU030EkDjJy2i3DSXzYK7A+GbBn + G9I9foG/4+pcx0LnFsjchGsRhLFkTKJIsP2SVfOx0wlim3WHMIqIXvKsxY05PoPyf8Tp + IwQi7iNl/+nTyjNHl2DQh+ty3CRTmUw9uEbY+jRRvIg5i/7cfREekK98d7qi/5HQycr6 + aptRDdCVHXpe47q+c7OPiMEEQWs+mFJhBqPXIlU54fwFApEEnLn/jwGbrPsrPYJaswgI + vd/g== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:mime-version:references:in-reply-to:from:date + :message-id:subject:to; + bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=; + b=M6a4k1gKc4e7TwKncuNPy0b3KxutR1FLFJGWxd4NyW84b7f3LfIR94IeInLQIWmY8C + Ddus0upZJI4+NN9XBGvXCdsiiYlwFGBJRWwjv82XFKVAKL5DD94RJNQZJUiE39hgJ2aa + 6V9gasiP+nUAX4ZV9bZmw21CgKEZrZVXh5unmW2ABrfcx8lHjp/DUw5XEkym1J92Wo1l + g0H3XrC2FL+aQuj+WpCynMNkY9ljw71oqyv3SP9pjnVNHArAdZiPMHkNxiuPdq7q41fg + eIbdRCQXYZL5O48QsjDdiXwaQzx+NcYtrKAH0RIVD1lG6zc9pxqDJsbGxP9VLs8jGDTT + mSdQ== +X-Gm-Message-State: AOAM532LuATWDKbo1HImMWshHVqb0kC0isehf3owfYUKq5J68o3juKbm kCgUMt25A2C7QoNMDXcjfJyteBNQD7ZhSh3yeYTGoLSvsD4= +X-Google-Smtp-Source: ABdhPJyQYCpCHSwA87x030i8YChySZqcNXxT1qVlZyEA+XM6DTyPZusa8gtbDUVcMyx7Jma/7toh+4EEE2bWg0bG+2E= +X-Received: by 2002:aed:3e8e:: with SMTP id n14mr3547383qtf.67.1597942562373; Thu, 20 Aug 2020 09:56:02 -0700 (PDT) +MIME-Version: 1.0 +References: +In-Reply-To: +From: John Tester +Date: Thu, 20 Aug 2020 18:55:36 +0200 +Message-ID: +Subject: Re: Support besoin +To: John Tester +Content-Type: multipart/alternative; boundary="000000000000cd54be05ad51fe67" + +--000000000000cd54be05ad51fe67 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +Merci + +Le jeu. 20 ao=C3=BBt 2020 =C3=A0 18:34, John Tester a +=C3=A9crit : + +> Merci pour votre question. +> Voici la rep. +> +> Le jeu. 20 ao=C3=BBt 2020 =C3=A0 17:29, John Tester +> a =C3=A9crit : +> +>> adfsdfsdfds +>> +>> -- +>> Laurent. +>> +>> ------------------------------------------------------------------------= +------------ +>> Twitter: https://www.twitter.com/eldy10 +>> +> + +--=20 +Laurent. +---------------------------------------------------------------------------= +--------- +Twitter: https://www.twitter.com/eldy10 + +--000000000000cd54be05ad51fe67 +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +
Merci

Le=C2=A0jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A018:34, Lau= +rent Destailleur <testldrdev@gma= +il.com> a =C3=A9crit=C2=A0:
Merci pour votre question.
Voici la= + rep.

Le=C2=A0jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A017:29, Laurent Destai= +lleur <laure= +nt@destailleur.fr> a =C3=A9crit=C2=A0:
adfsdfsdfds

--
Laurent.
-----------------------= +-------------------------------------------------------------
Twitter: <= +a href=3D"https://www.twitter.com/eldy10" target=3D"_blank">https://www.twi= +tter.com/eldy10
+
+


--
Laurent.
------------------------------------= +------------------------------------------------
Twitter: https://www.twitter.com/eldy= +10
+ +--000000000000cd54be05ad51fe67-- \ No newline at end of file diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 6a3fa8e7998..43442fa0ca5 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -488,7 +488,7 @@ class AccountingAccount extends CommonObject { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowAccoutingAccount"); + $label = $langs->trans("ShowAccountingAccount"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index af98dc14653..0f5acd96ae2 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -65,9 +65,9 @@ $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0) $page = 0; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$offset = $limit * $page; if (!$sortfield) $sortfield = "f.datef, f.ref, fd.rowid"; if (!$sortorder) { @@ -92,7 +92,7 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { - $search_societe=''; + $search_societe = ''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -176,7 +176,8 @@ print ''; + + +// Part to create +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + + dol_fiche_head(array(), ''); + + // Set some default values + //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + dol_fiche_end(); + + print '
'; + print ''; + print '  '; + print ''; // Cancel for create does not post form if we don't know the backtopage + print '
'; + + print '
'; + + //dol_set_focus('input[name="ref"]'); +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + print load_fiche_titre($langs->trans("RecruitmentCandidature"), '', 'object_'.$object->picto); + + print '
'; + print ''; + print ''; + print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + + dol_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print '   '; + print '
'; + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = recruitmentcandidaturePrepareHead($object); + dol_fiche_head($head, 'card', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRecruitmentCandidature'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); + } + // Confirmation to delete line + if ($action == 'deleteline') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'xxx') + { + $formquestion = array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; + $morehtmlref .= ' : '; + if ($action == 'classify') { + //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + $keyforbreak='description'; // We change column just before this field + unset($object->fields['email']); // Hide field already shown in banner + //unset($object->fields['fk_soc']); // Hide field already shown in banner + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + // Other attributes. Fields from hook formObjectOptions and Extrafields. + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + + + /* + * Lines + */ + + if (!empty($object->table_element_line)) + { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + { + print ''; + } + + if (!empty($object->lines)) + { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') + { + if ($action != 'editline') + { + // Add products/services form + $object->formAddObjectLine(1, $mysoc, $soc); + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } + } + + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + { + print '
'; + } + print '
'; + + print "
\n"; + } + + + // Buttons for actions + + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + // Send + if (empty($user->socid)) { + print ''.$langs->trans('SendMail').''."\n"; + } + + // Back to draft + if ($object->status == $object::STATUS_VALIDATED) + { + if ($permissiontoadd) + { + print ''.$langs->trans("SetToDraft").''; + } + } + + // Modify + if ($permissiontoadd) + { + print ''.$langs->trans("Modify").''."\n"; + } else { + print ''.$langs->trans('Modify').''."\n"; + } + + // Validate + if ($object->status == $object::STATUS_DRAFT) + { + if ($permissiontoadd) + { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) + { + print ''.$langs->trans("Validate").''; + } else { + $langs->load("errors"); + print ''.$langs->trans("Validate").''; + } + } + } + + // Refuse - Decline + if ($object->status >= $object::STATUS_DRAFT && $object->status < $object::STATUS_CANCELED) + { + if ($permissiontoadd) + { + print ''.$langs->trans("Decline").''; + } + } + + // Clone + if ($permissiontoadd) + { + print ''.$langs->trans("ToClone").''."\n"; + } + + /* + if ($permissiontoadd) + { + if ($object->status == $object::STATUS_ENABLED) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + if ($permissiontoadd) + { + if ($object->status == $object::STATUS_VALIDATED) + { + print ''.$langs->trans("Cancel").''."\n"; + } + else + { + print ''.$langs->trans("Re-Open").''."\n"; + } + } + */ + + // Delete (need delete permission, or if draft, just need create/modify permission) + if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) + { + print ''.$langs->trans('Delete').''."\n"; + } else { + print ''.$langs->trans('Delete').''."\n"; + } + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + $includedocgeneration = 1; + + // Documents + if ($includedocgeneration) { + $objref = dol_sanitizeFileName($object->ref); + $relativepath = $objref . '/' . $objref . '.pdf'; + $filedir = $conf->recruitment->dir_output.'/'.$object->element.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->recruitment->recruitmentjobposition->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->recruitment->recruitmentjobposition->write; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('recruitment:RecruitmentCandidature', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + } + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('recruitmentcandidature')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright .= $langs->trans("SeeAll"); + $morehtmlright .= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, $object->element.'@recruitment', (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); + + print '
'; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) $action = 'presend'; + + // Presend form + $modelmail = 'recruitmentcandidature'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->recruitment->dir_output; + $trackid = 'recruitmentcandidature'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php new file mode 100644 index 00000000000..780447ae804 --- /dev/null +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -0,0 +1,205 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file recruitmentcandidature_document.php + * \ingroup recruitment + * \brief Tab for documents linked to RecruitmentCandidature + */ + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); +dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("recruitment", "companies", "other", "mails")); + + +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm'); +$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); +$ref = GETPOST('ref', 'alpha'); + +// Get parameters +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "name"; +//if (! $sortfield) $sortfield="position_name"; + +// Initialize technical objects +$object = new RecruitmentCandidature($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('recruitmentcandidaturedocument', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentcandidature/".dol_sanitizeFileName($object->ref); + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$result = restrictedArea($user, 'recruitment', $object->id); + +$permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_addupdatedelete.inc.php + + + +/* + * Actions + */ + +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$title = $langs->trans("RecruitmentJobPosition").' - '.$langs->trans("Files"); +$help_url = ''; +//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +if ($object->id) +{ + /* + * Show tabs + */ + $head = recruitmentCandidaturePrepareHead($object); + + dol_fiche_head($head, 'document', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + + + // Build file list + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $totalsize = 0; + foreach ($filearray as $key => $file) + { + $totalsize += $file['size']; + } + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + */ + // Project + /*if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref .=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref .= '
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + + print '
'; + print ''; + + // Number of files + print ''; + + // Total size + print ''; + + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + + print '
'; + + dol_fiche_end(); + + $modulepart = 'recruitment'; + $permission = $user->rights->recruitment->recruitmentjobposition->write; + $permtoedit = $user->rights->recruitment->recruitmentjobposition->write; + $param = '&id='.$object->id; + + $relativepathwithnofile = 'recruitmentcandidature/'.dol_sanitizeFileName($object->ref).'/'; + + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; +} else { + accessforbidden('', 0, 1); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php new file mode 100644 index 00000000000..8cf1bc9dc61 --- /dev/null +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -0,0 +1,601 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file recruitmentcandidature_list.php + * \ingroup recruitment + * \brief List page for recruitmentcandidature + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL', '1'); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// load recruitment libraries +require_once __DIR__.'/class/recruitmentcandidature.class.php'; + +// for other modules +//dol_include_once('/othermodule/class/otherobject.class.php'); + +// Load translation files required by the page +$langs->loadLangs(array("recruitment@recruitment", "other")); + +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'recruitmentcandidaturelist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +$id = GETPOST('id', 'int'); + +// Load variable for pagination +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +// Initialize technical objects +$object = new RecruitmentCandidature($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('recruitmentcandidaturelist')); // Note that conf->hooks_modules contains array + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +//$extrafields->fetch_name_optionals_label($object->table_element_line); + +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Default sort order (if not yet defined by previous GETPOST) +if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. +if (!$sortorder) $sortorder = "ASC"; + +// Initialize array of search criterias +$search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml')); +$search = array(); +foreach ($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; +} + +// Definition of fields for list +$arrayfields = array(); +foreach ($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) { + $visible = dol_eval($val['visible'], 1); + $arrayfields['t.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'] + ); + } +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + ); + } + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + +$permissiontoread = $user->rights->recruitment->recruitmentjobposition->read; +$permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; +$permissiontodelete = $user->rights->recruitment->recruitmentjobposition->delete; + +// Security check +if (empty($conf->recruitment->enabled)) accessforbidden('Module not enabled'); +$socid = 0; +if ($user->socid > 0) // Protection if external user +{ + //$socid = $user->socid; + accessforbidden(); +} +//$result = restrictedArea($user, 'recruitment', $id, ''); +//if (!$permissiontoread) accessforbidden(); + + + +/* + * Actions + */ + +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } + +$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'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // 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 + { + foreach ($object->fields as $key => $val) + { + $search[$key] = ''; + } + $toselect = ''; + $search_array_options = array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) + { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + $objectclass = 'RecruitmentCandidature'; + $objectlabel = 'RecruitmentCandidature'; + $uploaddir = $conf->recruitment->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$form = new Form($db); + +$now = dol_now(); + +//$help_url="EN:Module_RecruitmentCandidature|FR:Module_RecruitmentCandidature_FR|ES:Módulo_RecruitmentCandidature"; +$help_url = ''; +$title = $langs->trans('ListOfCandidatures'); + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach ($object->fields as $key => $val) +{ + $sql .= 't.'.$key.', '; +} +// Add fields from extrafields +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +} +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); +$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; +else $sql .= " WHERE 1 = 1"; +foreach ($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if (strpos($object->fields[$key]['type'], 'integer:') === 0) { + if ($search[$key] == '-1') $search[$key] = ''; + $mode_search = 2; + } + if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); +} +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); +//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + +/* If a group by is required +$sql.= " GROUP BY "; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/,\s*$/','', $sql); +*/ + +$sql .= $db->order($sortfield, $sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) +{ + $num = $nbtotalofrecords; +} else { + if ($limit) $sql .= $db->plimit($limit + 1, $offset); + + $resql = $db->query($sql); + if (!$resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); +} + +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +print ''; + +$arrayofselected = is_array($toselect) ? $toselect : array(); + +$param = ''; +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +foreach ($search as $key => $val) +{ + if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); + else $param .= '&search_'.$key.'='.urlencode($search[$key]); +} +if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + 'validate'=>$langs->trans("Validate"), + //'generate_doc'=>$langs->trans("ReGeneratePDF"), + //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), +); +if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + +print '
'."\n"; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +//print ''; +print ''; + +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendRecruitmentCandidatureRef"; +$modelmail = "recruitmentcandidature"; +$objecttmp = new RecruitmentCandidature($db); +$trackid = 'xxxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($search_all) +{ + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
';*/ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (!empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +foreach ($object->fields as $key => $val) +{ + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print ''; +print ''."\n"; + + +// Fields title label +// -------------------------------------------------------------------- +print ''; +foreach ($object->fields as $key => $val) +{ + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + } +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine = 0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + + +// Loop on record +// -------------------------------------------------------------------- +$i = 0; +$totalarray = array(); +while ($i < ($limit ? min($num, $limit) : $num)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->setVarsFromFetchObj($obj); + + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) + { + $cssforfield = (empty($val['css']) ? '' : $val['css']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + if ($key == 'status') print $object->getLibStatut(5); + else print $object->showOutputField($val, $key, $object->$key, ''); + print ''; + if (!$i) $totalarray['nbfield']++; + if (!empty($val['isameasure'])) + { + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (!$i) $totalarray['nbfield']++; + + print ''."\n"; + + $i++; +} + +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''; +} + + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + elseif (strpos($val['type'], 'integer:') === 0) { + print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + print ''; +$searchpicto = $form->showFilterButtons(); +print $searchpicto; +print '
'; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected = 0; + if (in_array($object->id, $arrayofselected)) $selected = 1; + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_recruitment', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php new file mode 100644 index 00000000000..f6b710821ce --- /dev/null +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -0,0 +1,163 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file recruitmentcandidature_note.php + * \ingroup recruitment + * \brief Car with notes on RecruitmentCandidature + */ + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); +dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("recruitment", "companies")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object = new RecruitmentCandidature($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('recruitmentjobpositionnote', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$result = restrictedArea($user, 'recruitment', $id); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity]."/".$object->id; + +$permissionnote = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_addupdatedelete.inc.php + + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + + +/* + * View + */ + +$form = new Form($db); + +//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$help_url = ''; +llxHeader('', $langs->trans('RecruitmentCandidature'), $help_url); + +if ($id > 0 || !empty($ref)) +{ + $object->fetch_thirdparty(); + + $head = recruitmentCandidaturePrepareHead($object); + + dol_fiche_head($head, 'note', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + */ + // Project + /*if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref .= $langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref .=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + + $cssclass = "titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php index cf1f0e7dee4..45240512b11 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/recruitmentindex.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page @@ -61,6 +62,7 @@ $now = dol_now(); $form = new Form($db); $formfile = new FormFile($db); $staticrecruitmentjobposition = new RecruitmentJobPosition($db); +$staticrecruitmentcandidature = new RecruitmentCandidature($db); llxHeader("", $langs->trans("RecruitmentArea")); @@ -108,11 +110,11 @@ if ($conf->use_javascript_ajax) print '
'; print ''; - print ''."\n"; + print ''."\n"; $listofstatus = array(0, 1, 3, 9); foreach ($listofstatus as $status) { - $dataseries[] = array($staticrecruitmentjobposition->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + $dataseries[] = array(dol_html_entity_decode($staticrecruitmentjobposition->LibStatut($status, 1), ENT_QUOTES), (isset($vals[$status]) ? (int) $vals[$status] : 0)); if ($status == RecruitmentJobPosition::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; if ($status == RecruitmentJobPosition::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; if ($status == RecruitmentJobPosition::STATUS_RECRUITED) $colorseries[$status] = $badgeStatus4; @@ -150,6 +152,84 @@ if ($conf->use_javascript_ajax) } else { dol_print_error($db); } + + $sql = "SELECT COUNT(t.rowid) as nb, status"; + $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as t"; + $sql .= " GROUP BY t.status"; + $sql .= " ORDER BY t.status ASC"; + $resql = $db->query($sql); + + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + $totalnb = 0; + $dataseries = array(); + $colorseries = array(); + $vals = array(); + + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $vals[$obj->status] = $obj->nb; + + $totalnb += $obj->nb; + } + $i++; + } + $db->free($resql); + + print '
'; + print '
'.$langs->trans("Statistics").' - '.$langs->trans("Recruitment").'
'.$langs->trans("Statistics").' - '.$langs->trans("JobPositions").'
'; + print ''."\n"; + $listofstatus = array(0, 1, 3, 5, 8, 9); + foreach ($listofstatus as $status) + { + $dataseries[] = array(dol_html_entity_decode($staticrecruitmentcandidature->LibStatut($status, 1), ENT_QUOTES), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == RecruitmentCandidature::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == RecruitmentCandidature::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == RecruitmentCandidature::STATUS_CONTRACT_PROPOSED) $colorseries[$status] = $badgeStatus4; + if ($status == RecruitmentCandidature::STATUS_CONTRACT_SIGNED) $colorseries[$status] = $badgeStatus5; + if ($status == RecruitmentCandidature::STATUS_REFUSED) $colorseries[$status] = $badgeStatus8; + if ($status == RecruitmentCandidature::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; + + if (empty($conf->use_javascript_ajax)) + { + print ''; + print ''; + print ''; + print "\n"; + } + } + if ($conf->use_javascript_ajax) + { + print ''; + } + print "
'.$langs->trans("Statistics").' - '.$langs->trans("Candidatures").'
'.$staticrecruitmentcandidature->LibStatut($status, 0).''.(isset($vals[$status]) ? $vals[$status] : 0).'
'; + + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); + $dolgraph->setShowLegend(2); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(array('pie')); + $dolgraph->SetHeight('200'); + $dolgraph->draw('idgraphstatuscandidature'); + print $dolgraph->show($totalnb ? 0 : 1); + + print '
"; + print "
"; + + print "
"; + } else { + dol_print_error($db); + } } print '
'; @@ -240,8 +320,7 @@ print '
'; $NBMAX = 3; $max = 3; -/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT */ -// Last modified myobject +// Last modified job position if (! empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) { $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms"; @@ -264,7 +343,7 @@ if (! empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitm print ''; print $langs->trans("BoxTitleLatestModifiedJobPositions", $max); print ''; - print ''.$langs->trans("DateModificationShort").''; + print ''.$langs->trans("FullList").''; print ''; if ($num) { @@ -296,6 +375,60 @@ if (! empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitm } } +// Last modified job position +if (! empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) +{ + $sql = "SELECT rc.rowid, rc.ref, rc.date_creation, rc.tms"; + $sql.= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; + if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; + if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql.= " AND s.fk_soc = $socid"; + $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->plimit($max, 0); + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + print ''; + print ''; + print ''; + print ''; + print ''; + if ($num) + { + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $staticrecruitmentcandidature->id=$objp->rowid; + $staticrecruitmentcandidature->ref=$objp->ref; + $staticrecruitmentcandidature->status = $objp->status; + $staticrecruitmentcandidature->date_creation = $objp->date_creation; + + print ''; + print ''; + print '"; + print '"; + print ''; + $i++; + } + + $db->free($resql); + } else { + print ''; + } + print "
'; + print $langs->trans("BoxTitleLatestModifiedCandidatures", $max); + print ''.$langs->trans("FullList").'
'.$staticrecruitmentcandidature->getNomUrl(1, '').''; + print "'.dol_print_date($db->jdate($objp->tms), 'day')."
'.$langs->trans("None").'

"; + } else { + dol_print_error($db); + } +} print '
'; diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index d54cec57e9a..a96455a33ff 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -204,7 +204,7 @@ if ($object->id > 0) $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.$object->element.'&originid='.$object->id; + $out = '&origin='.$object->element.'@recruitment&originid='.$object->id; $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index b549c22d632..e34f5193bd1 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -77,7 +77,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity?$object->entity:$conf->entity] . "/recruitmentjobposition/" . dol_sanitizeFileName($object->id); if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentjobposition/".dol_sanitizeFileName($object->ref); // Security check - Protection if external user @@ -190,10 +189,8 @@ if ($object->id) dol_fiche_end(); $modulepart = 'recruitment'; - //$permission = $user->rights->recruitment->recruitmentjobposition->write; - $permission = 1; - //$permtoedit = $user->rights->recruitment->recruitmentjobposition->write; - $permtoedit = 1; + $permission = $user->rights->recruitment->recruitmentjobposition->write; + $permtoedit = $user->rights->recruitment->recruitmentjobposition->write; $param = '&id='.$object->id; //$relativepathwithnofile='recruitmentjobposition/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 85c27a29b7e..d6c3a18261e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -58,8 +58,6 @@ $linkback = ''; print load_fiche_titre($transAreaType, $linkback, 'companies'); -//print ''; -//print '
'; print '
'; @@ -220,7 +218,6 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA print '
'; } -//print '
'; print '
'; @@ -331,7 +328,6 @@ if ($result) dol_print_error($db); } -//print '
'; print ''; $parameters = array('user' => $user); diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index f085067197e..54e0752736c 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -74,7 +74,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = '
'.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register'); print '
'; diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 2ec623024c7..e3b6a8d0099 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -79,7 +79,7 @@ llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayof $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index 902bcfc81d4..82940f2296a 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -110,7 +110,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'other', 'TakePOS', -1, 'cash-register'); print '
'; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 252781ec635..27b3a20cab9 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -78,7 +78,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'receipt', 'TakePOS', -1, 'cash-register'); print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 52df6df9b79..148976cc778 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -130,7 +130,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'setup', 'TakePOS', -1, 'cash-register'); // Numbering modules diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 49b99daf280..fb43af6356a 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -124,7 +124,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register'); print '
'; diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index 2286f19e355..e89fdeec39f 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -149,7 +149,7 @@ div.mainmenu.generic4::before { opacity: 0.7; color: #440; } -.fa-at, .fa-external-link-alt { +.fa-at, .fa-external-link-alt, .fa-share-alt { opacity: 0.7; color: #304; } diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 06999ae8de8..7331c169246 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -167,6 +167,10 @@ a.butAction:hover, a.butActionNew:hover, a.butActionDelete:hover { TITLE BUTTON */ +div.pagination li:first-child a.btnTitle { + margin-left: 10px; +} + .btnTitle, a.btnTitle { display: inline-block; padding: 6px 12px; @@ -196,6 +200,11 @@ TITLE BUTTON background-color: #fbfbfb; } +a.btnTitle.btnTitleSelected { + border: 1px solid #ccc; + border-radius: 3px; +} + .btnTitle > .btnTitle-icon{ } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 926e59aef51..1297a99bf99 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -283,6 +283,9 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { font-weight: bold; margin-bottom: 6px; } +.info-box-title { + width: calc(100% - 20px); +} .info-box-text{ font-size: 0.92em; } diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index a1e9b4d6449..2bca6430d0b 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -42,3 +42,56 @@ div.mainmenu.generic3::before { div.mainmenu.generic4::before { content: "\f249"; } + +/* Define color of some picto */ + +.fa-phone, .fa-mobile-alt, .fa-fax { + opacity: 0.7; + color: #440; +} +.fa-at, .fa-external-link-alt, .fa-share-alt { + opacity: 0.7; + color: #304; +} +.fa-trash { + color: #666; +} +.fa-trash:hover:before { + color: #800; +} +.fa-play { + color: #444; +} +.fa-unlink { + color: #555; +} + +/* Define square Dolibarr logo in pure CSS */ + +.fa-dolibarr-css{ + color: #235481; + background: currentColor; + height: 150px; + width: 150px; + position: relative; +} +.fa-dolibarr-css:before{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 25%; + height: 25%; + border: solid 30px white; + border-radius: 0% 200% 200% 0% / 0% 180% 180% 0%; +} +.fa-dolibarr-css:after{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 5px; + height: 25%; + border-bottom: solid 60px currentColor; + margin-left: 30px; +} diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index d03ef3cd614..437df1981ba 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -894,8 +894,6 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd if ($object->fk_user_assign > 0) { $userstat->fetch($object->fk_user_assign); print $userstat->getNomUrl(1); - } else { - print $langs->trans('None'); } // Show user list to assignate one if status is "read" @@ -1027,7 +1025,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); print ''; // Group - print ''.$langs->trans("TicketGroup").''; + print ''.$langs->trans("TicketCategory").''; print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); print ''; // Severity @@ -1178,7 +1176,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd { // Show link to add a message (if read and not closed) if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { - print ''; + print ''; } // Link to create an intervention @@ -1207,7 +1205,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } print ''."\n"; } else { - print '
'; + //print '
'; } // Select mail models is same action as presend @@ -1256,6 +1254,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
'; + print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket'); print '
'; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4c5b599da90..4e62a92a4c9 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -171,6 +171,8 @@ class Ticket extends CommonObject */ public $notify_tiers_at_create; + public $email_msgid; + public $lines; /** @@ -178,33 +180,6 @@ class Ticket extends CommonObject */ public $regeximgext = '\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff'; - public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), - 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), - 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), - 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), - 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth150'), - 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), - 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), - 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), - 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), - 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), - 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1), - 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), - 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), - 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), - 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), - 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), - ); - /** * Status */ @@ -218,6 +193,62 @@ class Ticket extends CommonObject const STATUS_CANCELED = 9; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + public $fields = array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), + 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), + 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), + 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth150'), + 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), + 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), + 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), + 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), + 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), + 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1), + 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), + 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), + 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), + 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), + 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), + 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), + ); + // END MODULEBUILDER PROPERTIES + + /** * Constructor * @@ -347,6 +378,7 @@ class Ticket extends CommonObject $sql .= "origin_email,"; $sql .= "fk_user_create,"; $sql .= "fk_user_assign,"; + $sql .= "email_msgid,"; $sql .= "subject,"; $sql .= "message,"; $sql .= "fk_statut,"; @@ -369,6 +401,7 @@ class Ticket extends CommonObject $sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").","; $sql .= " ".($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')).","; $sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').","; + $sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").","; $sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").","; $sql .= " ".(!isset($this->message) ? 'NULL' : "'".$this->db->escape($this->message)."'").","; $sql .= " ".(!isset($this->fk_statut) ? '0' : "'".$this->db->escape($this->fk_statut)."'").","; @@ -437,12 +470,13 @@ class Ticket extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @param string $track_id Track id, a hash like ref - * @return int <0 if KO, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param string $track_id Track id, a hash like ref + * @param string $email_msgid Email msgid + * @return int <0 if KO, >0 if OK */ - public function fetch($id = '', $ref = '', $track_id = '') + public function fetch($id = '', $ref = '', $track_id = '', $email_msgid = '') { global $langs; @@ -455,6 +489,7 @@ class Ticket extends CommonObject $sql = "SELECT"; $sql .= " t.rowid,"; + $sql .= " t.entity,"; $sql .= " t.ref,"; $sql .= " t.track_id,"; $sql .= " t.fk_soc,"; @@ -462,6 +497,7 @@ class Ticket extends CommonObject $sql .= " t.origin_email,"; $sql .= " t.fk_user_create,"; $sql .= " t.fk_user_assign,"; + $sql .= " t.email_msgid,"; $sql .= " t.subject,"; $sql .= " t.message,"; $sql .= " t.fk_statut as status,"; @@ -485,10 +521,12 @@ class Ticket extends CommonObject $sql .= " WHERE t.rowid = ".$this->db->escape($id); } else { $sql .= " WHERE t.entity IN (".getEntity($this->element, 1).")"; - if ($track_id) { - $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; - } elseif ($ref) { + if (! empty($ref)) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; + } elseif ($track_id) { + $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; + } else { + $sql .= " AND t.email_msgid = '".$this->db->escape($email_msgid)."'"; } } @@ -508,6 +546,7 @@ class Ticket extends CommonObject $this->origin_email = $obj->origin_email; $this->fk_user_create = $obj->fk_user_create; $this->fk_user_assign = $obj->fk_user_assign; + $this->email_msgid = $obj->email_msgid; $this->subject = $obj->subject; $this->message = $obj->message;