start develop by fork of hesabfa wc plugin thanks Developers of this repo
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.idea/
|
674
LICENSE
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
339
LICENSE.txt
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
31
README.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
=== Hesabix Accounting ===
|
||||
Contributors: saeedsb, hamidprime, sepehr-najafi
|
||||
Tags: accounting cloud hesabix
|
||||
Requires at least: 5.2
|
||||
Tested up to: 6.4.2
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 2.0.93
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Connect Hesabix Online Accounting to WooCommerce.
|
||||
|
||||
== Description ==
|
||||
This plugin helps connect your (online) store to Hesabix online accounting software. By using this plugin, saving products, contacts, and orders in your store will also save them automatically in your Hesabix account. Besides that, just after a client pays a bill, the receipt document will be stored in Hesabix as well. Of course, you have to register your account in Hesabix first. To do so, visit Hesabix at the link here www.hesabix.com and sign up for free. After you signed up and entered your account, choose your business, then in the settings menu/API, you can find the API keys for the business and import them to the plugin settings. Now your module is ready to use.
|
||||
|
||||
For more information and a full guide to how to use Hesabix and WooCommerce Plugin, visit Hesabix’s website and go to the “Accounting School” menu.
|
||||
|
||||
== Installation ==
|
||||
1. Upload the plugin files to the `/wp-content/plugins/hesabix-accounting` directory, or install the hesabix plugin through the WordPress plugins screen directly.
|
||||
2. Activate the plugin through the \'Plugins\' screen in WordPress
|
||||
3. Use the Settings->Hesabix screen to configure the plugin
|
||||
|
||||
== Screenshots ==
|
||||
1. API setting page
|
||||
2. Catalog setting page
|
||||
3. Customers setting page
|
||||
4. Invoice setting page
|
||||
5. Payment Methods setting page
|
||||
6. Import and export setting page
|
||||
7. Sync setting page
|
||||
8. Log file
|
1521
admin/class-ssbhesabix-admin.php
Normal file
10790
admin/css/bootstrap.css
vendored
Normal file
105
admin/css/fontiran.css
Normal file
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
*
|
||||
* Name: IRANYekan Font
|
||||
* Version: 3.3
|
||||
* Author: Moslem Ebrahimi (moslemebrahimi.com)
|
||||
* Created on: Sep 17, 2020
|
||||
* Updated on: Sep 17, 2020
|
||||
* Website: http://fontiran.com
|
||||
* Copyright: Commercial/Proprietary Software
|
||||
--------------------------------------------------------------------------------------
|
||||
فونت ایران یکان یک نرم افزار مالکیتی محسوب می شود. جهت آگاهی از قوانین استفاده از این فونت ها لطفا به وب سایت (فونت ایران دات کام) مراجعه نمایید
|
||||
--------------------------------------------------------------------------------------
|
||||
IRANYekan fonts are considered a proprietary software. To gain information about the laws regarding the use of these fonts, please visit www.fontiran.com
|
||||
--------------------------------------------------------------------------------------
|
||||
This set of fonts are used in this project under the license: (.....)
|
||||
--------------------------------------------------------------------------------------
|
||||
*
|
||||
**/
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src: url('../fonts/eot/iranyekanwebbold.eot');
|
||||
src: url('../fonts/eot/iranyekanwebbold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebbold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebbold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebbold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: url('../fonts/eot/iranyekanwebthin.eot');
|
||||
src: url('../fonts/eot/iranyekanwebthin.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebthin.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebthin.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebthin.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: url('../fonts/eot/iranyekanweblight.eot');
|
||||
src: url('../fonts/eot/iranyekanweblight.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanweblight.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanweblight.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanweblight.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: url('../fonts/eot/iranyekanwebregular.eot');
|
||||
src: url('../fonts/eot/iranyekanwebregular.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebregular.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebregular.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebregular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url('../fonts/eot/iranyekanwebmedium.eot');
|
||||
src: url('../fonts/eot/iranyekanwebmedium.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebmedium.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebmedium.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebmedium.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 800;
|
||||
src: url('../fonts/eot/iranyekanwebextrabold.eot');
|
||||
src: url('../fonts/eot/iranyekanwebextrabold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebextrabold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebextrabold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebextrabold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 850;
|
||||
src: url('../fonts/eot/iranyekanwebblack.eot');
|
||||
src: url('../fonts/eot/iranyekanwebblack.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebblack.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebblack.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebblack.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iranyekan;
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url('../fonts/eot/iranyekanwebextrablack.eot');
|
||||
src: url('../fonts/eot/iranyekanwebextrablack.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
|
||||
url('../fonts/woff/iranyekanwebextrablack.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
|
||||
url('../fonts/woff2/iranyekanwebextrablack.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
|
||||
url('../fonts/ttf/iranyekanwebextrablack.ttf') format('truetype');
|
||||
}
|
67
admin/css/ssbhesabfa-admin.css
Normal file
|
@ -0,0 +1,67 @@
|
|||
* {
|
||||
font-family: "Tahoma", "Calibri", sans-serif;
|
||||
}
|
||||
|
||||
.hand {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hesabix-tab-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
a.nav-tab {
|
||||
padding: 5px 10px;
|
||||
font-weight: normal;
|
||||
border-radius: 7px 7px 0px 0px;
|
||||
|
||||
}
|
||||
|
||||
.hesabix-tab-page-title {
|
||||
color: dimgray;
|
||||
}
|
||||
|
||||
.hesabix-f-12 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
.hesabix-f li {
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.hesabix-header {
|
||||
background-color: #304967;
|
||||
box-shadow: 5px 5px 5px #f3f3f3;
|
||||
padding: 5px;
|
||||
margin-right: -20px;
|
||||
}
|
||||
|
||||
.hesabix-header img {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.hesabix-card {
|
||||
max-width: none !important;
|
||||
margin-left: 20px;
|
||||
background-color: whitesmoke !important;
|
||||
}
|
||||
|
||||
.hesabix-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hesabix-plugin-tutorial-chapter {
|
||||
color: dimgray;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid silver;
|
||||
margin-bottom: 5px;
|
||||
padding-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.hesabix-plugin-tutorial-chapter:hover {
|
||||
color: dodgerblue;
|
||||
cursor: pointer;
|
||||
}
|
BIN
admin/fonts/eot/IRANYekanWebBlack.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebBold.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebExtraBlack.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebExtraBold.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebLight.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebMedium.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebRegular.eot
Normal file
BIN
admin/fonts/eot/IRANYekanWebThin.eot
Normal file
1548
admin/fonts/svg/IRANYekanWebRegular.svg
Normal file
After Width: | Height: | Size: 216 KiB |
1474
admin/fonts/svg/iranyekanwebblack.svg
Normal file
After Width: | Height: | Size: 198 KiB |
1569
admin/fonts/svg/iranyekanwebbold.svg
Normal file
After Width: | Height: | Size: 219 KiB |
1486
admin/fonts/svg/iranyekanwebextrablack.svg
Normal file
After Width: | Height: | Size: 199 KiB |
1472
admin/fonts/svg/iranyekanwebextrabold.svg
Normal file
After Width: | Height: | Size: 196 KiB |
1619
admin/fonts/svg/iranyekanweblight.svg
Normal file
After Width: | Height: | Size: 230 KiB |
1573
admin/fonts/svg/iranyekanwebmedium.svg
Normal file
After Width: | Height: | Size: 220 KiB |
1639
admin/fonts/svg/iranyekanwebthin.svg
Normal file
After Width: | Height: | Size: 238 KiB |
BIN
admin/fonts/ttf/IRANYekanWebBlack.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebBold.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebExtraBlack.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebExtraBold.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebLight.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebMedium.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebRegular.ttf
Normal file
BIN
admin/fonts/ttf/IRANYekanWebThin.ttf
Normal file
BIN
admin/fonts/woff/IRANYekanWebBlack.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebBold.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebExtraBlack.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebExtraBold.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebLight.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebMedium.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebRegular.woff
Normal file
BIN
admin/fonts/woff/IRANYekanWebThin.woff
Normal file
BIN
admin/fonts/woff2/IRANYekanWebBlack.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebBold.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebExtraBlack.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebExtraBold.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebLight.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebMedium.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebRegular.woff2
Normal file
BIN
admin/fonts/woff2/IRANYekanWebThin.woff2
Normal file
BIN
admin/img/hesabfa-logo.fa.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
1
admin/img/icons/box-open.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M425.7 256c-16.9 0-32.8-9-41.4-23.4L320 126l-64.2 106.6c-8.7 14.5-24.6 23.5-41.5 23.5-4.5 0-9-.6-13.3-1.9L64 215v178c0 14.7 10 27.5 24.2 31l216.2 54.1c10.2 2.5 20.9 2.5 31 0L551.8 424c14.2-3.6 24.2-16.4 24.2-31V215l-137 39.1c-4.3 1.3-8.8 1.9-13.3 1.9zm212.6-112.2L586.8 41c-3.1-6.2-9.8-9.8-16.7-8.9L320 64l91.7 152.1c3.8 6.3 11.4 9.3 18.5 7.3l197.9-56.5c9.9-2.9 14.7-13.9 10.2-23.1zM53.2 41L1.7 143.8c-4.6 9.2.3 20.2 10.1 23l197.9 56.5c7.1 2 14.7-1 18.5-7.3L320 64 69.8 32.1c-6.9-.8-13.5 2.7-16.6 8.9z"/></svg>
|
After Width: | Height: | Size: 776 B |
1
admin/img/icons/cog.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"/></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
admin/img/icons/file-alt.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"/></svg>
|
After Width: | Height: | Size: 752 B |
1
admin/img/icons/file-export.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M384 121.9c0-6.3-2.5-12.4-7-16.9L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128zM571 308l-95.7-96.4c-10.1-10.1-27.4-3-27.4 11.3V288h-64v64h64v65.2c0 14.3 17.3 21.4 27.4 11.3L571 332c6.6-6.6 6.6-17.4 0-24zm-379 28v-32c0-8.8 7.2-16 16-16h176V160H248c-13.2 0-24-10.8-24-24V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V352H208c-8.8 0-16-7.2-16-16z"/></svg>
|
After Width: | Height: | Size: 641 B |
1
admin/img/icons/file-invoice-dollar.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-153 31V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zM64 72c0-4.42 3.58-8 8-8h80c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8H72c-4.42 0-8-3.58-8-8V72zm0 80v-16c0-4.42 3.58-8 8-8h80c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8H72c-4.42 0-8-3.58-8-8zm144 263.88V440c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-24.29c-11.29-.58-22.27-4.52-31.37-11.35-3.9-2.93-4.1-8.77-.57-12.14l11.75-11.21c2.77-2.64 6.89-2.76 10.13-.73 3.87 2.42 8.26 3.72 12.82 3.72h28.11c6.5 0 11.8-5.92 11.8-13.19 0-5.95-3.61-11.19-8.77-12.73l-45-13.5c-18.59-5.58-31.58-23.42-31.58-43.39 0-24.52 19.05-44.44 42.67-45.07V232c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8v24.29c11.29.58 22.27 4.51 31.37 11.35 3.9 2.93 4.1 8.77.57 12.14l-11.75 11.21c-2.77 2.64-6.89 2.76-10.13.73-3.87-2.43-8.26-3.72-12.82-3.72h-28.11c-6.5 0-11.8 5.92-11.8 13.19 0 5.95 3.61 11.19 8.77 12.73l45 13.5c18.59 5.58 31.58 23.42 31.58 43.39 0 24.53-19.05 44.44-42.67 45.07z"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
1
admin/img/icons/home.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"/></svg>
|
After Width: | Height: | Size: 760 B |
1
admin/img/icons/money-check-alt.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M608 32H32C14.33 32 0 46.33 0 64v384c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zM176 327.88V344c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-16.29c-11.29-.58-22.27-4.52-31.37-11.35-3.9-2.93-4.1-8.77-.57-12.14l11.75-11.21c2.77-2.64 6.89-2.76 10.13-.73 3.87 2.42 8.26 3.72 12.82 3.72h28.11c6.5 0 11.8-5.92 11.8-13.19 0-5.95-3.61-11.19-8.77-12.73l-45-13.5c-18.59-5.58-31.58-23.42-31.58-43.39 0-24.52 19.05-44.44 42.67-45.07V152c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8v16.29c11.29.58 22.27 4.51 31.37 11.35 3.9 2.93 4.1 8.77.57 12.14l-11.75 11.21c-2.77 2.64-6.89 2.76-10.13.73-3.87-2.43-8.26-3.72-12.82-3.72h-28.11c-6.5 0-11.8 5.92-11.8 13.19 0 5.95 3.61 11.19 8.77 12.73l45 13.5c18.59 5.58 31.58 23.42 31.58 43.39 0 24.53-19.05 44.44-42.67 45.07zM416 312c0 4.42-3.58 8-8 8H296c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h112c4.42 0 8 3.58 8 8v16zm160 0c0 4.42-3.58 8-8 8h-80c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h80c4.42 0 8 3.58 8 8v16zm0-96c0 4.42-3.58 8-8 8H296c-4.42 0-8-3.58-8-8v-16c0-4.42 3.58-8 8-8h272c4.42 0 8 3.58 8 8v16z"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
1
admin/img/icons/sync-alt.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"/></svg>
|
After Width: | Height: | Size: 1 KiB |
1
admin/img/icons/users.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#005D79" d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"/></svg>
|
After Width: | Height: | Size: 919 B |
BIN
admin/img/logo.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
admin/img/menu-icon.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
1
admin/index.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php // Silence is golden
|
7
admin/js/bootstrap.bundle.min.js
vendored
Normal file
863
admin/js/ssbhesabix-admin.js
Normal file
|
@ -0,0 +1,863 @@
|
|||
jQuery(function ($) {
|
||||
$('.progress').hide();
|
||||
'use strict';
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Export Products
|
||||
$('#ssbhesabix_export_products').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-export-product-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-export-product-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-export-product-submit').html('<i class="ofwc-spinner"></i> خروج محصولات...');
|
||||
$('#ssbhesabix-export-product-submit i.spinner').show();
|
||||
|
||||
$('#exportProductsProgress').show();
|
||||
$('#exp ortProductsProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
exportProducts(1, 1, 1, 0);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function exportProducts(batch, totalBatch, total, updateCount) {
|
||||
const data = {
|
||||
'action': 'adminExportProducts',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total,
|
||||
'updateCount': updateCount
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if (response !== 'failed') {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#exportProductsProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
exportProducts(res.batch + 1, res.totalBatch, res.total, res.updateCount);
|
||||
return false;
|
||||
} else {
|
||||
$('#exportProductsProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در استخراج محصولات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Import Products
|
||||
$('#ssbhesabix_import_products').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-import-product-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-import-product-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-import-product-submit').html('<i class="ofwc-spinner"></i> در حال ورود کالاها از حسابیکس, لطفاً صبر کنید...');
|
||||
$('#ssbhesabix-import-product-submit i.spinner').show();
|
||||
|
||||
$('#importProductsProgress').show();
|
||||
$('#importProductsProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
importProducts(1, 1, 1, 0);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function importProducts(batch, totalBatch, total, updateCount) {
|
||||
var data = {
|
||||
'action': 'adminImportProducts',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total,
|
||||
'updateCount': updateCount
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#importProductsProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
//alert('batch: ' + res.batch + ', totalBatch: ' + res.totalBatch + ', total: ' + res.total);
|
||||
importProducts(res.batch + 1, res.totalBatch, res.total, res.updateCount);
|
||||
return false;
|
||||
} else {
|
||||
$('#importProductsProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در وارد کردن محصولات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Export Products opening quantity
|
||||
$('#ssbhesabix_export_products_opening_quantity').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-export-product-opening-quantity-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-export-product-opening-quantity-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-export-product-opening-quantity-submit').html('<i class="ofwc-spinner"></i> استخراج موجودی اول دوره...');
|
||||
$('#ssbhesabix-export-product-opening-quantity-submit i.spinner').show();
|
||||
|
||||
$('#exportProductsOpeningQuantityProgress').show();
|
||||
$('#exportProductsOpeningQuantityProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
exportProductsOpeningQuantity(1, 1, 1);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function exportProductsOpeningQuantity(batch, totalBatch, total) {
|
||||
var data = {
|
||||
'action': 'adminExportProductsOpeningQuantity',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#exportProductsOpeningQuantityProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
exportProductsOpeningQuantity(res.batch + 1, res.totalBatch, res.total);
|
||||
return false;
|
||||
} else {
|
||||
$('#exportProductsOpeningQuantityProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در استخراج موجودی اول دوره');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Export Customers
|
||||
$('#ssbhesabix_export_customers').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-export-customer-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-export-customer-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-export-customer-submit').html('<i class="ofwc-spinner"></i> خروجی مشتریان، لطفاً صبر کنید...');
|
||||
$('#ssbhesabix-export-customer-submit i.spinner').show();
|
||||
|
||||
$('#exportCustomersProgress').show();
|
||||
$('#exportCustomersProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
exportCustomers(1, 1, 1, 0);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function exportCustomers(batch, totalBatch, total, updateCount) {
|
||||
const data = {
|
||||
'action': 'adminExportCustomers',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total,
|
||||
'updateCount': updateCount
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if (response !== 'failed') {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#exportCustomersProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
exportCustomers(res.batch + 1, res.totalBatch, res.total, res.updateCount);
|
||||
return false;
|
||||
} else {
|
||||
$('#exportCustomersProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در استخراج مشتریان');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Sync Changes
|
||||
$('#ssbhesabix_sync_changes').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-sync-changes-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-sync-changes-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-sync-changes-submit').html('<i class="ofwc-spinner"></i> همسان سازی تغییرات...');
|
||||
$('#ssbhesabix-sync-changes-submit i.spinner').show();
|
||||
|
||||
var data = {
|
||||
'action': 'adminSyncChanges'
|
||||
};
|
||||
|
||||
// post it
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
var redirectUrl = response;
|
||||
|
||||
/** Debug **/
|
||||
// console.log(redirectUrl);
|
||||
// return false;
|
||||
|
||||
top.location.replace(redirectUrl);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در همگام سازی تغییرات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
/*End Post*/
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Sync Products
|
||||
$('#ssbhesabix_sync_products').submit(function () {
|
||||
|
||||
// show processing status
|
||||
$('#ssbhesabix-sync-products-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-sync-products-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-sync-products-submit').html('<i class="ofwc-spinner"></i> همسان سازی محصولات...');
|
||||
$('#ssbhesabix-sync-products-submit i.spinner').show();
|
||||
|
||||
$('#syncProductsProgress').show();
|
||||
$('#syncProductsProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
syncProducts(1, 1, 1);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function syncProducts(batch, totalBatch, total) {
|
||||
const data = {
|
||||
'action': 'adminSyncProducts',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total
|
||||
};
|
||||
//$.post(URL, DATA, CALLBACK)
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if (response !== 'failed') {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#syncProductsProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
//alert('batch: ' + res.batch + ', totalBatch: ' + res.totalBatch + ', total: ' + res.total);
|
||||
syncProducts(res.batch + 1, res.totalBatch, res.total);
|
||||
return false;
|
||||
} else {
|
||||
$('#syncProductsProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در همگام سازی محصولات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Sync Orders
|
||||
$('#ssbhesabix_sync_orders').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-sync-orders-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-sync-orders-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-sync-orders-submit').html('<i class="ofwc-spinner"></i> همسان سازی سفارشات...');
|
||||
$('#ssbhesabix-sync-orders-submit i.spinner').show();
|
||||
|
||||
$('#syncOrdersProgress').show();
|
||||
$('#syncOrdersProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
syncOrders(1, 1, 1, 0);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
function syncOrders(batch, totalBatch, total, updateCount) {
|
||||
var date = $('#ssbhesabix_sync_order_date').val();
|
||||
|
||||
const data = {
|
||||
'action': 'adminSyncOrders',
|
||||
'date': date,
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total,
|
||||
'updateCount': updateCount
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if (response !== 'failed') {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#syncOrdersProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
syncOrders(res.batch + 1, res.totalBatch, res.total, res.updateCount);
|
||||
return false;
|
||||
} else {
|
||||
$('#syncOrdersProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در همگام سازی سفارشات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Sync Products
|
||||
$('#ssbhesabix_update_products').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix-update-products-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-update-products-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-update-products-submit').html('<i class="ofwc-spinner"></i> بروزرسانی محصولات...');
|
||||
$('#ssbhesabix-update-products-submit i.spinner').show();
|
||||
|
||||
$('#updateProductsProgress').show();
|
||||
$('#updateProductsProgressBar').css('width', 0 + '%').attr('aria-valuenow', 0);
|
||||
|
||||
updateProducts(1, 1, 1);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function updateProducts(batch, totalBatch, total) {
|
||||
var data = {
|
||||
'action': 'adminUpdateProducts',
|
||||
'batch': batch,
|
||||
'totalBatch': totalBatch,
|
||||
'total': total
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
res.batch = parseInt(res.batch);
|
||||
if (res.batch < res.totalBatch) {
|
||||
let progress = (res.batch * 100) / res.totalBatch;
|
||||
progress = Math.round(progress);
|
||||
$('#updateProductsProgressBar').css('width', progress + '%').attr('aria-valuenow', progress);
|
||||
updateProducts(res.batch + 1, res.totalBatch, res.total);
|
||||
return false;
|
||||
} else {
|
||||
$('#updateProductsProgressBar').css('width', 100 + '%').attr('aria-valuenow', 100);
|
||||
setTimeout(() => {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
alert('خطا در بروزرسانی محصولات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//=====================================================================================================================
|
||||
|
||||
// $(function () {
|
||||
// // AJAX - Sync Products with ID filter
|
||||
// $('#ssbhesabix_update_products_with_filter').submit(function (e) {
|
||||
//
|
||||
// // Show processing status
|
||||
// var submitButton = $('#ssbhesabix-update-products-with-filter-submit');
|
||||
// submitButton.removeClass('button-primary');
|
||||
// submitButton.html('<i class="ofwc-spinner"></i> بروزرسانی محصولات...');
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
// AJAX - Sync Products
|
||||
$('#ssbhesabix_update_products_with_filter').submit(function () {
|
||||
let submitButton = $('#ssbhesabix-update-products-with-filter-submit');
|
||||
let offset = document.getElementById("ssbhesabix-update-products-offset").value;
|
||||
let rpp = document.getElementById("ssbhesabix-update-products-rpp").value;
|
||||
submitButton.removeClass('button-primary');
|
||||
submitButton.html('<i class="ofwc-spinner"></i> بروزرسانی محصولات لطفا صبر کنید...');
|
||||
$('#ssbhesabix-update-products-with-filter-submit').attr('disabled', 'disabled');
|
||||
|
||||
updateProductsWithFilter(offset, rpp);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function updateProductsWithFilter(offset, rpp) {
|
||||
var data = {
|
||||
'action': 'adminUpdateProductsWithFilter',
|
||||
'offset': offset,
|
||||
'rpp': rpp,
|
||||
};
|
||||
if(offset && rpp) {
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
if(!res.error) {
|
||||
top.location.replace(res.redirectUrl);
|
||||
}
|
||||
} else {
|
||||
alert('خطا در بروزرسانی محصولات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('فیلد ها را به درستی وارد نمایید');
|
||||
submitButton.addClass('button-primary');
|
||||
submitButton.html('بروزرسانی محصولات در حسابیکس بر اساس فروشگاه در بازه ID مشخص شده');
|
||||
$('#ssbhesabix-update-products-with-filter-submit').removeAttr('disabled');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Clean log
|
||||
$('#ssbhesabix_clean_log').submit(function (e) {
|
||||
// show processing status
|
||||
$('#ssbhesabix-log-clean-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix-log-clean-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix-log-clean-submit').html('<i class="ofwc-spinner"></i> پاک کردن فایل لاگ، لطفاً صبر کنید...');
|
||||
$('#ssbhesabix-log-clean-submit i.spinner').show();
|
||||
|
||||
var data = {
|
||||
'action': 'adminCleanLogFile'
|
||||
};
|
||||
|
||||
// post it
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
var redirectUrl = response;
|
||||
|
||||
/** Debug **/
|
||||
// console.log(redirectUrl);
|
||||
// return false;
|
||||
|
||||
top.location.replace(redirectUrl);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در پاکسازی فایل لاگ');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
/*End Post*/
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - Sync Products Manually
|
||||
$('#ssbhesabix_sync_products_manually').submit(function () {
|
||||
// show processing status
|
||||
$('#ssbhesabix_sync_products_manually-submit').attr('disabled', 'disabled');
|
||||
$('#ssbhesabix_sync_products_manually-submit').removeClass('button-primary');
|
||||
$('#ssbhesabix_sync_products_manually-submit').html('<i class="ofwc-spinner"></i> ذخیره کردن اطلاعات...');
|
||||
$('#ssbhesabix_sync_products_manually i.spinner').show();
|
||||
|
||||
const inputArray = [];
|
||||
const inputs = $('.code-input');
|
||||
console.log(inputs);
|
||||
for (var n = 0; n < inputs.length; n++) {
|
||||
var i = inputs[n];
|
||||
console.log(i);
|
||||
const obj = {
|
||||
id: $(i).attr('id'),
|
||||
hesabix_id: $(i).val(),
|
||||
parent_id: $(i).attr('data-parent-id')
|
||||
}
|
||||
inputArray.push(obj);
|
||||
}
|
||||
|
||||
const page = $('#pageNumber').val();
|
||||
const rpp = $('#goToPage').attr('data-rpp');
|
||||
|
||||
var data = {
|
||||
'action': 'adminSyncProductsManually',
|
||||
'data': JSON.stringify(inputArray),
|
||||
'page': page,
|
||||
'rpp': rpp
|
||||
};
|
||||
|
||||
// post it
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
var redirectUrl = response;
|
||||
|
||||
/** Debug **/
|
||||
// console.log(redirectUrl);
|
||||
// return false;
|
||||
|
||||
top.location.replace(redirectUrl);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در ذخیره اطلاعات');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
/*End Post*/
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#goToPage").click(function () {
|
||||
const page = $('#pageNumber').val();
|
||||
const rpp = $('#goToPage').attr('data-rpp');
|
||||
window.location.href = "?page=hesabix-sync-products-manually&p=" + page + "&rpp=" + rpp;
|
||||
});
|
||||
|
||||
$("#show-tips-btn").click(function () {
|
||||
$('#tips-alert').removeClass('d-none');
|
||||
$('#tips-alert').addClass('d-block');
|
||||
});
|
||||
|
||||
$("#hide-tips-btn").click(function () {
|
||||
$('#tips-alert').removeClass('d-block');
|
||||
$('#tips-alert').addClass('d-none');
|
||||
});
|
||||
});
|
||||
|
||||
$(".btn-submit-invoice").on( "click", function() {
|
||||
var orderId = $(this).attr("data-order-id");
|
||||
|
||||
var btnEl = $('.btn-submit-invoice[data-order-id=' + orderId + ']');
|
||||
|
||||
btnEl.attr('aria-disabled', true);
|
||||
btnEl.addClass('disabled');
|
||||
btnEl.html('ثبت فاکتور...');
|
||||
//btnEl.show();
|
||||
|
||||
submitInvoice(orderId);
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function submitInvoice(orderId) {
|
||||
var data = {
|
||||
'action': 'adminSubmitInvoice',
|
||||
'orderId': orderId
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
// refresh page
|
||||
location.reload();
|
||||
} else {
|
||||
alert('خطا در ثبت فاکتور');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// change business warning
|
||||
var oldApiKey = '';
|
||||
$("#changeBusinessWarning").hide();
|
||||
|
||||
$("#ssbhesabix_account_api").focusin( function () {
|
||||
oldApiKey = $("#ssbhesabix_account_api" ).val();
|
||||
});
|
||||
$("#ssbhesabix_account_api").focusout( function () {
|
||||
var newApiKey = $("#ssbhesabix_account_api" ).val();
|
||||
if(oldApiKey != '' && oldApiKey != newApiKey) {
|
||||
$("#changeBusinessWarning").show();
|
||||
}
|
||||
});
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
// AJAX - clear all plugin data
|
||||
$('#hesabix-clear-plugin-data').click(function () {
|
||||
if (confirm('هشدار: با انجام این عملیات کلیه اطلاعات افزونه شامل روابط بین کالاها، مشتریان و فاکتور ها و همینطور تنظیمات افزونه حذف می گردد.' +
|
||||
'آیا از انجام این عملیات مطمئن هستید؟')) {
|
||||
$('#hesabix-clear-plugin-data').addClass('disabled');
|
||||
$('#hesabix-clear-plugin-data').html('حذف دیتای افزونه...');
|
||||
var data = {
|
||||
'action': 'adminClearPluginData'
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$('#hesabix-clear-plugin-data').removeClass('disabled');
|
||||
$('#hesabix-clear-plugin-data').html('حذف دیتای افزونه');
|
||||
if ('failed' !== response) {
|
||||
alert('دیتای افزونه با موفقیت حذف شد.');
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام حذف دیتای افزونه.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Do nothing!
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#hesabix-install-plugin-data').click(function () {
|
||||
if (confirm('با انجام این عملیات جدول افزونه در دیتابیس وردپرس ایجاد' +
|
||||
' و تنظیمات پیش فرض افزونه تنظیم می گردد.' +
|
||||
' آیا از انجام این عملیات مطمئن هستید؟')) {
|
||||
$('#hesabix-install-plugin-data').addClass('disabled');
|
||||
$('#hesabix-install-plugin-data').html('نصب دیتای افزونه...');
|
||||
var data = {
|
||||
'action': 'adminInstallPluginData'
|
||||
};
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$('#hesabix-install-plugin-data').removeClass('disabled');
|
||||
$('#hesabix-install-plugin-data').html('نصب دیتای افزونه');
|
||||
if ('failed' !== response) {
|
||||
alert('دیتای افزونه با موفقیت نصب شد.');
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام نصب دیتای افزونه.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Do nothing!
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
$(function () {
|
||||
//SAVE
|
||||
$(".hesabix-item-save").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
const attributeId = $(this).data('id');
|
||||
const code = $("#hesabix-item-" + attributeId).val();
|
||||
var data = {
|
||||
'action': 'adminChangeProductCode',
|
||||
'productId': productId,
|
||||
'attributeId': attributeId,
|
||||
'code': code,
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
alert(res.error ? res.message : 'کد کالای متصل با موفقیت تغییر کرد.');
|
||||
if(productId === attributeId)
|
||||
$("#ssbhesabix_hesabix_item_code_0").val(code);
|
||||
else
|
||||
$("#ssbhesabix_hesabix_item_code_" + attributeId).val(code);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام تغییر کد کالای متصل.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
//DELETE LINK
|
||||
$(".hesabix-item-delete-link").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
const attributeId = $(this).data('id');
|
||||
var data = {
|
||||
'action': 'adminDeleteProductLink',
|
||||
'productId': productId,
|
||||
'attributeId': attributeId
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
$("#hesabix-item-" + attributeId).val('');
|
||||
if(productId === attributeId)
|
||||
$("#ssbhesabix_hesabix_item_code_0").val('');
|
||||
else
|
||||
$("#ssbhesabix_hesabix_item_code_" + attributeId).val('');
|
||||
setTimeout(function (){
|
||||
alert(res.error ? res.message : 'ارتباط محصول با موفقیت حذف شد');
|
||||
}, 100);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام حذف ارتباط');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
//UPDATE
|
||||
$(".hesabix-item-update").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
const attributeId = $(this).data('id');
|
||||
var data = {
|
||||
'action': 'adminUpdateProduct',
|
||||
'productId': productId,
|
||||
'attributeId': attributeId
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
if(res.newPrice != null)
|
||||
$("#hesabix-item-price-" + attributeId).text(res.newPrice);
|
||||
if(res.newQuantity != null)
|
||||
$("#hesabix-item-quantity-" + attributeId).text(res.newQuantity);
|
||||
if(res.error)
|
||||
alert(res.message);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام بروزرسانی محصول');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
//SAVE ALL
|
||||
$("#hesabix-item-save-all").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
const itemsCode = $(".hesabix-item-code");
|
||||
const itemsData = [];
|
||||
for (let i = 0; i < itemsCode.length; i++) {
|
||||
const item = itemsCode[i];
|
||||
const attributeId = $(item).data('id');
|
||||
const code = $(item).val();
|
||||
itemsData.push({attributeId: attributeId, code: code});
|
||||
}
|
||||
|
||||
var data = {
|
||||
'action': 'adminChangeProductsCode',
|
||||
'productId': productId,
|
||||
'itemsData': itemsData
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
alert(res.error ? res.message : 'کد کالاهای متصل با موفقیت تغییر کرد.');
|
||||
location.reload();
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام تغییر کد کالاهای متصل');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
//DELETE
|
||||
$("#hesabix-item-delete-link-all").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
var data = {
|
||||
'action': 'adminDeleteProductsLink',
|
||||
'productId': productId
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
const itemsCode = $(".hesabix-item-code");
|
||||
for (let i = 0; i < itemsCode.length; i++) {
|
||||
const item = itemsCode[i];
|
||||
$(item).val('');
|
||||
}
|
||||
$('[id^="ssbhesabix_hesabix_item_code_"]').val('');
|
||||
setTimeout(function (){
|
||||
alert(res.error ? res.message : 'ارتباط محصولات با موفقیت حذف شد.');
|
||||
}, 100);
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام حذف ارتباط');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
//UPDATE ALL
|
||||
$("#hesabix-item-update-all").on('click', function (){
|
||||
const productId = $("#panel_product_data_hesabix").data('product-id');
|
||||
var data = {
|
||||
'action': 'adminUpdateProductAndVariations',
|
||||
'productId': productId
|
||||
};
|
||||
$(this).prop('disabled', true);
|
||||
const _this = this;
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
$(_this).prop('disabled', false);
|
||||
if ('failed' !== response) {
|
||||
const res = JSON.parse(response);
|
||||
if(res.error)
|
||||
{
|
||||
alert(res.message);
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < res.newData.length; i++) {
|
||||
if(res.newData[i].newPrice != null)
|
||||
$("#hesabix-item-price-" + res.newData[i].attributeId).text(res.newData[i].newPrice);
|
||||
if(res.newData[i].newQuantity != null)
|
||||
$("#hesabix-item-quantity-" + res.newData[i].attributeId).text(res.newData[i].newQuantity);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
alert('خطا در هنگام بروزرسانی محصول');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
$(function (){
|
||||
let radio = $('input:radio[name="addFieldsRadio"]');
|
||||
let radioChecked = $('input:radio[name="addFieldsRadio"]:checked');
|
||||
let textInput = $('.contact_text_input');
|
||||
|
||||
if(radioChecked.val() === '2'){
|
||||
textInput.prop( "disabled", false );
|
||||
}else {
|
||||
textInput.prop( "disabled", true );
|
||||
}
|
||||
$(radio).on('click',function (){
|
||||
if($(this).val() === '2'){
|
||||
textInput.prop( "disabled", false );
|
||||
}else {
|
||||
textInput.prop( "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
//=====================================================================================================================
|
||||
function hesabixTutorialJumpTo(time) {
|
||||
let vidEl = document.getElementById('hesabix-tutorial-video');
|
||||
vidEl.play();
|
||||
vidEl.pause();
|
||||
vidEl.currentTime = time;
|
||||
vidEl.play();
|
||||
}
|
344
admin/partials/ssbhesabfa-admin-display.php
Normal file
|
@ -0,0 +1,344 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class Ssbhesabix_Admin_Display
|
||||
* @version 2.0.93
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/admin/display
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Admin_Display
|
||||
{
|
||||
/**
|
||||
* Ssbhesabix_Admin_Display constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
add_action('admin_menu', array(__CLASS__, 'hesabix_add_menu'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook in methods
|
||||
* @since 1.0.0
|
||||
* @access static
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
|
||||
static function hesabix_add_menu()
|
||||
{
|
||||
$iconUrl = plugins_url('/hesabix-accounting/admin/img/menu-icon.png');
|
||||
add_menu_page("حسابیکس", "حسابیکس", "manage_options", "ssbhesabix-option", array(__CLASS__, 'hesabix_plugin_page'), $iconUrl, null);
|
||||
add_submenu_page("ssbhesabix-option", "تنظیمات حسابیکس", "تنظیمات حسابیکس", "manage_options", 'ssbhesabix-option', array(__CLASS__, 'hesabix_plugin_page'));
|
||||
}
|
||||
|
||||
function hesabix_plugin_sync_products_manually()
|
||||
{
|
||||
$page = $_GET["p"];
|
||||
$rpp = $_GET["rpp"];
|
||||
if (isset($_GET['data'])) {
|
||||
$data = $_GET["data"];
|
||||
$codesNotFoundInHesabix = explode(",", $data);
|
||||
}
|
||||
//set default values to page and rpp
|
||||
if (!$page) $page = 1;
|
||||
if (!$rpp) $rpp = 10;
|
||||
|
||||
$result = self::getProductsAndRelations($page, $rpp);
|
||||
$pageCount = ceil($result["totalCount"] / $rpp);
|
||||
$i = ($page - 1) * $rpp;
|
||||
$rpp_options = [10, 15, 20, 30, 50];
|
||||
|
||||
$showTips = true;
|
||||
if (!isset($_COOKIE['syncProductsManuallyHelp'])) {
|
||||
setcookie('syncProductsManuallyHelp', 'ture');
|
||||
} else {
|
||||
$showTips = false;
|
||||
}
|
||||
|
||||
self::hesabix_plugin_header();
|
||||
?>
|
||||
<div class="hesabix-f">
|
||||
<p class="p mt-4">
|
||||
<h5 class="h5 hesabix-tab-page-title">
|
||||
همسان سازی دستی کالاهای فروشگاه با حسابیکس
|
||||
<span class="badge bg-warning text-dark hand <?= $showTips ? 'd-none' : 'd-inline-block' ?>"
|
||||
id="show-tips-btn">مشاهده نکات مهم</span>
|
||||
</h5>
|
||||
|
||||
<div class="alert alert-danger alert-dismissible fade show <?= isset($codesNotFoundInHesabix) ? 'd-block' : 'd-none' ?>"
|
||||
role="alert">
|
||||
<strong>خطا</strong><br> کدهای زیر در حسابیکس پیدا نشد:
|
||||
<br>
|
||||
<?php foreach ($codesNotFoundInHesabix as $code): ?>
|
||||
<span class="badge bg-secondary"><?= $code ?></span>
|
||||
<?php endforeach; ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<div id="tips-alert"
|
||||
class="alert alert-warning alert-dismissible fade show <?= $showTips ? 'd-block' : 'd-none' ?>"
|
||||
role="alert">
|
||||
<strong>توجه!</strong>
|
||||
<ul style="list-style-type:square">
|
||||
<li>تغییرات هر صفحه را ذخیره کنید و سپس به صفحه بعد بروید.</li>
|
||||
<li>کد حسابیکس همان کد 6 رقمی (کد حسابداری کالا) است.</li>
|
||||
<li>از وجود تعریف کالا در حسابیکس اطمینان حاصل کنید.</li>
|
||||
<li>این صفحه برای زمانی است که شما از قبل یک کالا را هم در فروشگاه و هم در حسابیکس
|
||||
تعریف کرده اید اما اتصالی بین آنها وجود ندارد.
|
||||
به کمک این صفحه می توانید این اتصال را بصورت دستی برقرار کنید.
|
||||
</li>
|
||||
<li>
|
||||
برای راحتی کار، این جدول بر اساس نام محصول مرتب سازی شده است،
|
||||
بنابراین در حسابیکس نیز لیست کالاها را بر اساس نام مرتب سازی کرده و از روی آن شروع به وارد کردن
|
||||
کدهای
|
||||
متناظر در این جدول نمایید.
|
||||
</li>
|
||||
</ul>
|
||||
<button type="button" class="btn-close" id="hide-tips-btn"></button>
|
||||
</div>
|
||||
|
||||
</p>
|
||||
<form id="ssbhesabix_sync_products_manually" autocomplete="off"
|
||||
action="<?php echo admin_url('admin.php?page=hesabix-sync-products-manually&p=1'); ?>"
|
||||
method="post">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">نام کالا</th>
|
||||
<th scope="col">شناسه محصول</th>
|
||||
<th scope="col">کد حسابیکس</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($result["data"] as $p):
|
||||
$i++; ?>
|
||||
<tr class="<?= $p->id_hesabix ? 'table-success' : 'table-danger'; ?>">
|
||||
<th scope="row"><?= $i; ?></th>
|
||||
<td><?= $p->ID; ?></td>
|
||||
<td><?= $p->post_title; ?></td>
|
||||
<td><?= $p->sku; ?></td>
|
||||
<td>
|
||||
<input type="text" class="form-control code-input" id="<?= $p->ID; ?>"
|
||||
data-parent-id="<?= $p->post_parent; ?>" value="<?= $p->id_hesabix; ?>"
|
||||
style="width: 100px">
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<label><?= $result["totalCount"] ?> رکورد </label> |
|
||||
<label><?= $pageCount ?> صفحه </label> |
|
||||
<label>صفحه جاری: </label>
|
||||
<input id="pageNumber" class="form-control form-control-sm d-inline" type="text" value="<?= $page ?>"
|
||||
style="width: 80px">
|
||||
<a id="goToPage" class="btn btn-outline-secondary btn-sm" data-rpp="<?= $rpp ?>"
|
||||
href="javascript:void(0)">برو</a>
|
||||
|
||||
<div class="dropdown d-inline">
|
||||
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" type="button"
|
||||
id="dropdownMenuButton1"
|
||||
data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<?= $rpp . ' ' ?>ردیف در هر صفحه
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
|
||||
<?php foreach ($rpp_options as $option): ?>
|
||||
<li><a class="dropdown-item"
|
||||
href="?page=hesabix-sync-products-manually&p=<?= $page ?>&rpp=<?= $option ?>"><?= $option ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="btn btn-outline-secondary btn-sm <?= $page == 1 ? 'disabled' : '' ?>"
|
||||
href="?page=hesabix-sync-products-manually&p=<?= $page - 1 ?>&rpp=<?= $rpp ?>">< صفحه قبل</a>
|
||||
<a class="btn btn-outline-secondary btn-sm <?= $page == $pageCount ? 'disabled' : '' ?>"
|
||||
href="?page=hesabix-sync-products-manually&p=<?= $page + 1 ?>&rpp=<?= $rpp ?>">صفحه بعد ></a>
|
||||
|
||||
<div class="mt-3">
|
||||
<button class="btn btn-success" id="ssbhesabix_sync_products_manually-submit"
|
||||
name="ssbhesabix_sync_products_manually-submit"><?php echo __('Save changes', 'ssbhesabix'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
//========================================================================================================================================
|
||||
function hesabix_plugin_repeated_products()
|
||||
{
|
||||
global $wpdb;
|
||||
$rows = $wpdb->get_results("SELECT id_hesabix FROM " . $wpdb->prefix . "ssbhesabix WHERE obj_type = 'product' GROUP BY id_hesabix HAVING COUNT(id_hesabix) > 1;");
|
||||
$ids = array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
$ids[] = $row->id_hesabix;
|
||||
|
||||
$idsStr = implode(',', $ids);
|
||||
$rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ssbhesabix WHERE obj_type = 'product' AND id_hesabix IN ($idsStr) ORDER BY id_hesabix");
|
||||
$i = 0;
|
||||
|
||||
self::hesabix_plugin_header();
|
||||
?>
|
||||
<div class="hesabix-f mt-4">
|
||||
<h5 class="h5 hesabix-tab-page-title">
|
||||
کد محصولات تکراری
|
||||
</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">کد حسابیکس</th>
|
||||
<th scope="col">شناسه محصول</th>
|
||||
<th scope="col">شناسه متغیر</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($rows as $p):
|
||||
$i++; ?>
|
||||
<tr>
|
||||
<th scope="row"><?= $i; ?></th>
|
||||
<td><?= $p->id_hesabix; ?></td>
|
||||
<td><?= $p->id_ps; ?></td>
|
||||
<td><?= $p->id_ps_attribute; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
//========================================================================================================================================
|
||||
function hesabix_plugin_tools() {
|
||||
self::hesabix_plugin_header();
|
||||
?>
|
||||
<div class="hesabix-f mt-4">
|
||||
<h5 class="h5 hesabix-tab-page-title">
|
||||
ابزارهای افزونه حسابیکس
|
||||
</h5>
|
||||
|
||||
<a href="javascript:void(0);" class="btn btn-danger mt-2" id="hesabix-clear-plugin-data" >حذف دیتای افزونه</a>
|
||||
<br>
|
||||
<a href="javascript:void(0);" class="btn btn-success mt-2" id="hesabix-install-plugin-data">نصب دیتای افزونه</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
//========================================================================================================================================
|
||||
public static function getProductsAndRelations($page, $rpp)
|
||||
{
|
||||
$offset = ($page - 1) * $rpp;
|
||||
|
||||
global $wpdb;
|
||||
$rows = $wpdb->get_results("SELECT post.ID,post.post_title,post.post_parent,post_excerpt,wc.sku FROM `" . $wpdb->prefix . "posts` as post
|
||||
LEFT OUTER JOIN `" . $wpdb->prefix . "wc_product_meta_lookup` as wc
|
||||
ON post.id = wc.product_id
|
||||
WHERE post.post_type IN('product','product_variation') AND post.post_status IN('publish','private')
|
||||
ORDER BY post.post_title ASC LIMIT $offset,$rpp");
|
||||
|
||||
$totalCount = $wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->prefix . "posts` as post
|
||||
LEFT OUTER JOIN `" . $wpdb->prefix . "wc_product_meta_lookup` as wc
|
||||
ON post.id = wc.product_id
|
||||
WHERE post.post_type IN('product','product_variation') AND post.post_status IN('publish','private')");
|
||||
|
||||
$links = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "ssbhesabix`
|
||||
WHERE obj_type ='product'");
|
||||
|
||||
foreach ($rows as $r) {
|
||||
if ($r->post_excerpt)
|
||||
$r->post_title = $r->post_title . ' [' . $r->post_excerpt . ']';
|
||||
}
|
||||
|
||||
foreach ($links as $link) {
|
||||
foreach ($rows as $r) {
|
||||
if ($r->ID == $link->id_ps && $link->id_ps_attribute == 0) {
|
||||
$r->id_hesabix = $link->id_hesabix;
|
||||
} else if ($r->ID == $link->id_ps_attribute) {
|
||||
$r->id_hesabix = $link->id_hesabix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array("data" => $rows, "totalCount" => $totalCount);
|
||||
}
|
||||
//========================================================================================================================================
|
||||
/**
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public static function hesabix_plugin_page()
|
||||
{
|
||||
$iconsArray = ['home', 'cog', 'box-open', 'users', 'file-invoice-dollar', 'money-check-alt', 'file-export', 'sync-alt', 'file-alt', 'cog'];
|
||||
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
|
||||
$setting_tabs = apply_filters('ssbhesabix_setting_tab', array(
|
||||
'home' => __('Home', 'ssbhesabix'),
|
||||
'api' => __('API', 'ssbhesabix'),
|
||||
'catalog' => __('Catalog', 'ssbhesabix'),
|
||||
'customers' => __('Customers', 'ssbhesabix'),
|
||||
'invoice' => __('Invoice', 'ssbhesabix'),
|
||||
'payment' => __('Payment Methods', 'ssbhesabix'),
|
||||
'export' => __('Import and export data', 'ssbhesabix'),
|
||||
'sync' => __('Sync', 'ssbhesabix'),
|
||||
'log' => __('Log', 'ssbhesabix'),
|
||||
'extra' => __('Extra Settings', 'ssbhesabix')
|
||||
));
|
||||
$current_tab = (isset($_GET['tab'])) ? wc_clean($_GET['tab']) : 'home';
|
||||
self::hesabix_plugin_header();
|
||||
?>
|
||||
<h2 class="nav-tab-wrapper mt-2">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($setting_tabs as $name => $label) {
|
||||
$iconUrl = plugins_url("/hesabix-accounting/admin/img/icons/$iconsArray[$i].svg");
|
||||
$i++;
|
||||
echo '<a href="' . admin_url('admin.php?page=ssbhesabix-option&tab=' . $name) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . "<svg width='16' height='16' class='hesabix-tab-icon'><image href='$iconUrl' width='16' height='16' /></svg>" . $label . '</a>';
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
<?php
|
||||
foreach ($setting_tabs as $setting_tabkey => $setting_tabvalue) {
|
||||
switch ($setting_tabkey) {
|
||||
case $current_tab:
|
||||
do_action('ssbhesabix_' . $setting_tabkey . '_setting_save_field');
|
||||
do_action('ssbhesabix_' . $setting_tabkey . '_setting');
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '<div class="wrap">' . __('Hesabix Plugin requires the WooCommerce to work!, Please install/activate woocommerce and try again', 'ssbhesabix') . '</div>';
|
||||
}
|
||||
}
|
||||
//========================================================================================================================================
|
||||
public static function hesabix_plugin_header()
|
||||
{
|
||||
$logoUrl = plugins_url('/hesabix-accounting/admin/img/hesabix-logo.fa.png');
|
||||
?>
|
||||
<div class="hesabix-header">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<img src="<?php echo $logoUrl ?>" alt="حسابیکس">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
<div class="col-auto">
|
||||
<a class="btn btn-sm btn-success" href="https://app.hesabix.com/u/login" target="_blank">ورود به
|
||||
حسابیکس</a>
|
||||
<a class="btn btn-sm btn-warning"
|
||||
href="https://www.hesabix.com/help/topics/%D8%A7%D9%81%D8%B2%D9%88%D9%86%D9%87/%D9%88%D9%88%DA%A9%D8%A7%D9%85%D8%B1%D8%B3"
|
||||
target="_blank">راهنمای افزونه</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
//========================================================================================================================================
|
||||
}
|
||||
|
||||
new Ssbhesabix_Admin_Display();
|
1536
admin/partials/ssbhesabfa-admin-functions.php
Normal file
2128
admin/partials/ssbhesabfa-admin-setting.php
Normal file
371
admin/partials/ssbhesabfa-html-output.php
Normal file
|
@ -0,0 +1,371 @@
|
|||
<?php
|
||||
/*
|
||||
* @class Ssbhesabix_Html_output
|
||||
* @version 2.0.93
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/admin/output
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Html_output {
|
||||
public static function init($options = array()) {
|
||||
if (!empty($options)) {
|
||||
foreach ($options as $value) {
|
||||
if (!isset($value['type'])) continue;
|
||||
if (!isset($value['id'])) $value['id'] = '';
|
||||
if (!isset($value['title'])) $value['title'] = isset($value['name']) ? $value['name'] : '';
|
||||
if (!isset($value['class'])) $value['class'] = '';
|
||||
if (!isset($value['css'])) $value['css'] = '';
|
||||
if (!isset($value['default'])) $value['default'] = '';
|
||||
if (!isset($value['desc'])) $value['desc'] = '';
|
||||
if (!isset($value['desc_tip'])) $value['desc_tip'] = false;
|
||||
$custom_attributes = array();
|
||||
if (!empty($value['custom_attributes']) && is_array($value['custom_attributes'])) {
|
||||
foreach ($value['custom_attributes'] as $attribute => $attribute_value) {
|
||||
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
|
||||
}
|
||||
}
|
||||
if (true === $value['desc_tip']) {
|
||||
$description = '';
|
||||
$tip = $value['desc'];
|
||||
} elseif (!empty($value['desc_tip'])) {
|
||||
$description = $value['desc'];
|
||||
$tip = $value['desc_tip'];
|
||||
} elseif (!empty($value['desc'])) {
|
||||
$description = $value['desc'];
|
||||
$tip = '';
|
||||
} else {
|
||||
$description = $tip = '';
|
||||
}
|
||||
if ($description && in_array($value['type'], array('textarea', 'radio'))) {
|
||||
$description = '<p style="margin-top:0" class="hesabix-p">' . wp_kses_post($description) . '</p>';
|
||||
} elseif ($description && in_array($value['type'], array('checkbox'))) {
|
||||
$description = wp_kses_post($description);
|
||||
} elseif ($description) {
|
||||
$description = '<span class="description">' . wp_kses_post($description) . '</span>';
|
||||
}
|
||||
if (isset($value['placeholder']) && !empty($value['placeholder'])) {
|
||||
$placeholder = $value['placeholder'];
|
||||
} else {
|
||||
$placeholder = '';
|
||||
}
|
||||
if ($tip && in_array($value['type'], array('checkbox'))) {
|
||||
|
||||
$tip = '<p class="description hesabix-p">' . $tip . '</p>';
|
||||
}
|
||||
switch ($value['type']) {
|
||||
case 'title':
|
||||
if (!empty($value['title'])) {
|
||||
echo '<h3 class="hesabix-tab-page-title">' . esc_html($value['title']) . '</h3>';
|
||||
}
|
||||
if (!empty($value['desc'])) {
|
||||
echo wpautop(wptexturize(wp_kses_post($value['desc'])));
|
||||
}
|
||||
echo '<table class="form-table hesabix-p">' . "\n\n";
|
||||
break;
|
||||
case 'sectionend':
|
||||
echo '</table>';
|
||||
break;
|
||||
case 'text':
|
||||
case 'email':
|
||||
case 'number':
|
||||
case 'color' :
|
||||
case 'password' :
|
||||
$type = $value['type'];
|
||||
$class = '';
|
||||
$option_value = self::get_option($value['id'], $value['default']);
|
||||
if ($value['type'] == 'color') {
|
||||
$type = 'text';
|
||||
$value['class'] .= 'colorpick';
|
||||
$description .= '<div id="colorPickerDiv_' . esc_attr($value['id']) . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
|
||||
}
|
||||
?><tr style="vertical-align: top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label>
|
||||
<?php echo $tip; ?>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo sanitize_title($value['type']) ?>">
|
||||
<input
|
||||
name="<?php echo esc_attr($value['id']); ?>"
|
||||
id="<?php echo esc_attr($value['id']); ?>"
|
||||
type="<?php echo esc_attr($type); ?>"
|
||||
style="<?php echo esc_attr($value['css']); ?>"
|
||||
value="<?php echo esc_attr($option_value); ?>"
|
||||
class="<?php echo esc_attr($value['class']); ?>"
|
||||
placeholder="<?php echo esc_attr($placeholder); ?>"
|
||||
<?php echo implode(' ', $custom_attributes); ?>
|
||||
/> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'textarea':
|
||||
$option_value = self::get_option($value['id'], $value['default']);
|
||||
?><tr style="vertical-align: top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label>
|
||||
<?php echo $tip; ?>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo sanitize_title($value['type']) ?>">
|
||||
<?php echo $description; ?>
|
||||
<?php
|
||||
if (isset($value['editor']) && $value['editor'] == 'true') {
|
||||
|
||||
echo wp_editor($option_value, $value['id']);
|
||||
} else {
|
||||
?>
|
||||
<textarea
|
||||
name="<?php echo esc_attr($value['id']); ?>"
|
||||
id="<?php echo esc_attr($value['id']); ?>"
|
||||
style="<?php echo esc_attr($value['css']); ?>"
|
||||
class="<?php echo esc_attr($value['class']); ?>"
|
||||
<?php echo implode(' ', $custom_attributes); ?>
|
||||
><?php echo esc_textarea($option_value); ?></textarea>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'select' :
|
||||
case 'multiselect' :
|
||||
$option_value = self::get_option($value['id'], $value['default']);
|
||||
?><tr style="vertical-align: top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label>
|
||||
<?php echo $tip; ?>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo sanitize_title($value['type']) ?>">
|
||||
<select
|
||||
name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') echo '[]'; ?>"
|
||||
id="<?php echo esc_attr($value['id']); ?>"
|
||||
style="<?php echo esc_attr($value['css']); ?>"
|
||||
class="<?php echo esc_attr($value['class']); ?>"
|
||||
<?php echo implode(' ', $custom_attributes); ?>
|
||||
<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
|
||||
>
|
||||
<?php
|
||||
foreach ($value['options'] as $key => $val) {
|
||||
?>
|
||||
<option value="<?php echo esc_attr($key); ?>" <?php
|
||||
if (is_array($option_value)) {
|
||||
selected(in_array($key, $option_value), true);
|
||||
} else {
|
||||
selected($option_value, $key);
|
||||
}
|
||||
?>><?php echo $val ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'radio' :
|
||||
$option_value = self::get_option($value['id'], $value['default']);
|
||||
?><tr style="vertical-align: top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label>
|
||||
<?php echo $tip; ?>
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo sanitize_title($value['type']) ?>">
|
||||
<fieldset>
|
||||
<?php echo $description; ?>
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($value['options'] as $key => $val) {
|
||||
?>
|
||||
<li>
|
||||
<label><input
|
||||
name="<?php echo esc_attr($value['id']); ?>"
|
||||
value="<?php echo $key; ?>"
|
||||
type="radio"
|
||||
style="<?php echo esc_attr($value['css']); ?>"
|
||||
class="<?php echo esc_attr($value['class']); ?>"
|
||||
<?php echo implode(' ', $custom_attributes); ?>
|
||||
<?php checked($key, $option_value); ?>
|
||||
/> <?php echo $val ?></label>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'checkbox' :
|
||||
$option_value = self::get_option($value['id'], $value['default']);
|
||||
$visbility_class = array();
|
||||
if (!isset($value['hide_if_checked'])) {
|
||||
$value['hide_if_checked'] = false;
|
||||
}
|
||||
if (!isset($value['show_if_checked'])) {
|
||||
$value['show_if_checked'] = false;
|
||||
}
|
||||
if ('yes' == $value['hide_if_checked'] || 'yes' == $value['show_if_checked']) {
|
||||
$visbility_class[] = 'hidden_option';
|
||||
}
|
||||
if ('option' == $value['hide_if_checked']) {
|
||||
$visbility_class[] = 'hide_options_if_checked';
|
||||
}
|
||||
if ('option' == $value['show_if_checked']) {
|
||||
$visbility_class[] = 'show_options_if_checked';
|
||||
}
|
||||
if (!isset($value['checkboxgroup']) || 'start' == $value['checkboxgroup']) {
|
||||
?>
|
||||
<tr style="vertical-align: top" class="<?php echo esc_attr(implode(' ', $visbility_class)); ?>">
|
||||
<th scope="row" class="titledesc"><?php echo esc_html($value['title']) ?></th>
|
||||
<td class="forminp forminp-checkbox">
|
||||
<fieldset>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<fieldset class="<?php echo esc_attr(implode(' ', $visbility_class)); ?>">
|
||||
<?php
|
||||
}
|
||||
if (!empty($value['title'])) {
|
||||
?>
|
||||
<legend class="screen-reader-text"><span><?php echo esc_html($value['title']) ?></span></legend>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<label for="<?php echo $value['id'] ?>">
|
||||
<input
|
||||
name="<?php echo esc_attr($value['id']); ?>"
|
||||
id="<?php echo esc_attr($value['id']); ?>"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
<?php checked($option_value, 'yes'); ?>
|
||||
<?php echo implode(' ', $custom_attributes); ?>
|
||||
/> <?php echo $description ?>
|
||||
</label> <?php echo $tip; ?>
|
||||
<?php
|
||||
if (!isset($value['checkboxgroup']) || 'end' == $value['checkboxgroup']) {
|
||||
?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
case 'single_select_page' :
|
||||
$args = array(
|
||||
'name' => $value['id'],
|
||||
'id' => $value['id'],
|
||||
'sort_column' => 'menu_order',
|
||||
'sort_order' => 'ASC',
|
||||
'show_option_none' => ' ',
|
||||
'class' => $value['class'],
|
||||
'echo' => false,
|
||||
'selected' => absint(self::get_option($value['id']))
|
||||
);
|
||||
if (isset($value['args'])) {
|
||||
$args = wp_parse_args($value['args'], $args);
|
||||
}
|
||||
?><tr style="vertical-align: top" class="single_select_page">
|
||||
<th scope="row" class="titledesc"><?php echo esc_html($value['title']) ?> <?php echo $tip; ?></th>
|
||||
<td class="forminp">
|
||||
<?php echo str_replace(' id=', " data-placeholder='" . __('Select a page…', 'Option') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' id=", wp_dropdown_pages($args)); ?> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=====================================================================================================
|
||||
public static function get_option($option_name, $default = '') {
|
||||
|
||||
if (strstr($option_name, '[')) {
|
||||
parse_str($option_name, $option_array);
|
||||
$option_name = current(array_keys($option_array));
|
||||
$option_values = get_option($option_name, '');
|
||||
$key = key($option_array[$option_name]);
|
||||
if (isset($option_values[$key])) {
|
||||
$option_value = $option_values[$key];
|
||||
} else {
|
||||
$option_value = null;
|
||||
}
|
||||
} else {
|
||||
$option_value = get_option($option_name, null);
|
||||
}
|
||||
if (is_array($option_value)) {
|
||||
$option_value = array_map('stripslashes', $option_value);
|
||||
} elseif (!is_null($option_value)) {
|
||||
$option_value = stripslashes($option_value);
|
||||
if (empty($option_value) && !empty($default)) {
|
||||
$option_value = null;
|
||||
}
|
||||
}
|
||||
return $option_value === null ? $default : $option_value;
|
||||
}
|
||||
//=====================================================================================================
|
||||
public static function save_fields($options) {
|
||||
if (empty($_POST)) return false;
|
||||
|
||||
$update_options = array();
|
||||
foreach ($options as $value) {
|
||||
if (!isset($value['id']) || !isset($value['type'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strstr($value['id'], '[')) {
|
||||
parse_str($value['id'], $option_name_array);
|
||||
$option_name = current(array_keys($option_name_array));
|
||||
$setting_name = key($option_name_array[$option_name]);
|
||||
$option_value = isset($_POST[$option_name][$setting_name]) ? wc_clean($_POST[$option_name][$setting_name]) : null;
|
||||
} else {
|
||||
$option_name = $value['id'];
|
||||
$setting_name = '';
|
||||
$option_value = isset($_POST[$value['id']]) ? wc_clean($_POST[$value['id']]) : null;
|
||||
}
|
||||
switch (sanitize_title($value['type'])) {
|
||||
case 'checkbox' :
|
||||
$option_value = is_null($option_value) ? 'no' : 'yes';
|
||||
break;
|
||||
case 'textarea' :
|
||||
$option_value = wp_kses_post(trim($option_value));
|
||||
break;
|
||||
case 'text' :
|
||||
case 'email':
|
||||
case 'number':
|
||||
case 'select' :
|
||||
case 'color' :
|
||||
case 'password' :
|
||||
case 'radio' :
|
||||
$option_value = $option_value;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
if (!is_null($option_value)) {
|
||||
if ($option_name && $setting_name) {
|
||||
if (!isset($update_options[$option_name])) {
|
||||
$update_options[$option_name] = get_option($option_name, array());
|
||||
}
|
||||
if (!is_array($update_options[$option_name])) {
|
||||
$update_options[$option_name] = array();
|
||||
}
|
||||
$update_options[$option_name][$setting_name] = $option_value;
|
||||
} else {
|
||||
$update_options[$option_name] = $option_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($update_options as $name => $value) {
|
||||
update_option($name, wc_clean($value));
|
||||
}
|
||||
echo '<div class="updated"><p class="hesabix-p">' . __( 'Settings were saved successfully.', 'ssbhesabix' ) . '</p></div>';
|
||||
return true;
|
||||
}
|
||||
//=====================================================================================================
|
||||
}
|
||||
|
||||
Ssbhesabix_Html_output::init();
|
64
admin/services/HesabfaLogService.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
class HesabixLogService
|
||||
{
|
||||
public static function writeLogStr($str)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
|
||||
$dateTime = new DateTimeImmutable( 'now', wp_timezone() );
|
||||
$date = $dateTime->format('[Y-m-d H:i:s] ');
|
||||
$str = $date . $str;
|
||||
|
||||
$str = mb_convert_encoding($str, 'UTF-8');
|
||||
file_put_contents($fileName, PHP_EOL . $str, FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function writeLogObj($obj)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
ob_start();
|
||||
var_dump($obj);
|
||||
file_put_contents($fileName, PHP_EOL . ob_get_flush(), FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function log($params)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
$log = '';
|
||||
|
||||
$dateTime = new DateTimeImmutable( 'now', wp_timezone() );
|
||||
$date = $dateTime->format('[Y-m-d H:i:s] ');
|
||||
|
||||
foreach ($params as $message) {
|
||||
if (is_array($message) || is_object($message)) {
|
||||
$log .= $date . print_r($message, true) . "\n";
|
||||
} elseif (is_bool($message)) {
|
||||
$log .= $date . ($message ? 'true' : 'false') . "\n";
|
||||
} else {
|
||||
$log .= $date . $message . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$log = mb_convert_encoding($log, 'UTF-8');
|
||||
file_put_contents($fileName, PHP_EOL . $log, FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function readLog($URL)
|
||||
{
|
||||
return file_exists($URL) ? file_get_contents($URL) : '';
|
||||
}
|
||||
|
||||
public static function clearLog()
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
if (file_exists($fileName)) {
|
||||
file_put_contents($fileName, "");
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLogFilePath()
|
||||
{
|
||||
return WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
}
|
||||
}
|
64
admin/services/HesabixLogService.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
class HesabixLogService
|
||||
{
|
||||
public static function writeLogStr($str)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
|
||||
$dateTime = new DateTimeImmutable( 'now', wp_timezone() );
|
||||
$date = $dateTime->format('[Y-m-d H:i:s] ');
|
||||
$str = $date . $str;
|
||||
|
||||
$str = mb_convert_encoding($str, 'UTF-8');
|
||||
file_put_contents($fileName, PHP_EOL . $str, FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function writeLogObj($obj)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
ob_start();
|
||||
var_dump($obj);
|
||||
file_put_contents($fileName, PHP_EOL . ob_get_flush(), FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function log($params)
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
$log = '';
|
||||
|
||||
$dateTime = new DateTimeImmutable( 'now', wp_timezone() );
|
||||
$date = $dateTime->format('[Y-m-d H:i:s] ');
|
||||
|
||||
foreach ($params as $message) {
|
||||
if (is_array($message) || is_object($message)) {
|
||||
$log .= $date . print_r($message, true) . "\n";
|
||||
} elseif (is_bool($message)) {
|
||||
$log .= $date . ($message ? 'true' : 'false') . "\n";
|
||||
} else {
|
||||
$log .= $date . $message . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$log = mb_convert_encoding($log, 'UTF-8');
|
||||
file_put_contents($fileName, PHP_EOL . $log, FILE_APPEND);
|
||||
}
|
||||
|
||||
public static function readLog($URL)
|
||||
{
|
||||
return file_exists($URL) ? file_get_contents($URL) : '';
|
||||
}
|
||||
|
||||
public static function clearLog()
|
||||
{
|
||||
$fileName = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
if (file_exists($fileName)) {
|
||||
file_put_contents($fileName, "");
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLogFilePath()
|
||||
{
|
||||
return WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt';
|
||||
}
|
||||
}
|
250
admin/services/HesabixWpFaService.php
Normal file
|
@ -0,0 +1,250 @@
|
|||
<?php
|
||||
|
||||
include_once('HesabixLogService.php');
|
||||
|
||||
class WpFa
|
||||
{
|
||||
public $id;
|
||||
public $objType;
|
||||
public $idHesabix;
|
||||
public $idWp;
|
||||
public $idWpAttribute;
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
public static function newWpFa($id, $type, $idHesabix, $idWp, $idWpAttribute): WpFa
|
||||
{
|
||||
$instance = new self();
|
||||
$instance->id = $id;
|
||||
$instance->objType = $type;
|
||||
$instance->idHesabix = $idHesabix;
|
||||
$instance->idWp = $idWp;
|
||||
$instance->idWpAttribute = $idWpAttribute;
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
class HesabixWpFaService
|
||||
{
|
||||
public function __construct() {}
|
||||
|
||||
public function getWpFa($objType, $idWp, $idWpAttribute = 0)
|
||||
{
|
||||
if (!isset($objType) || !isset($idWp)) return false;
|
||||
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "ssbhesabix WHERE `id_ps` = $idWp AND `id_ps_attribute` = $idWpAttribute AND `obj_type` = '$objType'");
|
||||
|
||||
if (isset($row)) return $this->mapWpFa($row);
|
||||
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getWpFaByHesabixId($objType, $hesabixId)
|
||||
{
|
||||
if (!isset($objType) || !isset($hesabixId)) return false;
|
||||
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "ssbhesabix WHERE `id_hesabix` = $hesabixId AND `obj_type` = '$objType'");
|
||||
|
||||
if (isset($row))
|
||||
return $this->mapWpFa($row);
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getWpFaId($objType, $idWp, $idWpAttribute = 0)
|
||||
{
|
||||
if (!isset($objType) || !isset($idWp))
|
||||
return false;
|
||||
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT `id` FROM " . $wpdb->prefix . "ssbhesabix WHERE `id_ps` = $idWp AND `id_ps_attribute` = $idWpAttribute AND `obj_type` = '$objType'");
|
||||
|
||||
if (is_object($row))
|
||||
return (int)$row->id;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getWpFaIdByHesabixId($objType, $hesabixId)
|
||||
{
|
||||
if (!isset($objType) || !isset($hesabixId))
|
||||
return false;
|
||||
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT `id` FROM " . $wpdb->prefix . "ssbhesabix WHERE `id_hesabix` = $hesabixId AND `obj_type` = '$objType'");
|
||||
|
||||
if (isset($row))
|
||||
return (int)$row->id;
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getProductCodeByWpId($id_product, $id_attribute = 0)
|
||||
{
|
||||
$obj = $this->getWpFa('product', $id_product, $id_attribute);
|
||||
|
||||
if ($obj != null) return $obj->idHesabix;
|
||||
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getCustomerCodeByWpId($id_customer)
|
||||
{
|
||||
$obj = $this->getWpFa('customer', $id_customer);
|
||||
|
||||
if ($obj != null) return $obj->idHesabix;
|
||||
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getInvoiceCodeByWpId($id_order)
|
||||
{
|
||||
$obj = $this->getWpFa('order', $id_order);
|
||||
|
||||
if ($obj != null) return $obj->idHesabix;
|
||||
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function getProductAndCombinations($idWp)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT * FROM `" . $wpdb->prefix . "ssbhesabix` WHERE `obj_type` = 'product' AND `id_ps` = '$idWp'";
|
||||
$result = $wpdb->get_results($sql);
|
||||
|
||||
$wpFaObjects = array();
|
||||
if (isset($result) && is_array($result) && count($result) > 0) {
|
||||
foreach ($result as $item)
|
||||
$wpFaObjects[] = $this->mapWpFa($item);
|
||||
return $wpFaObjects;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function mapWpFa($sqlObj): WpFa
|
||||
{
|
||||
$wpFa = new WpFa();
|
||||
|
||||
$wpFa->id = $sqlObj->id;
|
||||
$wpFa->idHesabix = $sqlObj->id_hesabix;
|
||||
$wpFa->idWp = $sqlObj->id_ps;
|
||||
$wpFa->idWpAttribute = $sqlObj->id_ps_attribute;
|
||||
$wpFa->objType = $sqlObj->obj_type;
|
||||
|
||||
return $wpFa;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function saveProduct($item): bool
|
||||
{
|
||||
$json = json_decode($item->Tag);
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
$wpFa = $wpFaService->getWpFaByHesabixId('product', $item->Code);
|
||||
|
||||
if (!$wpFa) {
|
||||
$wpFa = WpFa::newWpFa(0, 'product', (int)$item->Code, (int)$json->id_product, (int)$json->id_attribute);
|
||||
$wpFaService->save($wpFa);
|
||||
HesabixLogService::log(array("Item successfully added. Item code: " . (string)$item->Code . ". Product ID: $json->id_product-$json->id_attribute"));
|
||||
} else {
|
||||
$wpFa->idHesabix = (int)$item->Code;
|
||||
$wpFaService->update($wpFa);
|
||||
HesabixLogService::log(array("Item successfully updated. Item code: " . (string)$item->Code . ". Product ID: $json->id_product-$json->id_attribute"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function saveCustomer($customer): bool
|
||||
{
|
||||
$json = json_decode($customer->Tag);
|
||||
if ((int)$json->id_customer == 0) return true;
|
||||
|
||||
$id = $this->getWpFaId('customer', (int)$json->id_customer);
|
||||
global $wpdb;
|
||||
|
||||
if (!$id) {
|
||||
$wpdb->insert($wpdb->prefix . 'ssbhesabix', array(
|
||||
'id_hesabix' => (int)$customer->Code,
|
||||
'obj_type' => 'customer',
|
||||
'id_ps' => (int)$json->id_customer
|
||||
));
|
||||
HesabixLogService::writeLogStr("Customer successfully added. Customer code: " . (string)$customer->Code . ". Customer ID: $json->id_customer");
|
||||
} else {
|
||||
$wpdb->update($wpdb->prefix . 'ssbhesabix', array(
|
||||
'id_hesabix' => (int)$customer->Code,
|
||||
'obj_type' => 'customer',
|
||||
'id_ps' => (int)$json->id_customer,
|
||||
), array('id' => $id));
|
||||
HesabixLogService::writeLogStr("Customer successfully updated. Customer code: " . (string)$customer->Code . ". Customer ID: $json->id_customer");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function saveInvoice($invoice, $orderType)
|
||||
{
|
||||
$json = json_decode($invoice->Tag);
|
||||
$id = $this->getPsFaId('order', (int)$json->id_order);
|
||||
|
||||
$invoiceNumber = (int)$invoice->Number;
|
||||
$objType = $orderType == 0 ? 'order' : 'returnOrder';
|
||||
|
||||
if (!$id) {
|
||||
Db::getInstance()->insert('ps_hesabix', array(
|
||||
'id_hesabix' => $invoiceNumber,
|
||||
'obj_type' => $objType,
|
||||
'id_ps' => (int)$json->id_order,
|
||||
));
|
||||
if ($objType == 'order')
|
||||
LogService::writeLogStr("Invoice successfully added. invoice number: " . (string)$invoice->Number . ", order id: " . $json->id_order);
|
||||
else
|
||||
LogService::writeLogStr("Return Invoice successfully added. Customer code: " . (string)$invoice->Number . ", order id: " . $json->id_order);
|
||||
} else {
|
||||
Db::getInstance()->update('ps_hesabix', array(
|
||||
'id_hesabix' => $invoiceNumber,
|
||||
'obj_type' => $objType,
|
||||
'id_ps' => (int)$json->id_order,
|
||||
), array('id' => $id), 0, true, true);
|
||||
//check if it is order or return order
|
||||
if ($objType == 'order')
|
||||
LogService::writeLogStr("Invoice successfully updated. invoice number: " . (string)$invoice->Number . ", order id: " . $json->id_order);
|
||||
else
|
||||
LogService::writeLogStr("Return Invoice successfully updated. Customer code: " . (string)$invoice->Number . ", order id: " . $json->id_order);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function save(WpFa $wpFa)
|
||||
{
|
||||
global $wpdb;
|
||||
$wpdb->insert($wpdb->prefix . 'ssbhesabix', array(
|
||||
'id_hesabix' => $wpFa->idHesabix,
|
||||
'obj_type' => $wpFa->objType,
|
||||
'id_ps' => (int)$wpFa->idWp,
|
||||
'id_ps_attribute' => (int)$wpFa->idWpAttribute,
|
||||
));
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function update(WpFa $wpFa)
|
||||
{
|
||||
global $wpdb;
|
||||
$wpdb->update($wpdb->prefix . 'ssbhesabix', array(
|
||||
'id_hesabix' => $wpFa->idHesabix,
|
||||
'obj_type' => $wpFa->objType,
|
||||
'id_ps' => (int)$wpFa->idWp,
|
||||
'id_ps_attribute' => (int)$wpFa->idWpAttribute,
|
||||
), array('id' => $wpFa->id));
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function delete(WpFa $wpFa)
|
||||
{
|
||||
global $wpdb;
|
||||
$wpdb->delete($wpdb->prefix . 'ssbhesabix', array('id' => $wpFa->id));
|
||||
}
|
||||
//=========================================================================================================
|
||||
public function deleteAll($productId)
|
||||
{
|
||||
global $wpdb;
|
||||
$wpdb->delete($wpdb->prefix . 'ssbhesabix', array('id_ps' => $productId));
|
||||
}
|
||||
//=========================================================================================================
|
||||
}
|
228
admin/services/ssbhesabixCustomerService.php
Normal file
|
@ -0,0 +1,228 @@
|
|||
<?php
|
||||
|
||||
class ssbhesabixCustomerService
|
||||
{
|
||||
public static $countries;
|
||||
public static $states;
|
||||
|
||||
public static function mapCustomer($code, $id_customer, $type = 'first',$id_order = ''): array
|
||||
{
|
||||
self::getCountriesAndStates();
|
||||
|
||||
$customer = new WC_Customer($id_customer);
|
||||
$order = new WC_Order($id_order);
|
||||
$firstName = $customer->get_first_name() ? $customer->get_first_name() : $customer->get_billing_first_name();
|
||||
$lastName = $customer->get_last_name() ? $customer->get_last_name() : $customer->get_billing_last_name();
|
||||
$name = $firstName . ' ' . $lastName;
|
||||
$nodeFamily = get_option('ssbhesabix_contact_automatic_save_node_family') == 'yes'? 'اشخاص :' . get_option('ssbhesabix_contact_node_family') : null;
|
||||
|
||||
//checkout fields
|
||||
$checkout_fields = ssbhesabixCustomerService::getAdditionalCheckoutFileds($id_order);
|
||||
$NationalCode = $checkout_fields['NationalCode'];
|
||||
$EconomicCode = $checkout_fields['EconomicCode'];
|
||||
$RegistrationNumber = $checkout_fields['RegistrationNumber'];
|
||||
$Website = $checkout_fields['Website'];
|
||||
|
||||
if($NationalCode === false) $NationalCode = '';
|
||||
if($EconomicCode === false) $EconomicCode = '';
|
||||
if($RegistrationNumber === false) $RegistrationNumber = '';
|
||||
if($Website === false) $Website = '';
|
||||
|
||||
if (empty($name) || $name === ' ') $name = __('Not Defined', 'ssbhesabix');
|
||||
|
||||
$hesabixCustomer = array();
|
||||
|
||||
switch ($type) {
|
||||
case 'first':
|
||||
//
|
||||
case 'billing':
|
||||
$country_name = self::$countries[$order->get_billing_country()];
|
||||
$state_name = self::$states[$order->get_billing_country()][$order->get_billing_state()];
|
||||
$fullAddress = $order->get_billing_address_1() . '-' . $order->get_billing_address_2();
|
||||
|
||||
$hesabixCustomer = array(
|
||||
'Code' => $code,
|
||||
'Name' => $name,
|
||||
'FirstName' => Ssbhesabix_Validation::contactFirstNameValidation($firstName),
|
||||
'LastName' => Ssbhesabix_Validation::contactLastNameValidation($lastName),
|
||||
'ContactType' => 1,
|
||||
'NodeFamily' => $nodeFamily,
|
||||
'NationalCode' => $NationalCode,
|
||||
'EconomicCode' => $EconomicCode,
|
||||
'RegistrationNumber' => $RegistrationNumber,
|
||||
'Website' => $Website,
|
||||
'Address' => Ssbhesabix_Validation::contactAddressValidation($fullAddress),
|
||||
'City' => Ssbhesabix_Validation::contactCityValidation($customer->get_billing_city()),
|
||||
'State' => Ssbhesabix_Validation::contactStateValidation($state_name),
|
||||
'Country' => Ssbhesabix_Validation::contactCountryValidation($country_name),
|
||||
'PostalCode' => Ssbhesabix_Validation::contactPostalCodeValidation($customer->get_billing_postcode()),
|
||||
'Phone' => Ssbhesabix_Validation::contactPhoneValidation($customer->get_billing_phone()),
|
||||
'Email' => Ssbhesabix_Validation::contactEmailValidation($customer->get_email()),
|
||||
'Tag' => json_encode(array('id_customer' => $id_customer)),
|
||||
'Note' => __('Customer ID in OnlineStore: ', 'ssbhesabix') . $id_customer,
|
||||
);
|
||||
break;
|
||||
case 'shipping':
|
||||
$country_name = self::$countries[$order->get_shipping_country()];
|
||||
$state_name = self::$states[$order->get_shipping_country()][$order->get_shipping_state()];
|
||||
$fullAddress = $order->get_shipping_address_1() . ' - ' . $order->get_shipping_address_2();
|
||||
|
||||
$hesabixCustomer = array(
|
||||
'Code' => $code,
|
||||
'Name' => $name,
|
||||
'FirstName' => Ssbhesabix_Validation::contactFirstNameValidation($firstName),
|
||||
'LastName' => Ssbhesabix_Validation::contactLastNameValidation($lastName),
|
||||
'ContactType' => 1,
|
||||
'NodeFamily' => $nodeFamily,
|
||||
'NationalCode' => $NationalCode,
|
||||
'EconomicCode' => $EconomicCode,
|
||||
'RegistrationNumber' => $RegistrationNumber,
|
||||
'Website' => $Website,
|
||||
'Address' => Ssbhesabix_Validation::contactAddressValidation($fullAddress),
|
||||
'City' => Ssbhesabix_Validation::contactCityValidation($customer->get_shipping_city()),
|
||||
'State' => Ssbhesabix_Validation::contactStateValidation($state_name),
|
||||
'Country' => Ssbhesabix_Validation::contactCountryValidation($country_name),
|
||||
'PostalCode' => Ssbhesabix_Validation::contactPostalCodeValidation($customer->get_shipping_postcode()),
|
||||
'Phone' => Ssbhesabix_Validation::contactPhoneValidation($customer->get_billing_phone()),
|
||||
'Email' => Ssbhesabix_Validation::contactEmailValidation($customer->get_email()),
|
||||
'Tag' => json_encode(array('id_customer' => $id_customer)),
|
||||
'Note' => __('Customer ID in OnlineStore: ', 'ssbhesabix') . $id_customer,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return self::correctCustomerData($hesabixCustomer);
|
||||
}
|
||||
//===========================================================================================================
|
||||
public static function mapGuestCustomer($code, $id_order): array
|
||||
{
|
||||
$order = new WC_Order($id_order);
|
||||
|
||||
$name = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
|
||||
if (empty($order->get_billing_first_name()) && empty($order->get_billing_last_name())) {
|
||||
$name = __('Guest Customer', 'ssbhesabix');
|
||||
}
|
||||
$nodeFamily = get_option('ssbhesabix_contact_automatic_save_node_family') == 'yes'? 'اشخاص :' . get_option('ssbhesabix_contact_node_family') :null;
|
||||
|
||||
//checkout fields
|
||||
$checkout_fields = ssbhesabixCustomerService::getAdditionalCheckoutFileds($id_order);
|
||||
$NationalCode = $checkout_fields['NationalCode'];
|
||||
$EconomicCode = $checkout_fields['EconomicCode'];
|
||||
$RegistrationNumber = $checkout_fields['RegistrationNumber'];
|
||||
$Website = $checkout_fields['Website'];
|
||||
|
||||
// $country_name = self::$countries[$order->get_billing_country()];
|
||||
// $state_name = self::$states[$order->get_billing_state()];
|
||||
|
||||
|
||||
WC()->countries->countries[ $order->shipping_country ];
|
||||
$country_name = WC()->countries->countries[ $order->get_billing_country() ];
|
||||
$states = WC()->countries->get_states( $order->get_billing_country() );
|
||||
$state_name = $states[ $order->get_billing_state() ];
|
||||
if(!$state_name) $state_name = WC()->countries->states[$order->billing_country][$order->billing_state];
|
||||
if(!$state_name) $state_name = $order->get_billing_state();
|
||||
|
||||
$fullAddress = $order->get_billing_address_1() . '-' . $order->get_billing_address_2();
|
||||
|
||||
$hesabixCustomer = array(
|
||||
'Code' => $code,
|
||||
'Name' => $name,
|
||||
'FirstName' => Ssbhesabix_Validation::contactFirstNameValidation($order->get_billing_first_name()),
|
||||
'LastName' => Ssbhesabix_Validation::contactLastNameValidation($order->get_billing_last_name()),
|
||||
'ContactType' => 1,
|
||||
'NationalCode' => $NationalCode,
|
||||
'EconomicCode' => $EconomicCode,
|
||||
'RegistrationNumber' => $RegistrationNumber,
|
||||
'Website' => $Website,
|
||||
'NodeFamily' => $nodeFamily,
|
||||
'Address' => Ssbhesabix_Validation::contactAddressValidation($fullAddress),
|
||||
'City' => Ssbhesabix_Validation::contactCityValidation($order->get_billing_city()),
|
||||
'State' => Ssbhesabix_Validation::contactStateValidation($state_name),
|
||||
'Country' => Ssbhesabix_Validation::contactCountryValidation($country_name),
|
||||
'PostalCode' => Ssbhesabix_Validation::contactPostalCodeValidation($order->get_billing_postcode()),
|
||||
'Phone' => Ssbhesabix_Validation::contactPhoneValidation($order->get_billing_phone()),
|
||||
'Email' => Ssbhesabix_Validation::contactEmailValidation($order->get_billing_email()),
|
||||
'Tag' => json_encode(array('id_customer' => 0)),
|
||||
'Note' => __('Customer registered as a GuestCustomer.', 'ssbhesabix'),
|
||||
);
|
||||
|
||||
return self::correctCustomerData($hesabixCustomer);
|
||||
}
|
||||
//===========================================================================================================
|
||||
private static function getMobileFromPhone($phone) {
|
||||
if(preg_match("/^09\d{9}$/", $phone))
|
||||
return $phone;
|
||||
else if(preg_match("/^9\d{9}$/", $phone))
|
||||
return '0' . $phone;
|
||||
else if(preg_match("/^989\d{9}$/", $phone))
|
||||
return str_replace('98', '0' ,$phone);
|
||||
else return '';
|
||||
}
|
||||
//===========================================================================================================
|
||||
private static function correctCustomerData($hesabixCustomer) {
|
||||
if($hesabixCustomer["Phone"] == '')
|
||||
unset($hesabixCustomer["Phone"]);
|
||||
else {
|
||||
$mobile = self::getMobileFromPhone($hesabixCustomer["Phone"]);
|
||||
|
||||
if($mobile) $hesabixCustomer["Mobile"] = $mobile;
|
||||
}
|
||||
|
||||
if($hesabixCustomer["Email"] == '') unset($hesabixCustomer["Email"]);
|
||||
if($hesabixCustomer["Address"] == '') unset($hesabixCustomer["Address"]);
|
||||
if($hesabixCustomer["PostalCode"] == '') unset($hesabixCustomer["PostalCode"]);
|
||||
if($hesabixCustomer["City"] == '') unset($hesabixCustomer["City"]);
|
||||
if($hesabixCustomer["State"] == '') unset($hesabixCustomer["State"]);
|
||||
if($hesabixCustomer["Country"] == '') unset($hesabixCustomer["Country"]);
|
||||
|
||||
return $hesabixCustomer;
|
||||
}
|
||||
//===========================================================================================================
|
||||
private static function getCountriesAndStates()
|
||||
{
|
||||
if (!isset(self::$countries)) {
|
||||
$countries_obj = new WC_Countries();
|
||||
self::$countries = $countries_obj->get_countries();
|
||||
self::$states = $countries_obj->get_states();
|
||||
}
|
||||
}
|
||||
//===========================================================================================================
|
||||
private static function getAdditionalCheckoutFileds($id_order) {
|
||||
$NationalCode = '_billing_hesabix_nationalcode';
|
||||
$EconomicCode = '_billing_hesabix_economiccode';
|
||||
$RegistrationNumber = '_billing_hesabix_registerationnumber';
|
||||
$Website = '_billing_hesabix_website';
|
||||
$NationalCode_isActive = get_option('ssbhesabix_contact_NationalCode_checkbox_hesabix');
|
||||
$EconomicCode_isActive = get_option('ssbhesabix_contact_EconomicCode_checkbox_hesabix');
|
||||
$RegistrationNumber_isActive = get_option('ssbhesabix_contact_RegistrationNumber_checkbox_hesabix');
|
||||
$Website_isActive = get_option('ssbhesabix_contact_Website_checkbox_hesabix');
|
||||
$add_additional_fileds = get_option('ssbhesabix_contact_add_additional_checkout_fields_hesabix');
|
||||
$fields = array();
|
||||
|
||||
// add additional fields to checkout
|
||||
if($add_additional_fileds == '1') {
|
||||
$fields['NationalCode'] = get_post_meta( $id_order, $NationalCode, true) ?? null;
|
||||
$fields['EconomicCode'] = get_post_meta( $id_order, $EconomicCode, true) ?? null;
|
||||
$fields['RegistrationNumber'] = get_post_meta( $id_order, $RegistrationNumber, true) ?? null;
|
||||
$fields['Website'] = get_post_meta( $id_order, $Website, true) ?? null;
|
||||
} elseif($add_additional_fileds == '2') {
|
||||
$NationalCode = get_option('ssbhesabix_contact_NationalCode_text_hesabix');
|
||||
$EconomicCode = get_option('ssbhesabix_contact_EconomicCode_text_hesabix');
|
||||
$RegistrationNumber = get_option('ssbhesabix_contact_RegistrationNumber_text_hesabix');
|
||||
$Website = get_option('ssbhesabix_contact_Website_text_hesabix');
|
||||
|
||||
if($NationalCode_isActive == 'yes' && $NationalCode)
|
||||
$fields['NationalCode'] = get_post_meta( $id_order, $NationalCode, true) ?? null;
|
||||
|
||||
if($EconomicCode_isActive == 'yes' && $EconomicCode)
|
||||
$fields['EconomicCode'] = get_post_meta( $id_order, $EconomicCode, true) ?? null;
|
||||
|
||||
if($RegistrationNumber_isActive == 'yes' && $RegistrationNumber)
|
||||
$fields['RegistrationNumber'] = get_post_meta( $id_order, $RegistrationNumber, true) ?? null;
|
||||
|
||||
if($Website_isActive == 'yes' && $Website)
|
||||
$fields['Website'] = get_post_meta( $id_order, $Website, true) ?? null;
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
}
|
95
admin/services/ssbhesabixItemService.php
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
class ssbhesabixItemService
|
||||
{
|
||||
public static function mapProduct($product, $id, $new = true) {
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
|
||||
$categories = $product->get_category_ids();
|
||||
$code = $new ? null : $wpFaService->getProductCodeByWpId($id) ;
|
||||
$price = $product->get_regular_price() ? $product->get_regular_price() : $product->get_price();
|
||||
|
||||
$hesabixItem = array(
|
||||
'Code' => $code,
|
||||
'Name' => Ssbhesabix_Validation::itemNameValidation($product->get_title()),
|
||||
'PurchasesTitle' => Ssbhesabix_Validation::itemNameValidation($product->get_title()),
|
||||
'SalesTitle' => Ssbhesabix_Validation::itemNameValidation($product->get_title()),
|
||||
'ItemType' => $product->is_virtual() == 1 ? 1 : 0,
|
||||
'Tag' => json_encode(array('id_product' => $id, 'id_attribute' => 0))
|
||||
);
|
||||
|
||||
if(!$code || get_option("ssbhesabix_do_not_update_product_price_in_hesabix", "no") === "no")
|
||||
$hesabixItem["SellPrice"] = self::getPriceInHesabixDefaultCurrency($price);
|
||||
if(get_option("ssbhesabix_do_not_update_product_barcode_in_hesabix", "no") === "no")
|
||||
$hesabixItem["Barcode"] = Ssbhesabix_Validation::itemBarcodeValidation($product->get_sku());
|
||||
if(get_option("ssbhesabix_do_not_update_product_category_in_hesabix", "no") === "no")
|
||||
if($categories) $hesabixItem["NodeFamily"] = self::getCategoryPath($categories[0]);
|
||||
if(get_option("ssbhesabix_do_not_update_product_product_code_in_hesabix", "no") === "no")
|
||||
$hesabixItem["ProductCode"] = $id;
|
||||
|
||||
return $hesabixItem;
|
||||
}
|
||||
//===========================================================================================================
|
||||
public static function mapProductVariation($product, $variation, $id_product, $new = true) {
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
|
||||
$id_attribute = $variation->get_id();
|
||||
$categories = $product->get_category_ids();
|
||||
$code = $new ? null : $wpFaService->getProductCodeByWpId($id_product, $id_attribute);
|
||||
|
||||
$productName = $product->get_title();
|
||||
$variationName = $variation->get_attribute_summary();
|
||||
$fullName = Ssbhesabix_Validation::itemNameValidation($productName . ' - ' . $variationName);
|
||||
$price = $variation->get_regular_price() ? $variation->get_regular_price() : $variation->get_price();
|
||||
|
||||
$hesabixItem = array(
|
||||
'Code' => $code,
|
||||
'Name' => $fullName,
|
||||
'PurchasesTitle' => $fullName,
|
||||
'SalesTitle' => $fullName,
|
||||
'ItemType' => $variation->is_virtual() == 1 ? 1 : 0,
|
||||
'Tag' => json_encode(array(
|
||||
'id_product' => $id_product,
|
||||
'id_attribute' => $id_attribute
|
||||
)),
|
||||
);
|
||||
|
||||
if(!$code || get_option("ssbhesabix_do_not_update_product_price_in_hesabix", "no") === "no") $hesabixItem["SellPrice"] = self::getPriceInHesabixDefaultCurrency($price);
|
||||
if(get_option("ssbhesabix_do_not_update_product_barcode_in_hesabix", "no") === "no") $hesabixItem["Barcode"] = Ssbhesabix_Validation::itemBarcodeValidation($variation->get_sku());
|
||||
if(get_option("ssbhesabix_do_not_update_product_category_in_hesabix", "no") === "no") $hesabixItem["NodeFamily"] = self::getCategoryPath($categories[0]);
|
||||
if(get_option("ssbhesabix_do_not_update_product_product_code_in_hesabix", "no") === "no") $hesabixItem["ProductCode"] = $id_attribute;
|
||||
|
||||
return $hesabixItem;
|
||||
}
|
||||
//===========================================================================================================
|
||||
public static function getPriceInHesabixDefaultCurrency($price)
|
||||
{
|
||||
if (!isset($price)) return false;
|
||||
|
||||
$woocommerce_currency = get_woocommerce_currency();
|
||||
$hesabix_currency = get_option('ssbhesabix_hesabix_default_currency');
|
||||
|
||||
if (!is_numeric($price)) $price = intval($price);
|
||||
|
||||
if ($hesabix_currency == 'IRR' && $woocommerce_currency == 'IRT') $price *= 10;
|
||||
|
||||
if ($hesabix_currency == 'IRT' && $woocommerce_currency == 'IRR') $price /= 10;
|
||||
|
||||
return $price;
|
||||
}
|
||||
//===========================================================================================================
|
||||
public static function getCategoryPath($id_category)
|
||||
{
|
||||
if (!isset($id_category)) return '';
|
||||
|
||||
$path = get_term_parents_list($id_category, 'product_cat', array(
|
||||
'format' => 'name',
|
||||
'separator' => ':',
|
||||
'link' => false,
|
||||
'inclusive' => true,
|
||||
));
|
||||
|
||||
return substr('products: ' . $path, 0, -1);
|
||||
}
|
||||
//===========================================================================================================
|
||||
}
|
69
includes/class-ssbhesabix-activator.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Fired during plugin activation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's activation.
|
||||
*
|
||||
* @class Ssbhesabix_Activator
|
||||
* @version 2.0.93
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
class Ssbhesabix_Activator {
|
||||
public static $ssbhesabix_db_version = '1.1';
|
||||
|
||||
/**
|
||||
* Short Description. (use period)
|
||||
*
|
||||
* Long Description.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
//===============================================================================================================
|
||||
public static function activate() {
|
||||
add_option('ssbhesabix_webhook_password', bin2hex(openssl_random_pseudo_bytes(16)));
|
||||
add_option('ssbhesabix_last_log_check_id', 0);
|
||||
add_option('ssbhesabix_live_mode', 0);
|
||||
add_option('ssbhesabix_debug_mode', 0);
|
||||
add_option('ssbhesabix_contact_address_status', 1);
|
||||
add_option('ssbhesabix_contact_node_family', 'مشتریان فروشگاه آنلاین');
|
||||
add_option('ssbhesabix_contact_automaatic_save_node_family', 'yes');
|
||||
add_option('ssbhesabix_contact_automatically_save_in_hesabix', 'yes');
|
||||
add_option('ssbhesabix_activation_date', date("Y-m-d"));
|
||||
add_option('ssbhesabix_use_export_product_opening_quantity', false);
|
||||
add_option('ssbhesabix_business_expired', 0);
|
||||
add_option('ssbhesabix_do_not_submit_product_automatically', "no");
|
||||
add_option('ssbhesabix_do_not_update_product_price_in_hesabix', "no");
|
||||
add_option('ssbhesabix_contact_add_additional_checkout_fields_hesabix', 1);
|
||||
|
||||
self::ssbhesabix_create_database_table();
|
||||
}
|
||||
//===============================================================================================================
|
||||
public static function ssbhesabix_create_database_table()
|
||||
{
|
||||
global $wpdb;
|
||||
$table_name = $wpdb->prefix . "ssbhesabix";
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
|
||||
$sql = "
|
||||
CREATE TABLE $table_name (
|
||||
id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
obj_type varchar(32) NOT NULL,
|
||||
id_hesabix int(11) UNSIGNED NOT NULL,
|
||||
id_ps int(11) UNSIGNED NOT NULL,
|
||||
id_ps_attribute int(11) UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (id)
|
||||
) $charset_collate;";
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
dbDelta($sql);
|
||||
|
||||
update_option('ssbhesabix_db_version', self::$ssbhesabix_db_version);
|
||||
}
|
||||
//===============================================================================================================
|
||||
}
|
481
includes/class-ssbhesabix-api.php
Normal file
|
@ -0,0 +1,481 @@
|
|||
<?php
|
||||
|
||||
include_once(plugin_dir_path(__DIR__) . 'admin/services/HesabixLogService.php');
|
||||
|
||||
/**
|
||||
* @class Ssbhesabix_Api
|
||||
* @version 2.0.93
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/api
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Api
|
||||
{
|
||||
//================================================================================================
|
||||
public function apiRequest($method, $data = array())
|
||||
{
|
||||
if ($method == null) return false;
|
||||
|
||||
$endpoint = 'https://hesabix.ir/v1/' . $method;
|
||||
|
||||
$apiAddress = get_option('ssbhesabix_api_address', 0);
|
||||
|
||||
if($apiAddress == 1) $endpoint = 'http://api.hesabix.ir/v1/' . $method;
|
||||
|
||||
$body = array_merge(array(
|
||||
'apiKey' => get_option('ssbhesabix_account_api'),
|
||||
'userId' => get_option('ssbhesabix_account_username'),
|
||||
'password' => get_option('ssbhesabix_account_password'),
|
||||
'loginToken' => get_option('ssbhesabix_account_login_token') ? get_option('ssbhesabix_account_login_token') : '',
|
||||
), $data);
|
||||
|
||||
//Debug mode
|
||||
if (get_option('ssbhesabix_debug_mode')) {
|
||||
HesabixLogService::log(array("Debug Mode - Data: " . print_r($data, true)));
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'body' => wp_json_encode($body),
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'timeout' => 60,
|
||||
'redirection' => 5,
|
||||
'blocking' => true,
|
||||
'httpversion' => '1.0',
|
||||
'sslverify' => false,
|
||||
'data_format' => 'body',
|
||||
);
|
||||
|
||||
//HesabixLogService::writeLogObj($options);
|
||||
|
||||
$wp_remote_post = wp_remote_post($endpoint, $options);
|
||||
$result = json_decode(wp_remote_retrieve_body($wp_remote_post));
|
||||
|
||||
//Debug mode
|
||||
if (get_option('ssbhesabix_debug_mode')) {
|
||||
HesabixLogService::log(array("Debug Mode - Result: " . print_r($result, true)));
|
||||
}
|
||||
|
||||
//fix API limit request - Maximum request per minutes is 60 times,
|
||||
sleep(1);
|
||||
|
||||
if ($result == null) {
|
||||
return 'No response from Hesabix';
|
||||
} else {
|
||||
if (!isset($result->Success)) {
|
||||
switch ($result->ErrorCode) {
|
||||
case '100':
|
||||
return 'InternalServerError';
|
||||
case '101':
|
||||
return 'TooManyRequests';
|
||||
case '103':
|
||||
return 'MissingData';
|
||||
case '104':
|
||||
return 'MissingParameter' . '. ErrorMessage: ' . $result->ErrorMessage;
|
||||
case '105':
|
||||
return 'ApiDisabled';
|
||||
case '106':
|
||||
return 'UserIsNotOwner';
|
||||
case '107':
|
||||
return 'BusinessNotFound';
|
||||
case '108':
|
||||
return 'BusinessExpired';
|
||||
case '110':
|
||||
return 'IdMustBeZero';
|
||||
case '111':
|
||||
return 'IdMustNotBeZero';
|
||||
case '112':
|
||||
return 'ObjectNotFound' . '. ErrorMessage: ' . $result->ErrorMessage;
|
||||
case '113':
|
||||
return 'MissingApiKey';
|
||||
case '114':
|
||||
return 'ParameterIsOutOfRange' . '. ErrorMessage: ' . $result->ErrorMessage;
|
||||
case '190':
|
||||
return 'ApplicationError' . '. ErrorMessage: ' . $result->ErrorMessage;
|
||||
}
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//================================================================================================
|
||||
//Contact functions
|
||||
public function contactGet($code)
|
||||
{
|
||||
$method = 'contact/get';
|
||||
$data = array(
|
||||
'code' => $code,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactGetById($idList)
|
||||
{
|
||||
$method = 'contact/getById';
|
||||
$data = array(
|
||||
'idList' => $idList,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactGetContacts($queryInfo)
|
||||
{
|
||||
$method = 'contact/getcontacts';
|
||||
$data = array(
|
||||
'queryInfo' => $queryInfo,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactSave($contact)
|
||||
{
|
||||
$method = 'contact/save';
|
||||
$data = array(
|
||||
'contact' => $contact,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactBatchSave($contacts)
|
||||
{
|
||||
$method = 'contact/batchsave';
|
||||
$data = array(
|
||||
'contacts' => $contacts,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactDelete($code)
|
||||
{
|
||||
$method = 'contact/delete';
|
||||
$data = array(
|
||||
'code' => $code,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function contactGetByPhoneOrEmail($phone, $email) {
|
||||
$method = 'contact/findByPhoneOrEmail';
|
||||
$data = array(
|
||||
'mobile' => $phone,
|
||||
'email' => $email,
|
||||
'phone' => $phone,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
//Items functions
|
||||
public function itemGet($code)
|
||||
{
|
||||
$method = 'item/get';
|
||||
$data = array(
|
||||
'code' => $code,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemGetByBarcode($barcode)
|
||||
{
|
||||
$method = 'item/getByBarcode';
|
||||
$data = array(
|
||||
'barcode' => $barcode,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemGetById($idList)
|
||||
{
|
||||
$method = 'item/getById';
|
||||
$data = array(
|
||||
'idList' => $idList,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemGetItems($queryInfo = null)
|
||||
{
|
||||
$method = 'item/getitems';
|
||||
$data = array(
|
||||
'queryInfo' => $queryInfo,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemSave($item)
|
||||
{
|
||||
$method = 'item/save';
|
||||
$data = array(
|
||||
'item' => $item,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemBatchSave($items)
|
||||
{
|
||||
$method = 'item/batchsave';
|
||||
$data = array(
|
||||
'items' => $items,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemDelete($code)
|
||||
{
|
||||
$method = 'item/delete';
|
||||
$data = array(
|
||||
'code' => $code,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemGetQuantity($warehouseCode, $codes)
|
||||
{
|
||||
$method = 'item/GetQuantity';
|
||||
$data = array(
|
||||
'warehouseCode' => $warehouseCode,
|
||||
'codes' => $codes,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
//Invoice functions
|
||||
public function invoiceGet($number, $type = 0)
|
||||
{
|
||||
$method = 'invoice/get';
|
||||
$data = array(
|
||||
'number' => $number,
|
||||
'type' => $type,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceGetById($id)
|
||||
{
|
||||
$method = 'invoice/getById';
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceGetByIdList($idList)
|
||||
{
|
||||
$method = 'invoice/getById';
|
||||
$data = array(
|
||||
'idList' => $idList,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceGetInvoices($queryinfo, $type = 0)
|
||||
{
|
||||
$method = 'invoice/getinvoices';
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'queryInfo' => $queryinfo,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceSave($invoice, $GUID='')
|
||||
{
|
||||
$method = 'invoice/save';
|
||||
$data = array(
|
||||
'invoice' => $invoice,
|
||||
);
|
||||
|
||||
if($GUID != '') $data['requestUniqueId'] = $GUID;
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceDelete($number, $type = 0)
|
||||
{
|
||||
$method = 'invoice/delete';
|
||||
$data = array(
|
||||
'code' => $number,
|
||||
'type' => $type,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceSavePayment($number, $financialData, $accountPath, $date, $amount, $transactionNumber = null, $description = null, $transactionFee = 0)
|
||||
{
|
||||
if(get_option('ssbhesabix_invoice_transaction_fee') && get_option('ssbhesabix_invoice_transaction_fee') > 0) {
|
||||
$transactionFeeOption = get_option('ssbhesabix_invoice_transaction_fee');
|
||||
|
||||
$func = new Ssbhesabix_Admin_Functions();
|
||||
$transactionFeeOption = $func->convertPersianDigitsToEnglish($transactionFeeOption);
|
||||
|
||||
if($transactionFeeOption<100 && $transactionFeeOption>0) $transactionFeeOption /= 100;
|
||||
$transactionFee = $amount * $transactionFeeOption;
|
||||
if($transactionFee < 1) $transactionFee = 0;
|
||||
}
|
||||
|
||||
$method = 'invoice/savepayment';
|
||||
$data = array(
|
||||
'number' => (int)$number,
|
||||
'date' => $date,
|
||||
'amount' => $amount,
|
||||
'transactionNumber' => $transactionNumber,
|
||||
'description' => $description,
|
||||
'transactionFee' => $transactionFee,
|
||||
);
|
||||
|
||||
$data = array_merge($data, $financialData);
|
||||
if($accountPath != []) $data = array_merge($data, $accountPath);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function invoiceGetOnlineInvoiceURL($number, $type = 0)
|
||||
{
|
||||
$method = 'invoice/getonlineinvoiceurl';
|
||||
$data = array(
|
||||
'number' => $number,
|
||||
'type' => $type,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function itemUpdateOpeningQuantity($items)
|
||||
{
|
||||
$method = 'item/UpdateOpeningQuantity';
|
||||
$data = array(
|
||||
'items' => $items,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function saveWarehouseReceipt($receipt) {
|
||||
$method = 'invoice/SaveWarehouseReceipt';
|
||||
$data = array(
|
||||
'deleteOldReceipts' => true,
|
||||
'receipt' => $receipt,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function warehouseReceiptGetByIdList($idList)
|
||||
{
|
||||
$method = 'invoice/getWarehouseReceipt';
|
||||
$data = array(
|
||||
'idList' => $idList,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
//Settings functions
|
||||
public function settingSetChangeHook($url, $hookPassword)
|
||||
{
|
||||
$method = 'setting/SetChangeHook';
|
||||
$data = array(
|
||||
'url' => $url,
|
||||
'hookPassword' => $hookPassword,
|
||||
);
|
||||
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetChanges($start = 0)
|
||||
{
|
||||
$method = 'setting/GetChanges';
|
||||
$data = array(
|
||||
'start' => $start,
|
||||
);
|
||||
return $this->apiRequest($method, $data);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetAccounts()
|
||||
{
|
||||
$method = 'setting/GetAccounts';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetBanks()
|
||||
{
|
||||
$method = 'setting/getBanks';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetCashes()
|
||||
{
|
||||
$method = 'setting/GetCashes';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetProjects()
|
||||
{
|
||||
$method = 'setting/getProjects';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetSalesmen()
|
||||
{
|
||||
$method = 'setting/getSalesmen';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetCurrency()
|
||||
{
|
||||
$method = 'setting/getCurrency';
|
||||
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetFiscalYear()
|
||||
{
|
||||
$method = 'setting/GetFiscalYear';
|
||||
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetWarehouses()
|
||||
{
|
||||
$method = 'setting/GetWarehouses';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function fixClearTags()
|
||||
{
|
||||
$method = 'fix/clearTag';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
public function settingGetSubscriptionInfo()
|
||||
{
|
||||
$method = 'setting/getBusinessInfo';
|
||||
return $this->apiRequest($method);
|
||||
}
|
||||
//================================================================================================
|
||||
}
|
28
includes/class-ssbhesabix-deactivator.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's deactivation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
class Ssbhesabix_Deactivator {
|
||||
|
||||
/**
|
||||
* Short Description. (use period)
|
||||
*
|
||||
* Long Description.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function deactivate() {
|
||||
|
||||
}
|
||||
|
||||
}
|
33
includes/class-ssbhesabix-i18n.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Define the internationalization functionality.
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin
|
||||
* so that it is ready for translation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
class Ssbhesabix_i18n {
|
||||
|
||||
|
||||
/**
|
||||
* Load the plugin text domain for translation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function load_plugin_textdomain() {
|
||||
|
||||
load_plugin_textdomain(
|
||||
'ssbhesabix',
|
||||
false,
|
||||
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
||||
);
|
||||
|
||||
}
|
||||
}
|
122
includes/class-ssbhesabix-loader.php
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Register all actions and filters for the plugin.
|
||||
*
|
||||
* Maintain a list of all hooks that are registered throughout
|
||||
* the plugin, and register them with the WordPress API. Call the
|
||||
* run function to execute the list of actions and filters.
|
||||
*
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Loader {
|
||||
|
||||
/**
|
||||
* The array of actions registered with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $actions;
|
||||
|
||||
/**
|
||||
* The array of filters registered with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $filters;
|
||||
|
||||
/**
|
||||
* Initialize the collections used to maintain the actions and filters.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
||||
*/
|
||||
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
||||
*/
|
||||
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility function that is used to register the actions and hooks into a single
|
||||
* collection.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
* @return array The collection of actions and filters registered with WordPress.
|
||||
*/
|
||||
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
||||
|
||||
$hooks[] = array(
|
||||
'hook' => $hook,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args
|
||||
);
|
||||
|
||||
return $hooks;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the filters and actions with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function run() {
|
||||
|
||||
foreach ( $this->filters as $hook ) {
|
||||
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
foreach ( $this->actions as $hook ) {
|
||||
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
317
includes/class-ssbhesabix-validation.php
Normal file
|
@ -0,0 +1,317 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @class Ssbhesabix_Validation
|
||||
* @version 2.0.93
|
||||
* @since 1.1.5
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Validation
|
||||
{
|
||||
public static function itemCodeValidation($code)
|
||||
{
|
||||
$code = preg_replace('/[^0-9]/', '', $code);
|
||||
$code = self::formatFarsiNumbers($code);
|
||||
return mb_substr($code, 0, 5);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemNameValidation($name)
|
||||
{
|
||||
$name = self::formatFarsiNumbers($name);
|
||||
return self::remove_emoji($name, 199);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function formatFarsiNumbers($str) {
|
||||
$farsiNumbers = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"];
|
||||
$englishNumbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
||||
for ($i = 0; $i < 10; $i++)
|
||||
$str = str_replace($farsiNumbers[$i], $englishNumbers[$i], $str);
|
||||
return $str;
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemBarcodeValidation($barcode)
|
||||
{
|
||||
$barcode = self::formatFarsiNumbers($barcode);
|
||||
return mb_substr($barcode, 0, 999);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemCategoryValidation($category) {return $category;}
|
||||
//=============================================================================================
|
||||
public static function itemDescriptionValidation($description) {return mb_substr($description, 0, 199);}
|
||||
//=============================================================================================
|
||||
public static function itemMainUnitValidation($mainUnit) {return mb_substr($mainUnit, 0, 29);}
|
||||
//=============================================================================================
|
||||
public static function itemSubUnitValidation($subUnit) {return mb_substr($subUnit, 0, 29);}
|
||||
//=============================================================================================
|
||||
public static function itemConversionFactorValidation($conversionFactor)
|
||||
{
|
||||
if ($conversionFactor < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return $conversionFactor;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemSalesTaxValidation($salesTax)
|
||||
{
|
||||
if ($salesTax >= 0 && $salesTax <= 100) {
|
||||
return $salesTax;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemSalesInfoValidation($salesInfo) {return mb_substr($salesInfo, 0, 99);}
|
||||
//=============================================================================================
|
||||
public static function itemPurchaseCostValidation($purchaseCost)
|
||||
{
|
||||
if ($purchaseCost >= 0) {
|
||||
return $purchaseCost;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function itemPurchaseInfoValidation($purchaseInfo) {return mb_substr($purchaseInfo, 0, 99);}
|
||||
//=============================================================================================
|
||||
public static function itemTagValidation($tag) {return mb_substr($tag, 0, 254);}
|
||||
//=============================================================================================
|
||||
public static function contactCodeValidation($code)
|
||||
{
|
||||
$code = preg_replace('/[^0-9]/', '', $code);
|
||||
return mb_substr($code, 0, 5);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactDisplayNameValidation($displayName) {return mb_substr($displayName, 0, 99);}
|
||||
//=============================================================================================
|
||||
public static function contactCompanyValidation($company) {return mb_substr($company, 0, 99);}
|
||||
//=============================================================================================
|
||||
public static function contactTitleValidation($title) {return mb_substr($title, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function contactFirstNameValidation($firstName) {return mb_substr($firstName, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function contactLastNameValidation($lastName) {return mb_substr($lastName, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function contactAddressValidation($address) {return mb_substr($address, 0, 149);}
|
||||
//=============================================================================================
|
||||
public static function contactCountryValidation($country) {return mb_substr($country, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function contactStateValidation($state) {
|
||||
if ( is_numeric( $state ) ) {
|
||||
if(is_plugin_active("persian-woocommerce-shipping/woocommerce-shipping.php")) {
|
||||
$state = PWS()::get_state( $state );
|
||||
}
|
||||
}
|
||||
return mb_substr($state, 0, 49);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactCityValidation($city) {
|
||||
if ( is_numeric( $city ) ) {
|
||||
if(is_plugin_active("persian-woocommerce-shipping/woocommerce-shipping.php")) {
|
||||
$city = PWS()::get_city($city);
|
||||
}
|
||||
}
|
||||
return mb_substr($city, 0, 49);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactPostalCodeValidation($postalCode)
|
||||
{
|
||||
$postalCode = preg_replace('/[^0-9]/', '', $postalCode);
|
||||
$postalCode = self::formatFarsiNumbers($postalCode);
|
||||
return mb_substr($postalCode, 0, 10);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactPhoneValidation($phone)
|
||||
{
|
||||
$phone = preg_replace('/[^0-9]/', '', $phone);
|
||||
$phone = self::formatFarsiNumbers($phone);
|
||||
return mb_substr($phone, 0, 14);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactMobileValidation($mobile)
|
||||
{
|
||||
$mobile = preg_replace('/[^0-9]/', '', $mobile);
|
||||
return mb_substr($mobile, 0, 14);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactFaxValidation($fax)
|
||||
{
|
||||
$fax = preg_replace('/[^0-9]/', '', $fax);
|
||||
return mb_substr($fax, 0, 14);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactEmailValidation($email)
|
||||
{
|
||||
$isValid = true;
|
||||
$atIndex = strrpos($email, "@");
|
||||
if (is_bool($atIndex) && !$atIndex) {
|
||||
$isValid = false;
|
||||
} else {
|
||||
$domain = substr($email, $atIndex + 1);
|
||||
$local = substr($email, 0, $atIndex);
|
||||
$localLen = strlen($local);
|
||||
$domainLen = strlen($domain);
|
||||
if ($localLen < 1 || $localLen > 64) {
|
||||
// local part length exceeded
|
||||
$isValid = false;
|
||||
} else if ($domainLen < 1 || $domainLen > 255) {
|
||||
// domain part length exceeded
|
||||
$isValid = false;
|
||||
} else if ($local[0] == '.' || $local[$localLen - 1] == '.') {
|
||||
// local part starts or ends with '.'
|
||||
$isValid = false;
|
||||
} else if (preg_match('/\\.\\./', $local)) {
|
||||
// local part has two consecutive dots
|
||||
$isValid = false;
|
||||
} else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
|
||||
// character not valid in domain part
|
||||
$isValid = false;
|
||||
} else if (preg_match('/\\.\\./', $domain)) {
|
||||
// domain part has two consecutive dots
|
||||
$isValid = false;
|
||||
} else if
|
||||
(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
|
||||
str_replace("\\\\", "", $local))) {
|
||||
// character not valid in local part unless
|
||||
// local part is quoted
|
||||
if (!preg_match('/^"(\\\\"|[^"])+"$/',
|
||||
str_replace("\\\\", "", $local))) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isValid) {
|
||||
return $email;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function contactWebsiteValidation($website) {return mb_substr($website, 0, 119);}
|
||||
//=============================================================================================
|
||||
public static function contactNoteValidation($note) {return mb_substr($note, 0, 499);}
|
||||
//=============================================================================================
|
||||
public static function contactCategoryValidation($category) {return $category;}
|
||||
//=============================================================================================
|
||||
public static function contactTagValidation($tag) {return mb_substr($tag, 0, 254);}
|
||||
//=============================================================================================
|
||||
public static function invoiceFinancialYearValidation($financialYear) {return $financialYear;}
|
||||
//=============================================================================================
|
||||
public static function invoiceCurrencyRateValidation($currencyRate)
|
||||
{
|
||||
if ($currencyRate > 0) {
|
||||
return $currencyRate;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceNumberValidation($number) {return mb_substr($number, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function invoiceContactTitleValidation($contactTitle) {return mb_substr($contactTitle, 0, 199);}
|
||||
//=============================================================================================
|
||||
public static function invoiceDueDateValidation($dueDate) {return $dueDate;}
|
||||
//=============================================================================================
|
||||
public static function invoiceNoteValidation($note) {return mb_substr($note, 0, 499);}
|
||||
//=============================================================================================
|
||||
public static function invoiceReferenceValidation($reference) {return mb_substr($reference, 0, 49);}
|
||||
//=============================================================================================
|
||||
public static function invoiceTagValidation($tag) {return mb_substr($tag, 0, 254);}
|
||||
//=============================================================================================
|
||||
public function invoiceItemsValidation($items) {return $items;}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemDescriptionValidation($description) {
|
||||
return self::remove_emoji($description, 249);
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemQuantityValidation($quantity)
|
||||
{
|
||||
if ($quantity > 0) {
|
||||
return $quantity;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemUnitValidation($unit) {return mb_substr($unit, 0, 29);}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemUnitPriceValidation($unitPrice)
|
||||
{
|
||||
if ($unitPrice >= 0) {
|
||||
return $unitPrice;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemAmountValidation($amount)
|
||||
{
|
||||
if ($amount >= 0) {
|
||||
return $amount;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemDiscountValidation($discount)
|
||||
{
|
||||
if ($discount >= 0) {
|
||||
return $discount;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemTaxValidation($tax)
|
||||
{
|
||||
if ($tax >= 0) {
|
||||
return $tax;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function invoiceItemTotalAmountValidation($totalAmount)
|
||||
{
|
||||
if ($totalAmount >= 0) {
|
||||
return $totalAmount;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public static function remove_emoji($string, $length = 200) : string
|
||||
{
|
||||
$regex_alphanumeric = '/[\x{1F100}-\x{1F1FF}]/u';
|
||||
$clear_string = preg_replace($regex_alphanumeric, '', $string);
|
||||
|
||||
$regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u';
|
||||
$clear_string = preg_replace($regex_symbols, '', $clear_string);
|
||||
|
||||
$regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u';
|
||||
$clear_string = preg_replace($regex_emoticons, '', $clear_string);
|
||||
|
||||
$regex_transport = '/[\x{1F680}-\x{1F6FF}]/u';
|
||||
$clear_string = preg_replace($regex_transport, '', $clear_string);
|
||||
|
||||
$regex_supplemental = '/[\x{1F900}-\x{1F9FF}]/u';
|
||||
$clear_string = preg_replace($regex_supplemental, '', $clear_string);
|
||||
|
||||
$regex_misc = '/[\x{2600}-\x{26FF}\x{1F7E9}-\x{1F7EF}]/u';
|
||||
$clear_string = preg_replace($regex_misc, '', $clear_string);
|
||||
|
||||
$regex_dingbats = '/[\x{2700}-\x{27BF}]/u';
|
||||
$clear_string = preg_replace($regex_dingbats, '', $clear_string);
|
||||
|
||||
$truncated_string = mb_substr($clear_string, 0, $length);
|
||||
|
||||
return $truncated_string;
|
||||
}
|
||||
//=============================================================================================
|
||||
}
|
288
includes/class-ssbhesabix-webhook.php
Normal file
|
@ -0,0 +1,288 @@
|
|||
<?php
|
||||
|
||||
include_once(plugin_dir_path(__DIR__) . 'admin/services/HesabixLogService.php');
|
||||
include_once(plugin_dir_path(__DIR__) . 'admin/services/HesabixWpFaService.php');
|
||||
|
||||
/*
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix_Webhook
|
||||
{
|
||||
public $invoicesObjectId = array();
|
||||
public $invoiceItemsCode = array();
|
||||
public $itemsObjectId = array();
|
||||
public $contactsObjectId = array();
|
||||
public $warehouseReceiptsObjectId = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//HesabixLogService::writeLogStr("Calling Webhook");
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
|
||||
$hesabixApi = new Ssbhesabix_Api();
|
||||
|
||||
$lastChange = get_option('ssbhesabix_last_log_check_id');
|
||||
$changes = $hesabixApi->settingGetChanges($lastChange + 1);
|
||||
|
||||
if ($changes->Success) {
|
||||
update_option('ssbhesabix_business_expired', 0);
|
||||
|
||||
foreach ($changes->Result as $item) {
|
||||
if (!$item->API) {
|
||||
switch ($item->ObjectType) {
|
||||
case 'Invoice':
|
||||
if ($item->Action == 123) {
|
||||
$wpFa1 = $wpFaService->getWpFaByHesabixId('order', $item->Extra2);
|
||||
if($wpFa1) {
|
||||
$wpFaService->delete($wpFa1);
|
||||
HesabixLogService::writeLogStr("The invoice link with the order deleted. Invoice number: " . $item->Extra2 . ", Order id: " . $wpFa1->idWp);
|
||||
}
|
||||
}
|
||||
$this->invoicesObjectId[] = $item->ObjectId;
|
||||
foreach (explode(',', $item->Extra) as $invoiceItem) {
|
||||
if ($invoiceItem != '') {
|
||||
$this->invoiceItemsCode[] = $invoiceItem;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'WarehouseReceipt':
|
||||
$this->warehouseReceiptsObjectId[] = $item->ObjectId;
|
||||
break;
|
||||
case 'Product':
|
||||
if ($item->Action == 53) {
|
||||
$wpFa = $wpFaService->getWpFaByHesabixId('product', $item->Extra);
|
||||
if ($wpFa) {
|
||||
global $wpdb;
|
||||
$wpdb->delete($wpdb->prefix . 'ssbhesabix', array('id' => $wpFa->id));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->itemsObjectId[] = $item->ObjectId;
|
||||
break;
|
||||
case 'Contact':
|
||||
if ($item->Action == 33) {
|
||||
$id_obj = $wpFaService->getWpFaIdByHesabixId('customer', $item->Extra);
|
||||
global $wpdb;
|
||||
$wpdb->delete($wpdb->prefix . 'ssbhesabix', array('id' => $id_obj));
|
||||
break;
|
||||
}
|
||||
|
||||
$this->contactsObjectId[] = $item->ObjectId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->invoiceItemsCode = array_unique($this->invoiceItemsCode);
|
||||
$this->contactsObjectId = array_unique($this->contactsObjectId);
|
||||
$this->itemsObjectId = array_unique($this->itemsObjectId);
|
||||
$this->invoicesObjectId = array_unique($this->invoicesObjectId);
|
||||
|
||||
$this->setChanges();
|
||||
|
||||
$lastChange = end($changes->Result);
|
||||
if (is_object($lastChange))
|
||||
update_option('ssbhesabix_last_log_check_id', $lastChange->Id);
|
||||
else if ($changes->LastId)
|
||||
update_option('ssbhesabix_last_log_check_id', $changes->LastId);
|
||||
|
||||
} else {
|
||||
HesabixLogService::log(array("ssbhesabix - Cannot check last changes. Error Message: " . (string)$changes->ErrorMessage . ". Error Code: " . (string)$changes->ErrorCode));
|
||||
if ($changes->ErrorCode == 108) {
|
||||
update_option('ssbhesabix_business_expired', 1);
|
||||
add_action('admin_notices', array(__CLASS__, 'ssbhesabix_business_expired_notice'));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function ssbhesabix_business_expired_notice()
|
||||
{
|
||||
echo '<div class="error"><p>' . __('Cannot connect to Hesabix. Business expired.', 'ssbhesabix') . '</p></div>';
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function setChanges()
|
||||
{
|
||||
//Items
|
||||
$items = array();
|
||||
|
||||
if (!empty($this->warehouseReceiptsObjectId)) {
|
||||
$receipts = $this->getObjectsByIdList($this->warehouseReceiptsObjectId, 'WarehouseReceipt');
|
||||
if ($receipts != false) {
|
||||
foreach ($receipts as $receipt) {
|
||||
foreach ($receipt->Items as $item)
|
||||
array_push($this->invoiceItemsCode, $item->ItemCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->itemsObjectId)) {
|
||||
$objects = $this->getObjectsByIdList($this->itemsObjectId, 'item');
|
||||
if ($objects != false) {
|
||||
foreach ($objects as $object) {
|
||||
array_push($items, $object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->invoiceItemsCode)) {
|
||||
$objects = $this->getObjectsByCodeList($this->invoiceItemsCode);
|
||||
|
||||
if ($objects != false) {
|
||||
foreach ($objects as $object) {
|
||||
array_push($items, $object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($items)) {
|
||||
update_option("ssbhesabix_inside_product_edit", 1);
|
||||
try {
|
||||
foreach ($items as $item) {
|
||||
Ssbhesabix_Admin_Functions::setItemChanges($item);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} finally {
|
||||
update_option("ssbhesabix_inside_product_edit", 0);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function setInvoiceChanges($invoice)
|
||||
{
|
||||
if (!is_object($invoice)) return false;
|
||||
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
|
||||
$number = $invoice->Number;
|
||||
$json = json_decode($invoice->Tag);
|
||||
if (is_object($json)) {
|
||||
$id_order = $json->id_order;
|
||||
} else {
|
||||
$id_order = 0;
|
||||
}
|
||||
|
||||
if ($invoice->InvoiceType == 0) {
|
||||
if ($id_order == 0) {
|
||||
HesabixLogService::log(array("This invoice is not defined in OnlineStore. Invoice Number: " . $number));
|
||||
} else {
|
||||
//check if order exist in wooCommerce
|
||||
$id_obj = $wpFaService->getWpFaId('order', $id_order);
|
||||
if ($id_obj != false) {
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT `id_hesabix` FROM `" . $wpdb->prefix . "ssbhesabix` WHERE `id` = $id_obj");
|
||||
if (is_object($row) && $row->id_hesabix != $number) {
|
||||
$id_hesabix_old = $row->id_hesabix;
|
||||
//ToDo: number must be int in hesabix, what can I do
|
||||
$wpdb->update($wpdb->prefix . 'ssbhesabix', array('id_hesabix' => $number), array('id' => $id_obj));
|
||||
HesabixLogService::log(array("Invoice Number changed. Old Number: $id_hesabix_old. New ID: $number"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function setContactChanges($contact)
|
||||
{
|
||||
if (!is_object($contact)) return false;
|
||||
|
||||
$code = $contact->Code;
|
||||
|
||||
$json = json_decode($contact->Tag);
|
||||
if (is_object($json)) {
|
||||
$id_customer = $json->id_customer;
|
||||
} else {
|
||||
$id_customer = 0;
|
||||
}
|
||||
|
||||
if ($id_customer == 0) {
|
||||
HesabixLogService::log(array("This Customer is not define in OnlineStore. Customer code: $code"));
|
||||
return false;
|
||||
}
|
||||
|
||||
$wpFaService = new HesabixWpFaService();
|
||||
$id_obj = $wpFaService->getWpFaId('customer', $id_customer);
|
||||
|
||||
if ($id_obj != false) {
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row("SELECT `id_hesabix` FROM `" . $wpdb->prefix . "ssbhesabix` WHERE `id` = $id_obj");
|
||||
|
||||
if (is_object($row) && $row->id_hesabix != $code) {
|
||||
$id_hesabix_old = $row->id_hesabix;
|
||||
$wpdb->update($wpdb->prefix . 'ssbhesabix', array('id_hesabix' => (int)$code), array('id' => $id_obj));
|
||||
|
||||
HesabixLogService::log(array("Contact Code changed. Old ID: $id_hesabix_old. New ID: $code"));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function getObjectsByIdList($idList, $type)
|
||||
{
|
||||
$hesabixApi = new Ssbhesabix_Api();
|
||||
$warehouseCode = get_option('ssbhesabix_item_update_quantity_based_on');
|
||||
switch ($type) {
|
||||
case 'item':
|
||||
if($warehouseCode == '-1') {
|
||||
$result = $hesabixApi->itemGetById($idList);
|
||||
} else {
|
||||
$items = $hesabixApi->itemGetById($idList);
|
||||
$codeList = [];
|
||||
foreach ($items->Result as $item) {
|
||||
array_push($codeList, $item->Code);
|
||||
}
|
||||
$result = $hesabixApi->itemGetQuantity($warehouseCode, $codeList);
|
||||
}
|
||||
break;
|
||||
case 'contact':
|
||||
$result = $hesabixApi->contactGetById($idList);
|
||||
break;
|
||||
case 'invoice':
|
||||
$result = $hesabixApi->invoiceGetInvoices(array("Filters" => array("Property" => "Id", "Operator" => "in", "Value" => $idList)));
|
||||
break;
|
||||
case 'WarehouseReceipt':
|
||||
$result = $hesabixApi->warehouseReceiptGetByIdList($idList);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_object($result) && $result->Success) {
|
||||
return $result->Result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//=================================================================================================================================
|
||||
public function getObjectsByCodeList($codeList)
|
||||
{
|
||||
$filters = array(array("Property" => "Code", "Operator" => "in", "Value" => $codeList));
|
||||
$hesabixApi = new Ssbhesabix_Api();
|
||||
|
||||
$warehouse = get_option('ssbhesabix_item_update_quantity_based_on', "-1");
|
||||
if ($warehouse == "-1")
|
||||
$result = $hesabixApi->itemGetItems(array('Take' => 100000, 'Filters' => $filters));
|
||||
else {
|
||||
$result = $hesabixApi->itemGetQuantity($warehouse, $codeList);
|
||||
}
|
||||
|
||||
//$result = $hesabixApi->itemGetItems($queryInfo);
|
||||
|
||||
if (is_object($result) && $result->Success) {
|
||||
return $warehouse == "-1" ? $result->Result->List : $result->Result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
324
includes/class-ssbhesabix.php
Normal file
|
@ -0,0 +1,324 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The core plugin class.
|
||||
*
|
||||
* This is used to define internationalization, admin-specific hooks, and
|
||||
* public-facing site hooks.
|
||||
*
|
||||
* Also maintains the unique identifier of this plugin as well as the current
|
||||
* version of the plugin.
|
||||
*
|
||||
* @class Ssbhesabix
|
||||
* @version 2.0.93
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
* @subpackage ssbhesabix/includes
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
class Ssbhesabix
|
||||
{
|
||||
|
||||
/**
|
||||
* The loader that's responsible for maintaining and registering all hooks that power
|
||||
* the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var Ssbhesabix_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* The unique identifier of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var string $plugin_name The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $plugin_name;
|
||||
|
||||
/**
|
||||
* The current version of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var string $version The current version of the plugin.
|
||||
*/
|
||||
protected $version;
|
||||
//==========================================================================================================
|
||||
/**
|
||||
* Define the core functionality of the plugin.
|
||||
*
|
||||
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
||||
* Load the dependencies, define the locale, and set the hooks for the admin area and
|
||||
* the public-facing side of the site.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (defined('SSBHESABFA_VERSION')) {
|
||||
$this->version = SSBHESABFA_VERSION;
|
||||
} else {
|
||||
$this->version = '2.0.93';
|
||||
}
|
||||
$this->plugin_name = 'ssbhesabix';
|
||||
|
||||
$this->load_dependencies();
|
||||
$this->set_locale();
|
||||
$this->define_admin_hooks();
|
||||
}
|
||||
//==========================================================================================================
|
||||
/**
|
||||
* Load the required dependencies for this plugin.
|
||||
*
|
||||
* Include the following files that make up the plugin:
|
||||
*
|
||||
* - Ssbhesabix_Loader. Orchestrates the hooks of the plugin.
|
||||
* - Ssbhesabix_i18n. Defines internationalization functionality.
|
||||
* - Ssbhesabix_Admin. Defines all hooks for the admin area.
|
||||
* - Ssbhesabix_Public. Defines all hooks for the public side of the site.
|
||||
*
|
||||
* Create an instance of the loader which will be used to register the hooks
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function load_dependencies()
|
||||
{
|
||||
|
||||
/**
|
||||
* The class responsible for orchestrating the actions and filters of the
|
||||
* core plugin.
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-ssbhesabix-loader.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining internationalization functionality
|
||||
* of the plugin.
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-ssbhesabix-i18n.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the admin area.
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-ssbhesabix-admin.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all Hesabix API methods
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-ssbhesabix-api.php';
|
||||
|
||||
$this->loader = new Ssbhesabix_Loader();
|
||||
|
||||
/**
|
||||
* The class responsible for defining all Hesabix data Validations
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-ssbhesabix-validation.php';
|
||||
|
||||
$this->loader = new Ssbhesabix_Loader();
|
||||
|
||||
}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* Define the locale for this plugin for internationalization.
|
||||
*
|
||||
* Uses the Plugin_Name_i18n class in order to set the domain and to register the hook
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function set_locale()
|
||||
{
|
||||
$plugin_i18n = new Ssbhesabix_i18n();
|
||||
|
||||
$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
|
||||
}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* Register all of the hooks related to the admin area functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_admin_hooks()
|
||||
{
|
||||
$plugin_admin = new Ssbhesabix_Admin($this->get_plugin_name(), $this->get_version());
|
||||
|
||||
//Related to check DB ver on plugin update
|
||||
$this->loader->add_action('plugins_loaded', $plugin_admin, 'ssbhesabix_update_db_check');
|
||||
|
||||
$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
|
||||
$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
|
||||
|
||||
//Related to webhook set
|
||||
$this->loader->add_filter('query_vars', $plugin_admin, 'ssbhesabix_query_vars');
|
||||
$this->loader->add_action('parse_request', $plugin_admin, 'ssbhesabix_parse_request');
|
||||
|
||||
$this->loader->add_action('wp_ajax_nopriv_handle_webhook_request', $plugin_admin, 'handle_webhook_request');
|
||||
$this->loader->add_action('wp_ajax_handle_webhook_request', $plugin_admin, 'handle_webhook_request');
|
||||
|
||||
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
|
||||
|
||||
$this->loader->add_action('init', $plugin_admin, 'ssbhesabix_init_internal');
|
||||
|
||||
//Check plugin live mode
|
||||
if (get_option('ssbhesabix_live_mode')) {
|
||||
if (get_option('ssbhesabix_hesabix_default_currency') === 0) {
|
||||
$this->loader->add_action('admin_notices', $plugin_admin, 'ssbhesabix_currency_notice');
|
||||
}
|
||||
|
||||
// these lines add hesabix id to the all products list page and make it sortable as well
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if(get_option('ssbhesabix_show_product_code_in_products_page') === 'yes') {
|
||||
$this->loader->add_filter( 'manage_edit-product_columns', $plugin_admin,'admin_products_hesabixId_column', 12 );
|
||||
$this->loader->add_action( 'manage_product_posts_custom_column', $plugin_admin, 'admin_products_hesabixId_column_content', 10, 2 );
|
||||
$this->loader->add_filter( 'manage_edit-product_sortable_columns', $plugin_admin,'admin_products_hesabixId_column');
|
||||
}
|
||||
|
||||
$this->loader->add_action('custom_product_tabs', $plugin_admin, 'ssbhesabix_general_notices');
|
||||
|
||||
// add filter and action for woocommerce order list
|
||||
$this->loader->add_filter('manage_edit-shop_order_columns', $plugin_admin, 'custom_hesabix_column_order_list', 20);
|
||||
$this->loader->add_action('manage_shop_order_posts_custom_column', $plugin_admin, 'custom_orders_list_column_content', 20, 2);
|
||||
$this->loader->add_filter('bulk_actions-edit-shop_order', $plugin_admin, 'custom_orders_list_bulk_action', 20, 1);
|
||||
$this->loader->add_filter('handle_bulk_actions-edit-shop_order', $plugin_admin, 'custom_orders_list_bulk_action_run', 10, 3);
|
||||
// check add fields to checkout page by hesabix plugin
|
||||
if(get_option('ssbhesabix_contact_add_additional_checkout_fields_hesabix') == 1)
|
||||
$this->loader->add_filter('woocommerce_checkout_fields', $plugin_admin, 'add_additional_fields_to_checkout', 10, 3);
|
||||
|
||||
// show checkout additional fields in order detail
|
||||
if(get_option('ssbhesabix_contact_add_additional_checkout_fields_hesabix') == 1)
|
||||
$this->loader->add_action('woocommerce_admin_order_data_after_billing_address', $plugin_admin, 'show_additional_fields_in_order_detail', 10, 3);
|
||||
|
||||
//Runs when a new order added.
|
||||
$this->loader->add_action('woocommerce_order_status_changed', $plugin_admin, 'ssbhesabix_hook_order_status_change', 10, 3);
|
||||
|
||||
//Runs when an order paid.
|
||||
// $this->loader->add_action('woocommerce_payment_complete', $plugin_admin, 'ssbhesabix_hook_payment_confirmation', 10, 1);
|
||||
// $this->loader->add_filter('woocommerce_payment_complete_order_status', $plugin_admin, 'ssbhesabix_hook_payment_confirmation', 10, 1);
|
||||
// $this->loader->add_filter('woocommerce_order_status_completed', $plugin_admin, 'ssbhesabix_hook_payment_confirmation', 10, 1);
|
||||
$this->loader->add_filter('woocommerce_order_status_changed', $plugin_admin, 'ssbhesabix_hook_payment_confirmation', 11, 3);
|
||||
|
||||
//Runs when a user's profile is first created.
|
||||
$this->loader->add_action('edit_user_profile', $plugin_admin, 'ssbhesabix_hook_edit_user');
|
||||
|
||||
$this->loader->add_action('user_register', $plugin_admin, 'ssbhesabix_hook_user_register');
|
||||
// $this->loader->add_action('woocommerce_new_customer', $plugin_admin, 'ssbhesabix_hook_user_register');
|
||||
// $this->loader->add_action('woocommerce_created_customer', $plugin_admin, 'ssbhesabix_hook_user_register');
|
||||
//Runs when a user updates personal options from the admin screen.
|
||||
$this->loader->add_action('personal_options_update', $plugin_admin, 'ssbhesabix_hook_user_register');
|
||||
//Runs when a user's profile is updated.
|
||||
$this->loader->add_action('profile_update', $plugin_admin, 'ssbhesabix_hook_user_register');
|
||||
//Runs when a user is deleted.
|
||||
$this->loader->add_action('delete_user', $plugin_admin, 'ssbhesabix_hook_delete_user');
|
||||
|
||||
//Runs when a product is added.
|
||||
// $this->loader->add_action('woocommerce_new_product', $plugin_admin, 'ssbhesabix_hook_new_product');
|
||||
// $this->loader->add_action('woocommerce_new_product_variation', $plugin_admin, 'ssbhesabix_hook_new_product_variation', 10, 2);
|
||||
//Runs when a product is updated.
|
||||
$this->loader->add_action('woocommerce_update_product', $plugin_admin, 'ssbhesabix_hook_new_product');
|
||||
// $this->loader->add_action('woocommerce_update_product_variation', $plugin_admin, 'ssbhesabix_hook_new_product');
|
||||
//Runs when a product is deleted.
|
||||
$this->loader->add_action('before_delete_post', $plugin_admin, 'ssbhesabix_hook_delete_product');
|
||||
//$this->loader->add_action('woocommerce_delete_product_variation', $plugin_admin, 'ssbhesabix_hook_delete_product_variation');
|
||||
|
||||
//Display Hesabix item code in Product data section
|
||||
$this->loader->add_action('woocommerce_product_options_general_product_data', $plugin_admin, 'ssbhesabix_hook_product_options_general_product_data');
|
||||
$this->loader->add_action('woocommerce_process_product_meta', $plugin_admin, 'ssbhesabix_hook_process_product_meta');
|
||||
//Display Hesabix item code in Product variable attribute section
|
||||
$this->loader->add_action('woocommerce_product_after_variable_attributes', $plugin_admin, 'ssbhesabix_hook_product_after_variable_attributes', 10, 3);
|
||||
$this->loader->add_action('woocommerce_save_product_variation', $plugin_admin, 'ssbhesabix_hook_save_product_variation', 10, 3);
|
||||
|
||||
$this->loader->add_filter('woocommerce_product_data_tabs', $plugin_admin, 'add_hesabix_product_data_tab');
|
||||
$this->loader->add_action('woocommerce_product_data_panels', $plugin_admin, 'add_hesabix_product_data_fields');
|
||||
|
||||
} elseif (!get_option('ssbhesabix_live_mode')) {
|
||||
if (get_option('ssbhesabix_business_expired'))
|
||||
$this->loader->add_action('admin_notices', $plugin_admin, 'ssbhesabix_business_expired_notice');
|
||||
else
|
||||
$this->loader->add_action('admin_notices', $plugin_admin, 'ssbhesabix_live_mode_notice');
|
||||
}
|
||||
|
||||
/*
|
||||
* Action - Ajax 'Export Tabs' from Hesabix/Export
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$this->loader->add_filter('wp_ajax_adminExportProducts', $plugin_admin, 'adminExportProductsCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminImportProducts', $plugin_admin, 'adminImportProductsCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminExportProductsOpeningQuantity', $plugin_admin, 'adminExportProductsOpeningQuantityCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminExportCustomers', $plugin_admin, 'adminExportCustomersCallback');
|
||||
|
||||
/*
|
||||
* Action - Ajax 'Sync Tabs' from Hesabix/Sync
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$this->loader->add_filter('wp_ajax_adminSyncChanges', $plugin_admin, 'adminSyncChangesCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminSyncProducts', $plugin_admin, 'adminSyncProductsCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminSyncOrders', $plugin_admin, 'adminSyncOrdersCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminUpdateProducts', $plugin_admin, 'adminUpdateProductsCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminUpdateProductsWithFilter', $plugin_admin, 'adminUpdateProductsWithFilterCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminSubmitInvoice', $plugin_admin, 'adminSubmitInvoiceCallback');
|
||||
|
||||
/*
|
||||
* Action - Ajax 'Log Tab' from Hesabix/Log
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$this->loader->add_filter('wp_ajax_adminCleanLogFile', $plugin_admin, 'adminCleanLogFileCallback');
|
||||
|
||||
$this->loader->add_filter('wp_ajax_adminSyncProductsManually', $plugin_admin, 'adminSyncProductsManuallyCallback', 10, 4);
|
||||
$this->loader->add_filter('wp_ajax_adminClearPluginData', $plugin_admin, 'adminClearPluginDataCallback', 10, 4);
|
||||
$this->loader->add_filter('wp_ajax_adminInstallPluginData', $plugin_admin, 'adminInstallPluginDataCallback', 10, 4);
|
||||
|
||||
$this->loader->add_filter('wp_ajax_adminChangeProductCode', $plugin_admin, 'adminChangeProductCodeCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminDeleteProductLink', $plugin_admin, 'adminDeleteProductLinkCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminUpdateProduct', $plugin_admin, 'adminUpdateProductCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminChangeProductsCode', $plugin_admin, 'adminChangeProductsCodeCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminDeleteProductsLink', $plugin_admin, 'adminDeleteProductsLinkCallback');
|
||||
$this->loader->add_filter('wp_ajax_adminUpdateProductAndVariations', $plugin_admin, 'adminUpdateProductAndVariationsCallback');
|
||||
|
||||
} else {
|
||||
$this->loader->add_action('admin_notices', $plugin_admin, 'ssbhesabix_missing_notice');
|
||||
}
|
||||
}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* Run the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function run() {$this->loader->run();}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* The name of the plugin used to uniquely identify it within the context of
|
||||
* WordPress and to define internationalization functionality.
|
||||
*
|
||||
* @return string The name of the plugin.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get_plugin_name() {return $this->plugin_name;}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* The reference to the class that orchestrates the hooks with the plugin.
|
||||
*
|
||||
* @return Ssbhesabix_Loader Orchestrates the hooks of the plugin.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get_loader() {return $this->loader;}
|
||||
//=====================================================================================
|
||||
/**
|
||||
* Retrieve the version number of the plugin.
|
||||
*
|
||||
* @return string The version number of the plugin.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get_version() {return $this->version;}
|
||||
//=====================================================================================
|
||||
}
|
1
includes/index.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php // Silence is golden
|
30
includes/ssbhesabix-webhook.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
*/
|
||||
|
||||
/* Check security token */
|
||||
if (!(defined('STDIN') || (strtolower(php_sapi_name()) == 'cli' && (!isset($_SERVER['REMOTE_ADDR'])
|
||||
|| empty($_SERVER['REMOTE_ADDR']))))) {
|
||||
if (substr(wp_hash(AUTH_KEY . 'ssbhesabix/webhook'), 0, 10) != $_GET['token']) {
|
||||
die('Bad token');
|
||||
}
|
||||
}
|
||||
|
||||
$post = file_get_contents('php://input');
|
||||
$result = json_decode($post);
|
||||
|
||||
if (!is_object($result)) {
|
||||
die('Invalid request.');
|
||||
}
|
||||
|
||||
if ($result->Password != get_option('ssbhesabix_webhook_password')) {
|
||||
die('Invalid password.');
|
||||
}
|
||||
|
||||
include(dirname(__FILE__) . '/class-ssbhesabix-webhook.php');
|
||||
HesabixLogService::writeLogStr("Hesabix Webhook Called");
|
||||
new Ssbhesabix_Webhook();
|
BIN
languages/ssbhesabix-fa_IR.mo
Normal file
971
languages/ssbhesabix-fa_IR.po
Normal file
|
@ -0,0 +1,971 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hesabix Accounting\n"
|
||||
"POT-Creation-Date: 2021-01-08 14:20+0330\n"
|
||||
"PO-Revision-Date: 2021-01-08 14:20+0330\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: fa_IR\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.4.2\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-WPHeader: ssbhesabix.php\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
||||
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
||||
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:137
|
||||
#, php-format
|
||||
msgid "Hesabix Plugin requires the %s to work!"
|
||||
msgstr "افزونه حسابیکس نیازمند %s است!"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:137
|
||||
msgid "WooCommerce"
|
||||
msgstr "ووکامرس"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:146
|
||||
msgid ""
|
||||
"Hesabix Plugin need to connect to Hesabix Accounting, Please check the API "
|
||||
"credential!"
|
||||
msgstr ""
|
||||
"افزونه حسابیکس نیازمند\t اتصال به نرمافزار حسابداری حسابیکس است، لطفا اطلاعات "
|
||||
"دسترسی به API حسابیکس را بررسی کنید!"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:155
|
||||
msgid ""
|
||||
"Hesabix Plugin cannot works! because WooCommerce currency in not match with "
|
||||
"Hesabix."
|
||||
msgstr ""
|
||||
"افزونه حسابیکس نمیتواند به درستی عمل کند! واحد پول پیشفرض ووکامرس با واحد پول "
|
||||
"پیشفرض حسابیکس همخوانی ندارد."
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:410 admin/class-ssbhesabix-admin.php:502
|
||||
msgid "The new Item code already used for another Item"
|
||||
msgstr "این کد قبلا برای کالایی دیگر استفاده شده است."
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:483
|
||||
msgid "Hesabix base item code"
|
||||
msgstr "کد کالای پایه در حسابیکس"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:485
|
||||
msgid ""
|
||||
"The base Item code of this product in Hesabix, if you want to map this product "
|
||||
"to another item in Hesabix, enter the new Item code."
|
||||
msgstr ""
|
||||
"این فیلد کد کالای پایه در حسابیکس است، اگر میخواهید این کالا را به کالای دیگری "
|
||||
"در حسابیکس ارتباط دهید، کد کالای جدید را وارد نمایید."
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:521
|
||||
msgid "Hesabix variable item code"
|
||||
msgstr "کد کالای متغیر در حسابیکس"
|
||||
|
||||
#: admin/class-ssbhesabix-admin.php:523
|
||||
msgid ""
|
||||
"The variable Item code of this product variable in Hesabix, if you want to map "
|
||||
"this product to another item in Hesabix, enter the new Item code."
|
||||
msgstr ""
|
||||
"این فیلد کد کالای متغییر در حسابیکس است، اگر میخواهید این کالا را به کالای "
|
||||
"دیگری در حسابیکس ارتباط دهید، کد کالای جدید را وارد نمایید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:305
|
||||
msgid "Extra Settings"
|
||||
msgstr "تنظیمات پیشرفته"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:28
|
||||
msgid "Hesabix Options"
|
||||
msgstr "تنظیمات افزونه حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:28
|
||||
msgid "Hesabix"
|
||||
msgstr "حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:38
|
||||
msgid "Home"
|
||||
msgstr "خانه"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:39
|
||||
msgid "API"
|
||||
msgstr "API"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:40
|
||||
msgid "Catalog"
|
||||
msgstr "محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:41
|
||||
msgid "Customers"
|
||||
msgstr "مشتریان"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:42
|
||||
msgid "Invoice"
|
||||
msgstr "فاکتور"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:43
|
||||
msgid "Payment Methods"
|
||||
msgstr "روشهای پرداخت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:44
|
||||
msgid "Export"
|
||||
msgstr "خروجی"
|
||||
|
||||
msgid "Import and export data"
|
||||
msgstr "ورود و خروج اطلاعات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:45
|
||||
msgid "Sync"
|
||||
msgstr "همسانسازی"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-display.php:65
|
||||
msgid ""
|
||||
"Hesabix Plugin requires the WooCommerce to work!, Please install/activate "
|
||||
"woocommerce and try again"
|
||||
msgstr ""
|
||||
"افزونه حسابیکس جهت راهاندازی نیاز به ووکامرس دارد! لطفا ووکامرس را نصب/فعال "
|
||||
"کنید و مجدد سعی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:269
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:964
|
||||
msgid "Not Defined"
|
||||
msgstr "وارد نشده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:290
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:311
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:332
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:981
|
||||
msgid "Customer ID in OnlineStore: "
|
||||
msgstr "شناسه مشتری در فروشگاه آنلاین:"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:383
|
||||
msgid "Guest Customer"
|
||||
msgstr "مشتری مهمان"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-functions.php:402
|
||||
msgid "Customer registered as a GuestCustomer."
|
||||
msgstr "مشتری به عنوان مهمان ثبتنام کرده است."
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:44
|
||||
msgid "Hesabix Accounting"
|
||||
msgstr "نرمافزار حسابداری آنلاین حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:186
|
||||
msgid "Enable or Disable Advanced Log"
|
||||
msgstr "تب لاگ پیشرفته"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1455
|
||||
msgid "Start ID"
|
||||
msgstr "از شناسه (کد کالای ووکامرس)"
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1456
|
||||
msgid "End ID"
|
||||
msgstr "تا شناسه (کد کالای ووکامرس)"
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1456
|
||||
msgid "Update Products in Hesabix based on store with filter"
|
||||
msgstr "بروزرسانی محصولات در حسابیکس بر اساس فروشگاه در بازه ID مشخص شده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:189
|
||||
msgid "Performance Optimization Settings"
|
||||
msgstr "تنظیمات بهینه سازی عملکرد"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:189
|
||||
msgid "Disable The Advanced Log"
|
||||
msgstr "غیرفعال کردن تب لاگ پیشرفته"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:190
|
||||
msgid "Enable The Advanced Log"
|
||||
msgstr "فعال کردن تب لاگ پیشرفته"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:45
|
||||
msgid ""
|
||||
"This module helps connect your (online) store to Hesabix online accounting "
|
||||
"software. By using this module, saving products, contacts, and orders in your "
|
||||
"store will also save them automatically in your Hesabix account. Besides that, "
|
||||
"just after a client pays a bill, the receipt document will be stored in "
|
||||
"Hesabix as well. Of course, you have to register your account in Hesabix "
|
||||
"first. To do so, visit Hesabix at the link here www.hesabix.com and sign up "
|
||||
"for free. After you signed up and entered your account, choose your business, "
|
||||
"then in the settings menu/API, you can find the API keys for the business and "
|
||||
"import them to the plugin’s settings. Now your module is ready to use."
|
||||
msgstr ""
|
||||
"این ماژول فروشگاه شما را به نرم افزار حسابداری آنلاین حسابیکس متصل می کند. به "
|
||||
"وسیله ی این ماژول کالاها، مشتریان و سفارشات شما به محض ثبت در سیستم فروشگاه، "
|
||||
"در حسابیکس نیز بصورت خودکار ثبت و ذخیره می شوند. همچنین با پرداخت مشتری، سند "
|
||||
"دریافت وجه از مشتری نیز در حسابیکس ثبت می شود. بدیهی است برای استفاده از این "
|
||||
"افزونه باید ابتدا یک حساب کاربری در حسابیکس داشته باشید. برای این کار می توانید "
|
||||
"به وب سایت حسابیکس به آدرس www.hesabix.com سر بزنید و به رایگان ثبت نام کنید. "
|
||||
"پس از ثبت نام در حسابیکس و ورود به حساب خود، و سپس ورود به یک کسب و کار، در "
|
||||
"قسمت تنظیمات / API می توانید کلید API مربوط به کسب و کار خود را دریافت و در "
|
||||
"قسمت تنظیمات این ماژول وارد نمایید. پس از آن ماژول شما آماده استفاده است."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:46
|
||||
msgid ""
|
||||
"For more information and a full guide to how to use Hesabix and WooCommerce "
|
||||
"Plugin, visit Hesabix’s website and go to the “Guides and Tutorials” menu."
|
||||
msgstr ""
|
||||
"برای کسب اطلاعات بیشتر و راهنمای استفاده از حسابیکس و افزونه ووکامرس به وب سایت "
|
||||
"حسابیکس، قسمت راهنما ها و خودآموز ها مراجعه کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:53
|
||||
msgid "Catalog Settings"
|
||||
msgstr "تنظیمات محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:56
|
||||
msgid "Update Price"
|
||||
msgstr "بهروزرسانی قیمت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:57
|
||||
msgid "Update Price after change in Hesabix"
|
||||
msgstr "بهروزرسانی قیمت بعد از تغییر در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:64
|
||||
msgid "Update Quantity"
|
||||
msgstr "بهروزرسانی موجودی"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:65
|
||||
msgid "Update Quantity after change in Hesabix"
|
||||
msgstr "بهروزرسانی موجودی بعد از تغییر در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:240
|
||||
msgid "Show Hesabix ID in Products Page"
|
||||
msgstr "نمایش کد حسابیکس در صفحه همه محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:679
|
||||
msgid "Default Payment Gateway By Using this Option, all Invoices Will Have this Payment Gateway as Their Payment Gateway"
|
||||
msgstr "درگاه پرداخت پیش فرض"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:695
|
||||
msgid "Default Bank Code"
|
||||
msgstr "کد بانک پیش فرض"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:689
|
||||
msgid "Default Bank Name"
|
||||
msgstr "نام بانک پیش فرض"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:683
|
||||
msgid "Save Default Bank as the Payment Gateway"
|
||||
msgstr "بانک پیش فرض به عنوان درگاه پرداخت ذخیره شود"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:684
|
||||
msgid "Save Other Payment Methods as the Payment Gateway"
|
||||
msgstr "روش های دیگر پرداخت به عنوان درگاه پرداخت ذخیره شود"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:246
|
||||
msgid "Set Special Sale as Discount in invoice"
|
||||
msgstr "ثبت فروش ویژه به عنوان تخفیف در فاکتور"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:693
|
||||
msgid "Enter Bank Code"
|
||||
msgstr "کد بانک را وارد نمایید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:700
|
||||
msgid "Enter Bank Name"
|
||||
msgstr "نام بانک را وارد نمایید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:700
|
||||
msgid "Enter Freight Code"
|
||||
msgstr "کد هزینه حمل و نقل را وارد نمایید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1642
|
||||
msgid "Delete Logs Between These Tow Dates"
|
||||
msgstr "حذف لاگ ها در بازه مشخص شده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1633
|
||||
msgid "Log History"
|
||||
msgstr "تاریخچه لاگ ها"
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1648
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1680
|
||||
msgid "Delete All Log Files"
|
||||
msgstr "پاک کردن کل لاگ ها"
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:1613
|
||||
msgid "Find Log File"
|
||||
msgstr "جستجوی فایل لاگ براساس تاریخ"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:84
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:130
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:191
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:250
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:301
|
||||
msgid "Save changes"
|
||||
msgstr "ذخیره تغییرات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:99
|
||||
msgid "Customers Settings"
|
||||
msgstr "تنظیمات مشتری"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:102
|
||||
msgid "Update Customer Address"
|
||||
msgstr "به روزرسانی آدرس مشتریان"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:103
|
||||
msgid "Choose when update Customer address in Hesabix."
|
||||
msgstr "انتخاب کنید که در چه حالتی آدرس مشتری در حسابیکس بهروزرسانی شود"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:106
|
||||
msgid "Use first customer address"
|
||||
msgstr "اولین آدرس مشتری"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:106
|
||||
msgid "update address with Invoice address"
|
||||
msgstr "به روزرسانی با آدرس فاکتور سفارش"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:106
|
||||
msgid "update address with Delivery address"
|
||||
msgstr "بهروزرسانی با آدرس ارسال سفارش"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:110
|
||||
msgid "Customer's Group"
|
||||
msgstr "دستهبندی مشتریان"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:111
|
||||
msgid "Enter a Customer's Group in Hesabix"
|
||||
msgstr "نام دستهبندی مشتریان در حسابیکس را وارد کنید"
|
||||
|
||||
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:110
|
||||
msgid "Save Customer's group"
|
||||
msgstr "ذخیره دسته بندی مشتریان"
|
||||
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:110
|
||||
msgid "Automatically save Customer's group in hesabix"
|
||||
msgstr "به صورت خودکار دسته بندی مشتریان را در حسابیکس ذخیره کن"
|
||||
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:111
|
||||
msgid "Customer's detail auto save and update"
|
||||
msgstr "ذخیره خودکار مشتریان"
|
||||
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:111
|
||||
msgid "Save and update Customer's detail automatically in hesabix"
|
||||
msgstr "ثبت و ذخیره خودکار اطلاعات مشتریان در حسابیکس"
|
||||
|
||||
msgid "Add additional fields to checkout page"
|
||||
msgstr "افزودن فیلد های دلخواه به صفحه پرداخت"
|
||||
|
||||
|
||||
msgid "Customer add field to checkout by hesabix"
|
||||
msgstr "افزودن فیلد ها توسط افزونه حسابیکس"
|
||||
|
||||
|
||||
msgid "Customer add field to checkout by postmeta"
|
||||
msgstr "استفاده از فیلد های موجود در جدول متا (که توسط افزونه های دیگر اضافه شده است)"
|
||||
|
||||
|
||||
msgid "Show"
|
||||
msgstr "نمایش"
|
||||
|
||||
msgid "Title"
|
||||
msgstr "عنوان"
|
||||
|
||||
msgid "Meta code in Postmeta"
|
||||
msgstr "کد متا در جدول پست متا"
|
||||
|
||||
msgid "National code"
|
||||
msgstr "کد ملی"
|
||||
|
||||
msgid "Economic code"
|
||||
msgstr "کد اقتصادی"
|
||||
|
||||
msgid "Registration number"
|
||||
msgstr "شماره ثبت"
|
||||
|
||||
msgid "Website"
|
||||
msgstr "وب سایت"
|
||||
|
||||
msgid "Required"
|
||||
msgstr "اجباری"
|
||||
|
||||
msgid "please enter your National code"
|
||||
msgstr "لطفا کد ملی خود را وارد کتید"
|
||||
|
||||
msgid "please enter a valid national code"
|
||||
msgstr "لطفا کد ملی معتبر وارد نمایید"
|
||||
|
||||
msgid "please enter your Economic code"
|
||||
msgstr "لطفا کد اقتصادی خود را وارد کتید"
|
||||
|
||||
msgid "please enter your Registration number"
|
||||
msgstr "لطفا شماره ثبت خود را وارد کتید"
|
||||
|
||||
msgid "please enter your Website address"
|
||||
msgstr "لطفا آدرس سایت خود را وارد کنید"
|
||||
|
||||
msgid "please enter a valid Website URL"
|
||||
msgstr "لطفا آدرس سایت معتبر وارد نمایید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:144
|
||||
msgid "Invoice Settings"
|
||||
msgstr "تنظیمات فاکتور"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:147
|
||||
msgid "Add invoice in which status"
|
||||
msgstr "افزودن فاکتور در وضعیت:"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:380
|
||||
msgid "Save invoice in draft mode in Hesabix"
|
||||
msgstr "ثبت فاکتور بصورت پیش نویس در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:557
|
||||
msgid "Save Freight"
|
||||
msgstr "ذخیره هزینه حمل و نقل"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:561
|
||||
msgid "Save as Freight"
|
||||
msgstr "ذخیره به عنوان هزینه"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:562
|
||||
msgid "Save as a Service"
|
||||
msgstr "ذخیره به عنوان یک خدمت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:562
|
||||
msgid "Service Code For Freight"
|
||||
msgstr "کد خدمت حمل و نقل ذخیره شده در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:151
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:167
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:217
|
||||
msgid "Pending payment"
|
||||
msgstr "در انتظار پرداخت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:152
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:168
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:218
|
||||
msgid "Processing"
|
||||
msgstr "در حال انجام"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:153
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:169
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:219
|
||||
msgid "On hold"
|
||||
msgstr "در انتظار بررسی"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:154
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:170
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:220
|
||||
msgid "Completed"
|
||||
msgstr "تکمیل شده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:155
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:171
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:221
|
||||
msgid "Cancelled"
|
||||
msgstr "لغو شده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:156
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:172
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:222
|
||||
msgid "Refunded"
|
||||
msgstr "مسترد شده"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:157
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:173
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:223
|
||||
msgid "Failed"
|
||||
msgstr "ناموفق"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:158
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:174
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:224
|
||||
msgid "Draft"
|
||||
msgstr "پیشنویس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:163
|
||||
msgid "Return sale invoice status"
|
||||
msgstr "ثبت فاکتور برگشت از فروش در وضعیت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:210
|
||||
msgid "Payment methods Settings"
|
||||
msgstr "تنظیمات روش پرداخت"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:213
|
||||
msgid "Add payment in which status"
|
||||
msgstr "افزودن پرداخت در وضعیت:"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:265
|
||||
msgid "API Settings"
|
||||
msgstr "تنظیمات API"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:268
|
||||
msgid "Email"
|
||||
msgstr "آدرس ایمیل"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:269
|
||||
msgid "Enter a Hesabix email account"
|
||||
msgstr "آدرس ایمیل اکانت حسابیکس را وارد کنید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:275
|
||||
msgid "Password"
|
||||
msgstr "رمزعبور"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:276
|
||||
msgid "Enter a Hesabix password"
|
||||
msgstr "رمزعبور حسابیکس را وارد کنید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:282
|
||||
msgid "API Key"
|
||||
msgstr "کلید API"
|
||||
|
||||
msgid "Login token"
|
||||
msgstr "توکن ورود"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:283
|
||||
msgid "Find API key in Setting->Financial Settings->API Menu"
|
||||
msgstr "کلید API را در حسابیکس از منوی تنظیمات->تنظیمات مالی->API پیدا کنید"
|
||||
|
||||
msgid "Find Login token in Setting->Financial Settings->API Menu"
|
||||
msgstr "توکن ورود را در حسابیکس از منوی تنظیمات->تنظیمات مالی->API پیدا کنید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:323
|
||||
msgid ""
|
||||
"No products were exported, All products were exported or there are no product"
|
||||
msgstr ""
|
||||
"هیچ محصولی استخراج نشد، تمامی محصولات قبلا استخراج شدهاند یا محصولی وجود ندارد."
|
||||
|
||||
msgid ""
|
||||
"No products were imported, All products were imported or there are no product"
|
||||
msgstr ""
|
||||
"هیچ محصولی وارد نشد، تمامی محصولات قبلا وارد شدهاند یا محصولی وجود ندارد."
|
||||
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:327
|
||||
#, php-format
|
||||
msgid "Export products completed. %s products added/updated."
|
||||
msgstr "استخراج محصولات به اتمام رسید. %s محصول استخراج شد."
|
||||
|
||||
msgid "Import products completed. %s products added/updated."
|
||||
msgstr "ورود محصولات به اتمام رسید. %s محصول وارد شد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:335
|
||||
msgid "Export products fail. Hesabix has already contained products."
|
||||
msgstr "خروجی محصولات با خطا مواجه شد. حسابیکس از قبل حاوی محصولاتی است."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:339
|
||||
msgid "Export products fail. Please check the log file."
|
||||
msgstr "خروجی محصولات با خطا مواجه شد. لطفا لاگ را بررسی کنید."
|
||||
|
||||
msgid "Import products fail. Please check the log file."
|
||||
msgstr "ورود محصولات با خطا مواجه شد. لطفا لاگ را بررسی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:340
|
||||
msgid "Export product opening quantity completed."
|
||||
msgstr "استخراج موجودی اول دوره با موفقیت به پایان رسید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:347
|
||||
msgid ""
|
||||
"Export product opening quantity fail. No Shareholder exists, Please define "
|
||||
"Shareholder in Hesabix"
|
||||
msgstr ""
|
||||
"استخراج موجودی اول دوره با خطا مواجه شد. سهامدار تعریف نشده است، لطفا ابتدا "
|
||||
"سهامداران را در حسابیکس تعریف کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:351
|
||||
msgid "No product available for Export product opening quantity."
|
||||
msgstr "محصولی جهت استخراج موجودی اول دوره در دسترس نمیباشد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:355
|
||||
msgid "Export product opening quantity fail. Please check the log file."
|
||||
msgstr "استخراج موجودی اول دوره با خطا مواجه شد. لطفا لاگ را بررسی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:366
|
||||
msgid ""
|
||||
"No customers were exported, All customers were exported or there are no "
|
||||
"customer"
|
||||
msgstr ""
|
||||
"هیچ مشتری استخراج نشد، تمامی مشتریان قبلا استخراج شدهاند یا مشتری وجود ندارد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:370
|
||||
#, php-format
|
||||
msgid "Export customers completed. %s customers added."
|
||||
msgstr "استخراج مشتریان به اتمام رسید. %s مشتری استخراج شد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:375
|
||||
msgid "Export customers fail. Please check the log file."
|
||||
msgstr "استخراج مشتریان با خطا مواجه شد. لطفا لاگ را بررسی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:381
|
||||
msgid "Export can take several minutes."
|
||||
msgstr "استخراج ممکن است چند دقیقه زمان ببرد."
|
||||
|
||||
msgid "Export customers fail. Hesabix has already contained customers."
|
||||
msgstr "خروجی مشتریان با خطا مواجه شد. حسابیکس از قبل حاوی مشتریان است."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:392
|
||||
msgid "Export Products"
|
||||
msgstr "خروجی محصولات"
|
||||
|
||||
msgid "Import Products"
|
||||
msgstr "ورود محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:395
|
||||
msgid "Export and add all online store products to Hesabix"
|
||||
msgstr "افزودن تمامی محصولات فروشگاه آنلاین در حسابیکس"
|
||||
|
||||
msgid "Import and add all products from Hesabix to online store"
|
||||
msgstr "افزودن تمامی محصولات حسابیکس به فروشگاه آنلاین"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:407
|
||||
msgid "Export Products opening quantity"
|
||||
msgstr "استخراج موجودی اول دوره"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:410
|
||||
msgid ""
|
||||
"Export the products quantity and record the 'products opening quantity' in the "
|
||||
"Hesabix"
|
||||
msgstr "استخراج موجودی محصولات و ثبت موجودی اول دوره در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:422
|
||||
msgid "Export Customers"
|
||||
msgstr "خروجی مشتریان"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:425
|
||||
msgid "Export and add all online store customers to Hesabix."
|
||||
msgstr "افزودن تمامی مشتریان فروشگاه آنلاین در حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:437
|
||||
msgid "Sync completed, All hesabix changes synced successfully."
|
||||
msgstr "همسانسازی پایان یافت. تمامی تغییرات با حسابیکس همسان شد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:445
|
||||
msgid "Sync completed, All products price/quantity synced successfully."
|
||||
msgstr "همسان سازی پایان یافت. قیمت/موجودی تمامی محصولات به روز شدند."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:449
|
||||
msgid "Sync products fail. Please check the log file."
|
||||
msgstr "همسانسازی محصولات با خطا مواجه شد. لطفا لاگ را بررسی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:459
|
||||
#, php-format
|
||||
msgid "Order sync completed. %s order added."
|
||||
msgstr "همسانسازی پایان یافت. %s فاکتور بهروزرسانی/افزوده شد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:467
|
||||
msgid "The date entered is not within the fiscal year."
|
||||
msgstr "تاریخ وارد شده در محدوده سال مالی نمیباشد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:471
|
||||
msgid "Invoices are not synced before installing the plugin."
|
||||
msgstr ""
|
||||
"فاکتورهایی که قبل از زمان نصب این پلاگین صادر شدهاند، امکان همسانسازی ندارند."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:475
|
||||
msgid "Cannot sync orders. Please enter valid Date format."
|
||||
msgstr "امکان همسان سازی سفارشات نیست. لطفا تاریخ معتبری وارد نمایید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:482
|
||||
msgid "Sync can take several minutes."
|
||||
msgstr "همسانسازی ممکن است چند دقیقه زمان ببرد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:183
|
||||
msgid "Enable or Disable Debug Mode"
|
||||
msgstr "فعال کردن دیباگ مود"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:246
|
||||
msgid "Set request amount per batch for sync products based on woocommerce in Hesabix"
|
||||
msgstr "تعداد درخواست ها در هر پارت برای همسان سازی محصولات در حسابیکس بر اساس فروشگاه آنلاین"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:263
|
||||
msgid "Set request amount per batch for sync products based on Hesabix in Woocommerce"
|
||||
msgstr "تعداد درخواست ها در هر پارت برای همسان سازی محصولات در فروشگاه آنلاین بر اساس حسابیکس"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:280
|
||||
msgid "Set request amount per batch for import products"
|
||||
msgstr "تعداد درخواست ها در هر پارت برای ورود محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:297
|
||||
msgid "Set request amount per batch for export products"
|
||||
msgstr "تعداد درخواست ها در هر پارت برای استخراج محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:308
|
||||
msgid "select"
|
||||
msgstr "انتخاب کنید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:317
|
||||
msgid "Plugin Default"
|
||||
msgstr "مقدار پیش فرض افزونه"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:314
|
||||
msgid "Set request amount per batch for export opening quantity of products"
|
||||
msgstr "تعداد درخواست ها در هر پارت برای استخراج موجودی اول دوره کالا ها"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:494
|
||||
msgid "Sync Changes"
|
||||
msgstr "همسانسازی تغییرات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:497
|
||||
msgid "Sync all Hesabix changes with Online Store."
|
||||
msgstr "همسانسازی تمامی تعییرات حسابیکس با فروشگاه آنلاین"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:509
|
||||
msgid "Sync Products Quantity and Price"
|
||||
msgstr "همسانسازی قیمت و موجودی محصولات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:512
|
||||
msgid "Sync quantity and price of products in hesabix with online store."
|
||||
msgstr "همسانسازی قیمت و موجودی محصولات حسابیکس با فروشگاه آنلاین"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:525
|
||||
msgid "Sync Orders"
|
||||
msgstr "همسانسازی سفارشات"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:528
|
||||
msgid "Sync/Add orders in online store with hesabix from above date."
|
||||
msgstr "همسانسازی سفارشات فروشگاه آنلاین با حسابیکس از تاریخ فوق"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:557
|
||||
msgid "Cannot check the last change ID. Error Message: "
|
||||
msgstr "امکان بررسی آخرین تغییرات وجود ندارد. شرح خطا:"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:567
|
||||
msgid ""
|
||||
"The fiscal year has passed or not arrived. Please check the fiscal year "
|
||||
"settings in Hesabix."
|
||||
msgstr ""
|
||||
"سال مالی گذشته است یا هنوز فرا نرسیده است، لطفا تنظیمات سال مالی در حسابیکس را "
|
||||
"بررسی کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:585
|
||||
msgid "Hesabix and WooCommerce default currency must be same."
|
||||
msgstr "واحد پول پیشفرض حسابیکس و ووکامرس باید یکی باشد."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:590
|
||||
msgid "Cannot check the Hesabix default currency. Error Message: "
|
||||
msgstr "امکان دریافت واحد پول پیشفرض حسابیکس وجود ندارد. شرح خطا:"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:598
|
||||
msgid "API Setting updated. Test Successfully"
|
||||
msgstr "تنظیمات API به روزرسانی شد، اتصال موفقیت آمیز بود."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:605
|
||||
msgid "Cannot set Hesabix webHook. Error Message:"
|
||||
msgstr "امکان تنظیم وبهوک در حسابیکس وجود ندارد. شرح خطا:"
|
||||
|
||||
msgid "Cannot connect to Hesabix. Business expired."
|
||||
msgstr "امکان اتصال به حسابیکس وجود ندارد، کسب و کار منقضی شده است."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:614
|
||||
msgid "Cannot connect to Hesabix servers. Please check your Internet connection"
|
||||
msgstr "اتصال به حسابیکس برقرار نیست، لطفا اتصال اینترنت را بررسی نمایید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:630
|
||||
msgid "No need to set!"
|
||||
msgstr "عدم نیاز به تعریف!"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:630
|
||||
msgid "Choose"
|
||||
msgstr "انتخاب کنید"
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:638
|
||||
msgid "Define at least one bank in Hesabix"
|
||||
msgstr "حداقل یک حساب بانکی در حسابیکس تعریف کنید."
|
||||
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:646
|
||||
#: admin/partials/ssbhesabix-admin-setting.php:650
|
||||
msgid "Cannot get Banks detail."
|
||||
msgstr "امکان دریافت اطلاعات بانکها نیست."
|
||||
|
||||
#: admin/partials/ssbhesabix-html-output.php:288
|
||||
msgid "Select a page…"
|
||||
msgstr "انتخاب دستهبندی"
|
||||
|
||||
#: admin/partials/ssbhesabix-html-output.php:379
|
||||
msgid "Settings were saved successfully."
|
||||
msgstr "تنظیمات بهروزرسانی شد."
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "https://www.hesabix.com/"
|
||||
msgstr "https://www.hesabix.com/"
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid "Connect Hesabix Online Accounting to WooCommerce."
|
||||
msgstr "\tاتصال نرمافزار حسابداری ابری حسابیکس به ووکامرس"
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Saeed Sattar Beglou"
|
||||
msgstr "سعید ستاربگلو"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "لاگ"
|
||||
|
||||
msgid "Events and bugs log"
|
||||
msgstr "لاگ رویدادها و خطاها"
|
||||
|
||||
msgid "Clean current log"
|
||||
msgstr "پاک کردن لاگ جاری"
|
||||
|
||||
msgid "Download log file"
|
||||
msgstr "دانلود فایل لاگ"
|
||||
|
||||
msgid "The log file was cleared."
|
||||
msgstr "فایل لاگ پاک شد."
|
||||
|
||||
msgid "Log file not found."
|
||||
msgstr "فایل لاگ پیدا نشد."
|
||||
|
||||
msgid "Update Products in Hesabix based on store"
|
||||
msgstr "به روزرسانی محصولات در حسابیکس بر اساس فروشگاه"
|
||||
|
||||
msgid "Update products in hesabix based on products definition in store."
|
||||
msgstr "به روزرسانی محصولات در حسابیکس بر اساس مشخصات آنها در فروشگاه. محصولات جدید به حسابیکس اضافه می شوند و محصولات قبلی ویرایش می شوند."
|
||||
|
||||
msgid "Update completed successfully."
|
||||
msgstr "به روزرسانی با موفقیت انجام شد."
|
||||
|
||||
msgid "Update completed successfully."
|
||||
msgstr "به روزرسانی با موفقیت انجام شد."
|
||||
|
||||
msgid "Update failed. Please check the log file."
|
||||
msgstr "به روزرسانی ناموفق بود. لطفاً لاگ را بررسی کنید."
|
||||
|
||||
msgid "Number of products in store:"
|
||||
msgstr "تعداد محصولات در فروشگاه:"
|
||||
|
||||
msgid "Number of products in hesabix:"
|
||||
msgstr "تعداد محصولات در حسابیکس:"
|
||||
|
||||
msgid "Number of linked products:"
|
||||
msgstr "تعداد محصولات لینک شده:"
|
||||
|
||||
msgid "Save and next page"
|
||||
msgstr "ذخیره و صفحه بعد"
|
||||
|
||||
msgid "Invoice in Hesabix"
|
||||
msgstr "فاکتور حسابیکس"
|
||||
|
||||
msgid "Submit Invoice"
|
||||
msgstr "ثبت فاکتور"
|
||||
|
||||
msgid "Submit Invoice in Hesabix"
|
||||
msgstr "ثبت فاکتور در حسابیکس"
|
||||
|
||||
msgid "Submit Product in Hesabix"
|
||||
msgstr "ثبت محصول در حسابیکس"
|
||||
|
||||
msgid "Do not submit product in Hesabix automatically by saving product in woocommerce"
|
||||
msgstr "با ذخیره محصول در ووکامرس، محصول را بصورت اتوماتیک در حسابیکس ثبت نکن"
|
||||
|
||||
msgid "Submit Price in Hesabix"
|
||||
msgstr "ثبت قیمت در حسابیکس"
|
||||
|
||||
msgid "Do not update product price in Hesabix by editing product in woocommerce"
|
||||
msgstr "با ویرایش محصول در ووکامرس، قیمت محصول را در حسابیکس بروز نکن"
|
||||
|
||||
msgid "Barcode in Hesabix"
|
||||
msgstr "بارکد در حسابیکس"
|
||||
|
||||
msgid "Do not update product barcode in Hesabix by saving product in woocommerce"
|
||||
msgstr "با ذخیره محصول در ووکامرس، بارکد محصول را در حسابیکس بروز نکن"
|
||||
|
||||
msgid "Do not update product category in Hesabix by saving product in woocommerce"
|
||||
msgstr "با ذخیره محصول در ووکامرس، دسته بندی محصول را در حسابیکس بروز نکن"
|
||||
|
||||
msgid "Do not update product code in Hesabix by saving product in woocommerce"
|
||||
msgstr "با ذخیره محصول در ووکامرس، کد محصول را در حسابیکس بروز نکن"
|
||||
|
||||
msgid "Shipping method"
|
||||
msgstr "روش حمل و نقل"
|
||||
|
||||
msgid "Invoice's Salesman"
|
||||
msgstr "فروشنده فاکتور"
|
||||
|
||||
msgid "Invoice Salesman Percentage"
|
||||
msgstr "درصد پورسانت فروشنده فاکتور"
|
||||
|
||||
msgid "Invoice's Project"
|
||||
msgstr "پروژه فاکتور"
|
||||
|
||||
msgid "Submit Cash in Transit"
|
||||
msgstr "ثبت در وجوه در راه"
|
||||
|
||||
msgid "Submit Invoice Receipt Cash in Transit"
|
||||
msgstr "ثبت رسید دریافت فاکتور در وجوه در راه"
|
||||
|
||||
msgid "Invoice Transaction Fee Percentage"
|
||||
msgstr "درصد کارمزد تراکنش"
|
||||
|
||||
msgid "Plugin Tutorial Video"
|
||||
msgstr "ویدیوی خودآموز افزونه"
|
||||
|
||||
msgid "Titles"
|
||||
msgstr "عناوین"
|
||||
|
||||
msgid "Accounting quantity (Total inventory)"
|
||||
msgstr "موجودی حسابداری (موجودی کل)"
|
||||
|
||||
msgid "Cannot get warehouses."
|
||||
msgstr "امکان دریافت اطلاعات انبارها نیست."
|
||||
|
||||
msgid "Update product's quantity based on"
|
||||
msgstr "بروزرسانی موجودی کالا بر اساس"
|
||||
|
||||
msgid "Warehouse system is not active in Hesabix."
|
||||
msgstr "سیستم انبارداری در حسابیکس فعال نیست."
|
||||
|
||||
msgid "API Address"
|
||||
msgstr "آدرس API"
|
||||
|
||||
msgid "Contact Code in Hesabix"
|
||||
msgstr "کد شخص در حسابیکس"
|
||||
|
||||
msgid ""
|
||||
"The contact code of this user in Hesabix, if you want to map this user "
|
||||
"to a contact in Hesabix, enter the Contact code."
|
||||
msgstr ""
|
||||
"این فیلد کد شخص در حسابیکس است، اگر میخواهید این کاربر را به شخصی "
|
||||
"در حسابیکس ارتباط دهید، کد شخص را وارد نمایید."
|
||||
|
||||
msgid "Error: Select maximum 10 orders. Due to some limitations in Hesabix API, sending too many requests in one minute is not possible."
|
||||
msgstr "خطا: حداکثر ۱۰ سفارش را انتخاب کنید. بدلیل محدودیت رابط برنامه نویسی حسابیکس، ارسال درخواست های زیاد در یک دقیقه امکان پذیر نیست."
|
||||
|
||||
msgid "Selected orders invoices have been saved. Number of saved invoices: "
|
||||
msgstr "فاکتور سفارش های انتخاب شده ثبت شد. تعداد فاکتور های ثبت شده: "
|
||||
|
||||
msgid "Update sale price"
|
||||
msgstr "بروزرسانی قیمت فروش ویژه"
|
||||
|
||||
msgid "The Sale price does not change"
|
||||
msgstr "قیمت فروش ویژه تغییر نکند"
|
||||
|
||||
msgid "The Sale price gets removed"
|
||||
msgstr "قیمت فروش ویژه حذف گردد"
|
||||
|
||||
msgid "The sale price get changes in proportion to the regular price"
|
||||
msgstr "قیمت فروش ویژه به تناسب قیمت اصلی تغییر یابد"
|
||||
|
||||
msgid "Submit invoice base on Dokan orders"
|
||||
msgstr "ثبت فاکتور بر اساس سفارشات افزونه دکان"
|
||||
|
||||
msgid "Submit parent order"
|
||||
msgstr "ثبت سفارش مادر"
|
||||
|
||||
msgid "Submit children orders"
|
||||
msgstr "ثبت زیر سفارش ها"
|
||||
|
||||
msgid "Inactive"
|
||||
msgstr "غیر فعال"
|
||||
|
||||
#~ msgid "Sync completed, All products added/updated."
|
||||
#~ msgstr "همسانسازی پایان یافت. تمامی محصولات بهروزرسانی/افزوده شدند."
|
||||
|
||||
#~ msgid "Sync completed, No product added/updated."
|
||||
#~ msgstr "همسانسازی پایان یافت. هیچ محصولی بهروزرسانی/افزوده شدند."
|
||||
|
||||
#~ msgid "Sync completed; All hesabix changes synced successfully."
|
||||
#~ msgstr "همسانسازی پایان یافت. تمامی تغییرات با حسابیکس همسان شد."
|
||||
|
||||
#~ msgid "Sync completed; All products added/updated."
|
||||
#~ msgstr "همسانسازی پایان یافت. تمامی محصولات بهروزرسانی/افزوده شدند."
|
||||
|
||||
#~ msgid "Sync completed; No product added/updated."
|
||||
#~ msgstr "همسانسازی پایان یافت. هیچ محصولی بهروزرسانی/افزوده شدند."
|
||||
|
||||
#~ msgid "Export product completed. %s product added/updated."
|
||||
#~ msgstr "استخراج پایان یافت. %s محصول بهروزرسانی/افزوده شد."
|
||||
|
||||
#~ msgid "Export customers completed. %s product added/updated."
|
||||
#~ msgstr "استخراج مشتریان پایان یافت. %s مشتری بهروزرسانی/افزوده شد."
|
73
ssbhesabix.php
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @link https://hesabix.ir/
|
||||
* @since 1.0.0
|
||||
* @package ssbhesabix
|
||||
*
|
||||
* @wordpress-plugin
|
||||
* Plugin Name: hesabix Accounting
|
||||
* Plugin URI: https://www.hesabix.ir/
|
||||
* Description: Connect hesabix Online Accounting to WooCommerce.
|
||||
* Version: 0.1.1
|
||||
* Author: Babak Alizadeh
|
||||
* License: GPL-3.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* Text Domain: ssbhesabix
|
||||
* Domain Path: /languages
|
||||
* WC requires at least: 3.0.0
|
||||
* WC tested up to: 8.4.0
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if (!defined('WPINC')) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently plugin version.
|
||||
*/
|
||||
define('SSBHESABIX_VERSION', '0.1.0');
|
||||
|
||||
/**
|
||||
* The code that runs during plugin activation.
|
||||
* This action is documented in includes/class-ssbhesabix-activator.php
|
||||
*/
|
||||
function activate_ssbhesabix() {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ssbhesabix-activator.php';
|
||||
Ssbhesabix_Activator::activate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin deactivation.
|
||||
* This action is documented in includes/class-ssbhesabix-deactivator.php
|
||||
*/
|
||||
function deactivate_ssbhesabix() {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ssbhesabix-deactivator.php';
|
||||
Ssbhesabix_Deactivator::deactivate();
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'activate_ssbhesabix' );
|
||||
register_deactivation_hook( __FILE__, 'deactivate_ssbhesabix' );
|
||||
|
||||
/**
|
||||
* The core plugin class that is used to define internationalization and
|
||||
* admin-specific hooks.
|
||||
*/
|
||||
require plugin_dir_path( __FILE__ ) . 'includes/class-ssbhesabix.php';
|
||||
|
||||
/**
|
||||
* Begins execution of the plugin.
|
||||
*
|
||||
* Since everything within the plugin is registered via hooks,
|
||||
* then kicking off the plugin from this point in the file does
|
||||
* not affect the page life cycle.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function run_ssbhesabix() {
|
||||
$plugin = new Ssbhesabix();
|
||||
$plugin->run();
|
||||
}
|
||||
|
||||
run_ssbhesabix();
|
34
uninstall.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @author Saeed Sattar Beglou <saeed.sb@gmail.com>
|
||||
* @author HamidReza Gharahzadeh <hamidprime@gmail.com>
|
||||
* @author Sepehr Najafi <sepehrn249@gmail.com>
|
||||
* @author Babak Alizadeh <alizadeh.babak@gmail.com>
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package ssbhesabix
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if (!defined( 'WP_UNINSTALL_PLUGIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once(plugin_dir_path(__DIR__) . 'admin/services/HesabixLogService.php');
|
||||
require 'includes/class-ssbhesabix-api.php';
|
||||
|
||||
// delete tags in hesabix
|
||||
$hesabixApi = new Ssbhesabix_Api();
|
||||
$result = $hesabixApi->fixClearTags();
|
||||
if (!$result->Success) {
|
||||
HesabixLogService::log(array("ssbhesabix - Cannot clear tags. Error Message: " . (string)$result->ErrorMessage . ". Error Code: " . (string)$result->ErrorCode));
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$options = $wpdb->get_results("SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%ssbhesabix%'");
|
||||
foreach ($options as $option) {
|
||||
delete_option($option->option_name);
|
||||
}
|
||||
|
||||
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ssbhesabix");
|